
Hi Dave,
On Thu, Feb 26, 2015 at 9:05 PM, DaveKucharczyk david.kucharczyk@gmail.com wrote:
I would like to debug from the earliest possible point pre-relocation (for educational reasons). Couple questions....
In the Makefile, where do I place the following flags... -Os #-fomit-frame-pointer -g -fno-schedule-insns -fno-schedule-insns2
I've added the flags in a few different spots, but I still can't break on cpu_init_f. Here's the output... (gdb) b cpu_init_f Function "cpu_init_f" not defined. Make breakpoint pending on future shared library load? (y or [n]) y
I assume the flags didn't get set, specifically -g.
To backup a little here is what I get when I do target remote...
(gdb) target remote 169.254.21.13:2001 Remote debugging using 169.254.21.13:2001 warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. 0x00000000 in ?? () (gdb)
I assume those warning are related to my issue above?
You have to load the symbols from the unstripped U-Boot ELF file: https://sourceware.org/gdb/current/onlinedocs/gdb/Files.html#Files
You can use 'symbol-file' first. The loaded symbols will match the PC values only until relocation. Then, you can use 'add-symbol-file' to specify the relocation address.
If needed, 'set sysroot' can be used for the shared libraries, but this does not apply to U-Boot.
Note that very early after boot, the PC will be in the boot ROM, so there won't be any matching symbols.
Also, when I power on the target, u-boot just starts loading. How do I halt it? I tried to set a breakpoint at text base in the BDI, but it doesn't halt.
You must have a configuration file for your JTAG probe. In this file, you can choose between hardware and software breakpoints, select the default action (run, run for some time, halt, etc.), set breakpoints, etc. With all these settings, you should be able to halt early. You can also use the JTAG probe Telnet to issue a manual break when needed. Avoid setting breakpoints directly onto exception vectors like reset; sometimes it does not work well, so it is better to set it on a known function executed a bit later.
Best regards, Benoît