Debug Linux kernel pre-decompression stage
Posted
by
Shawn J. Goff
on Stack Overflow
See other posts from Stack Overflow
or by Shawn J. Goff
Published on 2012-03-05T23:40:39Z
Indexed on
2012/10/12
3:37 UTC
Read the original article
Hit count: 250
I am trying to use GDB to debug a Linux kernel zImage before it is decompressed. The kernel is running on an ARM target and I have a JTAG debugger connected to it with a GDB server stub. The target has to load a boot loader. The boot loader reads the kernel image from flash and puts it in RAM at 0x20008000
, then branches to that location.
I have started GDB and connected to the remote target, then I use GDB's add-symbol-file
command like so:
add-symbol-file arch/arm/boot/compressed/vmlinux 0x20008000 -readnow
When I set a breakpoint for that address, it does trap at the correct place - right when it branches to the kernel. However, GDB shows the wrong line from the source of arch/arm/boot/compressed/head.S
. It's 4 lines behind. How can I fix this?
I also have tried adding the -s section addr
option to add-symbol-file
with -s .start 0x20008000
; this results in exactly the same problem.
© Stack Overflow or respective owner