Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Apr 1997 16:08:48 +0100 (BST)
From:      Doug Rabson <dfr@nlsystems.com>
To:        hackers@freebsd.org
Subject:   Debugging lkms using GDB
Message-ID:  <Pine.BSF.3.95q.970405160112.8538H-100000@herring.nlsystems.com>

next in thread | raw e-mail | index | archive | help
Ever been frustrated by the lack of symbols in LKMs when debugging?  Just
use kgdb over a serial line:

On debugging machine

# cd /usr/src/lkm/linux
# make clean; make COPTS=-g
# gdb -k /...path to kernel/kernel

On test machine

# ... install debug version of linux_mod.o ...
# linux
# modstat
Type     Id Off Loadaddr Size Info     Rev Module Name
EXEC      0   4 f5109000 001c f510f010   1 linux_mod
DEV       1  30 f5114000 0154 f514804c   1 oss_mod

... attach to remote gdb ...

On debugging machine

(kgdb) add-symbol-file /usr/src/lkm/linux/linux_mod.o 0xf5109020
add symbol table from file "/usr/src/lkm/linux/linux_mod.o" at
text_addr = 0xf5109020?
(y or n) y
(kgdb) ... debug the lkm with full debugging symbols! ...

The important thing is to add 0x20 to the address the module was loaded at
(I guess this is the size of the a.out header).

--
Doug Rabson				Mail:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 951 1891




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970405160112.8538H-100000>