Wrong line number in stack-trace in debugging Linux kernel using kgdb

110 views Asked by At

I am trying to debug a driver for an Ethernet-MAC in the Linux kernel using kgdb over serial.
I halt the execution by making a call to "kgdb_breakpoint()" at the desired location in the code and recompile the kernel.

But after the code halts, as you may notice in the screenshot the backtrace shows correct function-graph and source filenames but, for some reason corresponding line numbers are not correct.

Please note: I have compiled this kernel with "CONFIG_FRAME_POINTER" set and "nokaslr" in the boot-args.

Is there a way I can see a stack trace with correct line number here ?
(I have used QtCreator during this screenshot, although behavior is similar with gdb over command-line or TUI)


Edit: No matter, whichever function I put the `kgdb_breakpoint()` in, (inside the driver source) , line number in the stacktrace always say the same line number for the halted function.
0

There are 0 answers