All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] README.arm-relocation: get relocated address in gdb
Date: Thu, 28 Apr 2011 19:22:40 +0200	[thread overview]
Message-ID: <4DB9A260.7010706@denx.de> (raw)
In-Reply-To: <713eaea232693cd6775d409b17c2e187328d1598.1304008866.git.bengardiner@nanometrics.ca>

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 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@nanometrics.ca>
> CC: Heiko Schocher <hs@denx.de>
> CC: Wolfgang Denk <wd@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(-)

Thanks!

> 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)
> +

Maybe we can add here also the info, that we can get this
address through the bdinfo command?

> +(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 :-)"
> +

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2011-04-28 17:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28 16:49 [U-Boot] [PATCH v2 0/2] README.arm-relocation: debugging options update Ben Gardiner
2011-04-28 16:49 ` [U-Boot] [PATCH v2 1/2] README.arm-relocation: get relocated address from bdinfo Ben Gardiner
2011-05-12 21:32   ` Wolfgang Denk
2011-04-28 16:49 ` [U-Boot] [PATCH 2/2] README.arm-relocation: get relocated address in gdb Ben Gardiner
2011-04-28 17:22   ` Heiko Schocher [this message]
2011-05-12 21:32   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DB9A260.7010706@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.