I'm trying to debug Linux Kernel 5.15.47 and a kernel module that I am building. I'm using gdb and unfortunately, everytime I load up the vmlinux file in gdb in preparation for remote debugging using qemu, I am presented with the following error. Note, I tried using GDB on the qemu VM as well (so no remote debugging) and the error still happens there too.
I don't see much discussion around something similar so I figured I would ask if anyone has a work around for this?
(gdb) file vmlinux
Reading symbols from vmlinux...
Traceback (most recent call last):
File "/home/administrator/Kernels/built/linux-5.15.47/vmlinux-gdb.py", line 34, in <module>
import linux.proc
File "/home/administrator/Kernels/built/linux-5.15.47/scripts/gdb/linux/proc.py", line 15, in <module>
from linux import constants
File "/home/administrator/Kernels/built/linux-5.15.47/scripts/gdb/linux/constants.py", line 10, in <module>
LX_hrtimer_resolution = gdb.parse_and_eval("hrtimer_resolution")
gdb.error: 'hrtimer_resolution' has unknown type; cast it to its declared type
(gdb) lx-symbols /home/administrator/<module>/src
loading vmlinux
Traceback (most recent call last):
File "/home/administrator/Kernels/built/linux-5.15.47/vmlinux-gdb.py", line 34, in <module>
import linux.proc
File "/home/administrator/Kernels/built/linux-5.15.47/scripts/gdb/linux/proc.py", line 15, in <module>
from linux import constants
File "/home/administrator/Kernels/built/linux-5.15.47/scripts/gdb/linux/constants.py", line 10, in <module>
LX_hrtimer_resolution = gdb.parse_and_eval("hrtimer_resolution")
gdb.error: 'hrtimer_resolution' has unknown type; cast it to its declared type
No source file named kernel/module.c.
The kernel/module.c file does exist that it is complaining about.
vmlinuxhave debug-symbols? I.e. doesfile vmlinuxsay that the file is "stripped" or "not stripped"?vmlinuxshould have the debug symbols. I enabled them when building the kernel. But I can't verify in gdb. Every time I dofile vmlinux, I get the same traceback from Python as in my post. i.e.gdb.error: 'hrtimer_resolution' has unknown type; cast it to its declared typefile vmlinuxwhen run from your shell, not from within GDB.file vmlinux. It isn't strippedvmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=b8ab6b15dc6d013b1c6b7f72d632a576c3645675, with debug_info, not stripped