I struggling to debug kernel with gdb, list command not showing source code around the line. Target device is Beaglebone with yocto image build with kgdb and debug infos. Host pc is Ubuntu 20.04.6 LTS with arm-none-eabi-gdb 14.1 with kernel commandline kgdboc=ttyS0,115200 kgdbwait nokaslr. boot stops and waits for connection from gdb on host pc. On the host pc I have copied kernel source files and vmlinux under a folder. Run gdb and connect to target kgdb/kernel. I can also backtrace with bt, but not able to see list command output as expected. When I run gdb with tui option no source available appears on tui window. Why I can not view the source lines around the breakpoint hit location?
Here is the flow:
sudo arm-none-eabi-gdb ./vmlinux
GNU gdb (GDB) 14.1
Copyright (C) 2023 Free Software Foundation, Inc.
...
Reading symbols from ./vmlinux...
(gdb) directory /home/yzcifci/ycwork4/poky/build/tmp/work-shared/beaglebone-yocto/kernel-source
Source directories searched: /home/yzcifci/ycwork4/poky/build/tmp/work-shared/beaglebone-yocto/kernel-source:$cdir:$cwd
...
set serial baud 115200
target remote /dev/ttyUSB1
...
arch_kgdb_breakpoint () at /usr/src/kernel/arch/arm/include/asm/kgdb.h:46
warning: 46 /usr/src/kernel/arch/arm/include/asm/kgdb.h: No such file or directory
(gdb) bt
#0 arch_kgdb_breakpoint () at /usr/src/kernel/arch/arm/include/asm/kgdb.h:46
#1 kgdb_breakpoint () at /usr/src/kernel/kernel/debug/debug_core.c:1234
#2 0xc00d49e4 in kgdb_initial_breakpoint () at /usr/src/kernel/kernel/debug/debug_core.c:1032
#3 kgdb_register_io_module (new_dbg_io_ops=new_dbg_io_ops@entry=0xc132abe0 <kgdboc_io_ops>) at /usr/src/kernel/kernel/debug/debug_core.c:1173
#4 0xc060e178 in configure_kgdboc () at /usr/src/kernel/drivers/tty/serial/kgdboc.c:232
#5 0xc060e2e0 in kgdboc_probe (pdev=<optimized out>) at /usr/src/kernel/drivers/tty/serial/kgdboc.c:266
#6 0xc0696534 in platform_probe (_dev=0xc1aae410) at /usr/src/kernel/drivers/base/platform.c:1411
...
(gdb) list
41 in /usr/src/kernel/arch/arm/include/asm/kgdb.h
Can anybody help me what is wrong here?
tried directory command to kernel sources but got the same result