public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Ton van Overbeek <v-overbeek@cistron.nl>
To: "Stefan Burström" <f94sbu@efd.lth.se>, "Andreas Schwab" <schwab@suse.de>
Cc: gdb@sources.redhat.com
Subject: Re: Relocation question
Date: Thu, 11 Aug 2005 13:51:00 -0000	[thread overview]
Message-ID: <20050811153614.N16092-100000@xs2.xs4all.nl> (raw)

Andreas Schwab wrote:

>Stefan Burström <f94sbu@efd.lth.se> writes:
>
>> Can someone explain to me how gdb is supposed to handle relocated
>> executables? I am porting gdb to AmigaOS4 which relocates its
>> executables
>> when they are loaded. However, when I run an application through gdb,
>> gdb uses the bfd functions to build its map over the file. However, the
>> bfd library always relocates everything relative to 0 (since it
>> obviously doesn't know anything else to relocate it to)
>
> That reminds me of an old port of gdb 3.6 for the AtariST (which has the
> same problem).  It used CREATE_INFERIOR_HOOK (now called
> TARGET_CREATE_INFERIOR_HOOK) to query the load address of the just
> started
> process and then patched the gdb symtabs and breakpoint addresses by the
> load offset.  But I don't think that would still work nowadays.

Have a look at how we solved this in prc-tools for PalmOS:
http://prc-tools.sourceforge.net. Go to the cvs and look at the patch for
gdb. It is for gdb 5.3, but the mechanism still works for 6.x.
PalmOS can also have multiple code sections whose start addresses are not
known untill runtime. A patch supporting that is on
http://www.v-overbeek.nl/msectgdb.

Basically when execution starts (either on a real PalmOS device or on an
emulator) the start addresses of the .text and .data and other code
sections are reported to gdb, which then relocates the symbol tables.
(PalmOS is also m68k).

Hope this helps.

Ton van Overbeek
(for Andreas: my first Linux experience was with Linux-68k on Atari-TT)
(for Stefan: gjorde mitt examensarbete på LTH, Reglerteknik)

             reply	other threads:[~2005-08-11 13:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11 13:51 Ton van Overbeek [this message]
2005-08-15  4:00 ` Missing "angeldll.h" in gdb/rdi-shareestion Dave Murphy
2005-08-15  4:08   ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2005-08-10 19:00 Relocation question Stefan Burström
2005-08-10 19:54 ` Simon Richter
2005-08-10 21:33 ` Andreas Schwab

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=20050811153614.N16092-100000@xs2.xs4all.nl \
    --to=v-overbeek@cistron.nl \
    --cc=f94sbu@efd.lth.se \
    --cc=gdb@sources.redhat.com \
    --cc=schwab@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).