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

login
register
mail settings
Submitter Ben Gardiner
Date April 28, 2011, 9:03 p.m.
Message ID <7ed11e02b0db005231f5c6baa299761f3aa04f6f.1304024417.git.bengardiner@nanometrics.ca>
Download mbox | patch
Permalink /patch/93330/
State Accepted
Commit 7124015adad59dea5e72103f63531f3367c6df80
Headers show

Comments

Ben Gardiner - April 28, 2011, 9:03 p.m.
When your emulator is connected at reset (or is used to load u-boot)
it is possible to get the relocation address from the gd->relocaddr
since gd is always in r8 (on ARM) it is addressable before the
gdb has remapped symbols.

Document this alternate method in-line with the original method
written by Heiko Schocher.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Heiko Schocher <hs@denx.de>
CC: Wolfgang Denk <wd@denx.de>

---
Changes since V2:
 * add gd->relocaddr as a secondary method of obtaining the symbol-file
   gdb argument
Changes since V1:
 * update to reflect proposed changes to existing debug instructions:
   renumber steps, remove note about -DDEBUG
---
 doc/README.arm-relocation |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
Heiko Schocher - April 29, 2011, 5:36 a.m.
Hello Ben,

Ben Gardiner wrote:
> When your emulator is connected at reset (or is used to load u-boot)
> it is possible to get the relocation address from the gd->relocaddr
> since gd is always in r8 (on ARM) it is addressable before the
> gdb has remapped symbols.
> 
> Document this alternate method in-line with the original method
> written by Heiko Schocher.
> 
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Heiko Schocher <hs@denx.de>
> CC: Wolfgang Denk <wd@denx.de>
> 
> ---
> Changes since V2:
>  * add gd->relocaddr as a secondary method of obtaining the symbol-file
>    gdb argument
> Changes since V1:
>  * update to reflect proposed changes to existing debug instructions:
>    renumber steps, remove note about -DDEBUG
> ---
>  doc/README.arm-relocation |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)

Thanks!

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
Wolfgang Denk - May 12, 2011, 9:34 p.m.
Dear Ben Gardiner,

In message <7ed11e02b0db005231f5c6baa299761f3aa04f6f.1304024417.git.bengardiner@nanometrics.ca> you wrote:
> When your emulator is connected at reset (or is used to load u-boot)
> it is possible to get the relocation address from the gd->relocaddr
> since gd is always in r8 (on ARM) it is addressable before the
> gdb has remapped symbols.
> 
> Document this alternate method in-line with the original method
> written by Heiko Schocher.
> 
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Heiko Schocher <hs@denx.de>
> CC: Wolfgang Denk <wd@denx.de>
> 
> ---
> Changes since V2:
>  * add gd->relocaddr as a secondary method of obtaining the symbol-file
>    gdb argument
> Changes since V1:
>  * update to reflect proposed changes to existing debug instructions:
>    renumber steps, remove note about -DDEBUG
> ---
>  doc/README.arm-relocation |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/doc/README.arm-relocation b/doc/README.arm-relocation
index 8bfb500..45f5ea7 100644
--- a/doc/README.arm-relocation
+++ b/doc/README.arm-relocation
@@ -164,6 +164,7 @@  Program received signal SIGSTOP, Stopped (signal).
 add-symbol-file u-boot 0x8ff08000
 		       ^^^^^^^^^^
 		       get this address from u-boot bdinfo command
+		       or get it from gd->relocaddr in gdb
 
  => bdinfo
 rch_number = XXXXXXXXXX
@@ -182,4 +183,11 @@  irq_sp      = XXXXXXXXXX
 sp start    = XXXXXXXXXX
 FB base     = XXXXXXXXXX
 
+or interrupt execution by any means and re-load the symbols at the location
+specified by gd->relocaddr -- this is only valid after board_init_f.
+
+(gdb) set $s = gd->relocaddr
+(gdb) symbol-file
+(gdb) add-symbol-file u-boot $s
+
 Now you can use gdb as usual :-)