2

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.
HungryFoolish
  • 542
  • 1
  • 9
  • 27
  • 1
    It means the binary you are running does not match the debugging information – stark Mar 12 '22 at 03:08
  • I am booting the kernel over tftp and, the tftp server is configured to serve the uImage in arch/xxx/boot/ which is supposed to be updated on every build in along with executable image used with gdb. – HungryFoolish Mar 12 '22 at 04:43

0 Answers0