[U-Boot] [PATCH] README.arm-relocation: get relocated address in gdb
Ben Gardiner
bengardiner at nanometrics.ca
Thu Apr 28 15:12:21 CEST 2011
When your emulator is connected at reset (or is used to load u-boot)
it is possible to get the relocation address from the parameter
passed to relocate_code() instead of building with -DDEBUG and
extracting from the console messages.
Document this alternate method following the style of the original
method written by Heiko Schocher.
Signed-off-by: Ben Gardiner <bengardiner at nanometrics.ca>
CC: Heiko Schocher <hs at denx.de>
---
doc/README.arm-relocation | 56 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/doc/README.arm-relocation b/doc/README.arm-relocation
index c0957c2..1c2d783 100644
--- a/doc/README.arm-relocation
+++ b/doc/README.arm-relocation
@@ -192,3 +192,59 @@ Now running in RAM - U-Boot at: 8ff08000
^^^^^^^^
Now you can use gdb as usual :-)
+
+An alternative to retrieving the relocated base address from the debug printfs
+is to evaluate the 'addr' parameter of relocate_code() and use its value as the
+argument to add-symbol-file. This method is only available when your emulator
+is connected to the target on reset.
+
+-----------------
+
+a) [different than above] Compile as usual -- adding -DDEBUG can change the
+relocated base address, this method will work on builds that do not have any
+extra verbosity on boot
+
+-----------------
+b) [same as above] start debugger
+c) [same as above] connect to target
+[remainder is different than above]
+-----------------
+
+d) set breakpoint on relocate_code
+
+(gdb) b relocate_code
+Breakpoint 1 at 0xc1080078: file start.S, line 196.
+
+-----------------
+
+e) run target until relocate_code
+
+(gdb) c
+Breakpoint 2, relocate_code () at start.S:197
+197 mov r5, r1 /* save addr of gd */
+(gdb) d
+Delete all breakpoints? (y or n) y
+
+-----------------
+
+f) discard symbol file
+
+(gdb) symbol-file
+Discard symbol table from `/home/bengardiner/src/u-boot/u-boot'? (y or n) y
+No symbol file now.
+(gdb)
+
+-----------------
+
+g) load new symbol table using the addr parameter (aka $r2)
+
+(gdb) add-symbol-file u-boot $r2
+add symbol table from file "u-boot" at
+ .text_addr = 0xc7f53000
+(y or n) y
+Reading symbols from /home/bengardiner/src/u-boot/u-boot...done.
+
+-----------------
+
+h) set breakpoints for any function after (and including) board_init_r
+
--
1.7.1
More information about the U-Boot
mailing list