Debugging symbols on kernel module
Andriy Voskoboinyk
s3erios at gmail.com
Mon Sep 25 07:50:35 UTC 2017
Hi,
for debugging purposes I'm adding next line in make.conf:
CFLAGS+= -O0 -g
Works for modules but not for the kernel
(KSTACK_PAGES needs to be increased for the whole kernel build).
> Hi all,
>
> I am working on a kernel module but am getting some unexpected code
> execution. Dtrace probes reveal that the kernel executes:
> "rtwn.ko`r88ee_init_bb+0x219" and then jumps to an unexpected function.
>
> I would like to track down exactly which line that is. I compiled the
> module with this:
>
> # make DEBUG_FLAGS=-g3 -C sys/modules/rtwn/
>
> This produced the rtwn.ko.debug and rtwn.ko.full files. But when I load
> them, I still do not have debugging symbols:
>
> $ kgdb rtwn.ko
> GNU gdb (GDB) 8.0 [GDB v8.0 for FreeBSD]
> Copyright (C) 2017 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-portbld-freebsd12.0".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
> <http://www.gnu.org/software/gdb/documentation/>.
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from rtwn.ko...Reading symbols from
> /usr/src/sys/modules/rtwn/rtwn.ko.debug...(no debugging symbols
> found)...done.
> (no debugging symbols found)...done.
> (kgdb) file rtwn.ko.debug
> Reading symbols from rtwn.ko.debug...(no debugging symbols found)...done.
> (kgdb) file rtwn.ko.full
> Reading symbols from rtwn.ko.full...(no debugging symbols found)...done.
>
> How do I properly load debugging symbols for the module?
>
> Thanks,
>
> Farhan Khan
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe at freebsd.org"
More information about the freebsd-hackers
mailing list