Skip to main content.

14.2.7. Wrong debug symbols after relocation

Question:
I want to debug U-Boot after relocation to RAM, but it doesn't work since all the symbols are at wrong addresses now.

Answer:
To debug parts of U-Boot that are running from ROM/flash, i. e. before relocation, just use a command like "powerpc-linux-gdb uboot" as usual.

For parts of U-Boot that run from RAM, i. e. after relocation, use "powerpc-linux-gdb" without arguments, and use the add-symbol-file command in GDB to load the symbol table at the relocation address in RAM. The only problem is that you need to know that address, which depends on RAM size, length reserved for U-Boot, size of "protected RAM" area, etc. If in doubt, enable DEBUG mode when building U-Boot so it prints the address to the console.

TIP Hint: I use definitions like these in my .gdbinit file:
define rom
        file u-boot
end
                                                                                
define ram
        add-sym u-boot  0x01fe0000
end

Note: when you want to switch modes during one debug session (i. e. without restarting GDB) you can "delete" the current symbol information by using the symbol-file command without arguments, and then either using "symbol-file u-boot" for code before relocation, or "add-symbol-file u-boot _offset_" for code after relocation.
14.2.6. Net: No ethernet found 1. Abstract 14.2.8. Decoding U-Boot Crash Dumps
Prev Home Next