Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: Improve support for "debugging" unlinked objects
Date: Fri, 10 Jun 2005 20:10:00 -0000	[thread overview]
Message-ID: <42A9F3A4.9080001@redhat.com> (raw)
In-Reply-To: <20050608214956.GA10586@nevyn.them.org>

Daniel Jacobowitz wrote:
> If you compile a file containing both code and initialized data, and load
> the unlinked object (.o) file using GDB, "print Variable" won't work. 
> You'll get garbage-looking data, which is in fact the start of the first
> section in the file - usually .text.
> 
> All sections appear to have address 0.  i.e., they overlap, sort of like
> overlays but not similar enough to reuse the overlay machinery.  For this
> case, if we fill in section_offsets, we can place them at random locations
> which are sufficiently unique that we can see the locations of variables as
> distinct.  And if we pass this information back to exec.c, we can see the
> values of variables correctly, too.
> 
> Here's a patch along with a testcase; the test fails before the patch, and
> passes afterwards.  Any comments on the way I fixed this?
> 

I think this is a great idea, and...

 > Also, with a fix that I'm going to commit to bfd soon, you
 > can use "gdb -write" to patch an object file.

this bit's especially great.

One suggestion -- could you use the section's file offset
in place of a "random location"?  I'm guessing it's available
from bfd, and it seems to me that it's guaranteed to be unique.

There might be some advantage in terms of following non-relocated
branches etc.

Michael


  parent reply	other threads:[~2005-06-10 20:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-08 21:50 Daniel Jacobowitz
2005-06-09  3:44 ` Eli Zaretskii
2005-06-09 13:17   ` Daniel Jacobowitz
2005-06-09 19:50     ` Eli Zaretskii
2005-06-09 19:51       ` Daniel Jacobowitz
2005-06-10 20:10 ` Michael Snyder [this message]
2005-06-13 16:15   ` Daniel Jacobowitz

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=42A9F3A4.9080001@redhat.com \
    --to=msnyder@redhat.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /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