[U-Boot-Users] Debugging u-boot after relocation - add-symbol-file issues with gdb 6.4

Hi everybody,
I'm trying to debug U-Boot crashes with the help of a BDI2000. Remote debugging with gdb works fine until the point where u-boot relocates to SDRAM. At that point, the symbols in the ELF image obviously become useless.
After reading the mailing list archive I found out about the add-symbol-file gdb command. I've been able to add symbol files from the u-boot image relative to the relocated address. gdb prints the correct relocated location when asked for the address of a symbol. Unfortunately, it isn't able to display source code when stepping through the software. The file in which the function at the current PC value seems to be found correctly, but gdb will always display the first line of code in that file. That's probably because the relocated address is lower than the first line of code address before relocation. gdb should have (at least in my opinion) updated the debug symbols, but it doesn't seem to have done so.
Is there something I've done wrong, or is that a gdb bug ? Does anyone know of a workaround ?
Thanks for all the help you can provide.
Best regards,
Laurent Pinchart

In message 200605051651.00264.laurent.pinchart@tbox.biz you wrote:
After reading the mailing list archive I found out about the add-symbol-file gdb command. I've been able to add symbol files from the u-boot image relative to the relocated address. gdb prints the correct relocated location when asked for the address of a symbol. Unfortunately, it isn't able to display source code when stepping through the software. The file in which the function at the current PC value seems to be found correctly, but gdb will always display the first line of code in that file. That's probably because the relocated address is lower than the first line of code address before relocation. gdb should have (at least in my opinion) updated the debug symbols, but it doesn't seem to have done so.
Is there something I've done wrong, or is that a gdb bug ? Does anyone know of a workaround ?
Sounds like a toolchain problem to me. For a test, try the GDB that comes with the ELDK.
Best regards,
Wolfgang Denk

After reading the mailing list archive I found out about the add-symbol-file gdb command. I've been able to add symbol files from the u-boot image relative to the relocated address. gdb prints the correct relocated location when asked for the address of a symbol. Unfortunately, it isn't able to display source code when stepping through the software. The file in which the function at the current PC value seems to be found correctly, but gdb will always display the first line of code in that file. That's probably because the relocated address is lower than the first line of code address before relocation. gdb should have (at least in my opinion) updated the debug symbols, but it doesn't seem to have done so.
Is there something I've done wrong, or is that a gdb bug ? Does anyone know of a workaround ?
Sounds like a toolchain problem to me. For a test, try the GDB that comes with the ELDK.
That works much better. Not sure if a patch in the ELDK fixes the problem or if this was a regression introduced in GDB 6.4. I had upgraded from 6.3 to 6.4 because of another issue (GDB printed <signal handler called> instead of source lines when stepping through code in remote mode) which seems to have been fixed by the ELDK patches.
Thanks for your help.
Best regards,
Laurent Pinchart
participants (2)
-
Laurent Pinchart
-
Wolfgang Denk