From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: drow@false.org (Daniel Jacobowitz)
Cc: jimb@codesourcery.com, gdb-patches@sourceware.org
Subject: Re: [rfc] Make DWARF-2 "address size" explicit
Date: Tue, 29 Jan 2008 19:00:00 -0000 [thread overview]
Message-ID: <200801291837.m0TIbWsI014278@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20080128210757.GA19391@caradoc.them.org> from "Daniel Jacobowitz" at Jan 28, 2008 04:07:57 PM
Dan Jacobowitz wrote:
> On Mon, Jan 28, 2008 at 09:52:32PM +0100, Ulrich Weigand wrote:
> > When comparing all this with what GDB currently does, there is
> > one obvious error: GDB does not take the FDE encoding into
> > account *at all* when accessing the operand of DW_CFA_set_loc
> > in the .eh_frame section. It looks like this was already noticed
> > by Dan some time ago, but the associated patch:
> >
> > http://www.cygwin.com/ml/gdb-patches/2006-10/msg00063.html
> >
> > apparently was never applied. Dan, are you still planning on
> > applying this patch?
>
> If you could look over that patch and tell me if it looks right, I'll
> apply it. I had no way to test it with valid debug information.
Your patch certainly looks right to me. I'm wondering about this
comment, however:
+ /* Always apply the objfile offset. We can do this because
+ if the code used DW_EH_PE_absptr, it probably wasn't
+ relocatable, so the offset should be zero. */
+ fs->pc += ANOFFSET (unit->objfile->section_offsets,
+ SECT_OFF_TEXT (unit->objfile));
I agree that we should always apply the objfile offset. In fact,
even in the case of a DW_EH_PE_absptr in a relocatable object,
it *still* should be right to apply the offset: in this case,
there will be a relocation on the .eh_frame section that gets
applied when loading it into memory. So if we'd read the value
from the in-memory copy, it would be wrong to add any offset.
However, we actually read the section contents via the
symfile_relocate_debug_section routine, which -while it does
apply relocations- assumes every section is located at its
default offset. So to get actual addresses we still need to
apply the section offset, right?
Apart from that, just a cosmetic comment: I was wondering
why you didn't simply add a back-link from struct dwarf2_cie
to its containing struct comp_unit. Then you'd automatically
have the CU available whereever you already have a CIE or FDE
pointer, without having to add "unit" arguments to all those
functions ...
> > Apart from that, it would appear that the most logical size to
> > use for target addresses in DWARF expression evaluation would
> > be the target "void *" size for .eh_frame FDEs, and the value
> > of the associated compilation unit's .debug_info address size
> > header field value for .debug_frame FDEs (however, I'm not sure
> > how to best determine that).
>
> DJ Delorie ran into this same mess on the GCC list a few days ago and
> Ian had the helpful suggestion to just avoid the bits that depend on
> the ambiguous "address size". If enough people do that, maybe it
> won't matter what we pick... I think your choices sound correct. It's
> hard for .debug_info, though, as there is no direct correlation or
> dependency between the sections.
Yes, unfortunately you cannot look up the CU that corresponds to the
address range covered by the FDE, because to read that address range
you already need to know the address size :-/
You could make a pass over all .debug_info CU headers in the whole
objfile, and check whether they all agree on their address size
value -- I think this should just about always be true, as even on
those targets where GCC supports multiple address sizes (i.e. mips),
they can only be changed via ABI-breaking options, so those should
never be linked together into a single objfile. If they all *do*
agree, then we have a number we can use ... Does this make sense?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2008-01-29 18:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-09 19:40 Ulrich Weigand
2007-12-16 22:04 ` Daniel Jacobowitz
2007-12-17 20:06 ` Jim Blandy
2008-01-14 15:55 ` Ulrich Weigand
2008-01-28 21:08 ` Ulrich Weigand
2008-01-28 23:48 ` Daniel Jacobowitz
2008-01-29 19:00 ` Ulrich Weigand [this message]
2008-01-29 3:42 ` Jim Blandy
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=200801291837.m0TIbWsI014278@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=jimb@codesourcery.com \
/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