[U-Boot] [PATCH 2/2] README.arm-relocation: get relocated address in gdb

Ben Gardiner bengardiner at nanometrics.ca
Thu Apr 28 18:49:48 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>
CC: Wolfgang Denk <wd at denx.de>

---

Changes since V1:
  * update to reflect proposed changes to existing debug instructions:
    renumber seteps, remove note about -DDEBUG

---
 doc/README.arm-relocation |   51 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/doc/README.arm-relocation b/doc/README.arm-relocation
index 8bfb500..c5aef55 100644
--- a/doc/README.arm-relocation
+++ b/doc/README.arm-relocation
@@ -183,3 +183,54 @@ sp start    = XXXXXXXXXX
 FB base     = XXXXXXXXXX
 
 Now you can use gdb as usual :-)
+
+An alternative to retrieving the relocated base address from the bdinfo command
+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) [same as above] start debugger
+b) [same as above] connect to target
+[remainder is different than above]
+-----------------
+
+c) set breakpoint on relocate_code
+
+(gdb) b relocate_code
+Breakpoint 1 at 0xc1080078: file start.S, line 196.
+
+-----------------
+
+d) 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
+
+-----------------
+
+e) 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)
+
+-----------------
+
+f) 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.
+
+-----------------
+
+g) set breakpoints for any function after (and including) board_init_r.
+"Now you can use gdb as usual :-)"
+
-- 
1.7.1



More information about the U-Boot mailing list