0

there is a function rtl8169_poll in linux kernel linux-5.12.6 inside realtek Ethernet device driver. inside the location lib/modules/5.12.6/kernel/drivers/net/ethernet/realtek/ there is r8169.ko which shows the function exists and gives offset address 0000000000000f00 when do objdump command objdump -S r8169.ko

So in gdb when I debug vmlinux -- and did list rtl8169_poll it says Function "rtl8169_poll" not defined. Basically I will be unable to debug this function when remote debugging with kgdb running target and gdb on development system. all this is done in compiled directory which contains vmlinux file. the full location is /home/fwd/Desktop/kernel-5.12.5/vmlinux

But when I did debug vmlinuz file and tried to list rtl8169_poll the out of this is

No symbol table is loaded.  Use the "file" command.

what the above line says I have added these flags when compiling kernel what is this output No symbol table is loaded. Use the "file" command talks about

CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_INFO=y
CONFIG_CONSOLE_POLL=y
CONFIG_KDB_CONTINUE_CATASTROPHIC=0
CONFIG_KDB_DEFAULT_ENABLE=0x1
CONFIG_KDB_KEYBOARD=y
CONFIG_KGDB=y
CONFIG_KGDB_KDB=y
CONFIG_KGDB_LOW_LEVEL_TRAP=y
CONFIG_KGDB_SERIAL_CONSOLE=y
CONFIG_KGDB_TESTS=y
CONFIG_KGDB_TESTS_ON_BOOT=n
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
CONFIG_SERIAL_KGDB_NMI=n

the gdb list command rtl8169_poll is done locally on target machine.Currently not started remote debugging. But I expect that the list command should have printed the function because its verified that function exists inside the driver located at /lib/modules/...../realtek/ with objdump and I have added degug flags when compiling kernel plus lspci -vvv also display the driver under 04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)

user786
  • 3,902
  • 4
  • 40
  • 72
  • .ko is a module. So you have the symbol in a module kernel (loaded later) and not on the core kernel. – Giacomo Catenazzi Jun 04 '21 at 12:10
  • @GiacomoCatenazzi `ko is a module. So you have the symbol in a module kernel (loaded later) and not on the core kernel` does this mean I will unable to debug kernel and so the device driver when running `kgdb` on target and `gdb` on remote? Does the `kernel module` which is `r8169.ko` - `has to be on core kernel`? if yes then how to make kernel module on the `core kernel`? please clarify do I need to add extra debug flags when compiling or something? – user786 Jun 04 '21 at 12:19
  • I do not know. You should search (and eventually ask) about how to debug a module. Or just built the driver as "built-in" and not as module, and you avoid the problem. [I'm old generation: I debug with printk]. – Giacomo Catenazzi Jun 04 '21 at 12:54
  • It's possible to debug kernel with modules. You need to figure out how to add a symbol table that debugger can see it. For that you will need the address the module is loaded to. – 0andriy Jun 04 '21 at 21:54
  • @0andriy can I use -- 9 pin serial port on target and on host usb port -- connecting cable? For kernel remote debugging – user786 Jun 05 '21 at 09:13

0 Answers0