public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [rfa] frame address size incorrect if address size != ptr size
Date: Thu, 05 Aug 2010 14:30:00 -0000	[thread overview]
Message-ID: <20100805143039.GF4610@calimero.vinschen.de> (raw)
In-Reply-To: <201008051407.o75E7jDO011061@d12av02.megacenter.de.ibm.com>

On Aug  5 16:07, Ulrich Weigand wrote:
> Corinna Vinschen wrote:
> > [...]
> > If not, I would prefer a solution like this:
> > 
> >   - If version > 4, use addr_size from .debug_frame section
> >   - Otherwise, if we can fetch the target address size from the CU
> >     header, use it.
> >   - Otherwise, if the target defined gdbarch_dwarf2_addr_size, use it.
> >   - Otherwise, default to gdbarch_addr_bit for .debug_frame sections
> >     and to gdbarch_ptr_bit for .eh_frame sections.
> 
> As I said, finding the .debug_info may be difficult.  Also, I'd really
> avoid getting another dependency on gdbarch_addr_bit in there; the point
> of having a new callback is exactly to avoid overloading addr_bit with
> more and more (possibly) different meanings.
> 
> I'd rather just have gdbarch_dwarf2_addr_size default unconditionally
> to gdbarch_ptr_bit.  In dwarf2-frame we'd then simply use the embedded
> addr_size if version >= 4, and gdbarch_dwarf2_addr_size otherwise.
> Platforms where ptr_bit is not appropriate simply need to define
> gdbarch_dwarf2_addr_size -- since this list is very short, and defining
> gdbarch_dwarf2_addr_size correctly is very simple (you just need to look
> at the definition of DWARF2_ADDR_SIZE in the corresponding GCC back-end),
> that doesn't seem like an unreasonable restriction to me ...
> 
> > > As a side note, it seems odd that add_size is set in those two
> > > different locations here.  The first one is always overwritten
> > > by the second one anyway, isn't it?
> > 
> > There's an early return statement after checking the version number.
> > That indicates a failure anyway, so it might be ok to set addr_size
> > only once, at the second spot (lines 1779ff).
> 
> Yes, that sounds right to me.

Ok, I agree with all you say above.

I'm going to create a patch which defines and uses a new
gdbarch_dwarf2_addr_size function.  It will be defined as a variable
like this in gdbarch.sh:

  v:int:dwarf2_addr_size:::sizeof (void*):0:gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT:

Given that, and also given that I will remove the redundant setting of
cie->addr_size in decode_frame_entry_1, I have one question left.

What about that comment in decode_frame_entry_1?

If we only use either the V4 addr_size, or the gdbarch_dwarf2_addr_size
function, then the comment really doesn't make much sense anymore in that
spot.  I'm wondering if it should be moved to the gdbarch.sh file.  What
do you think?


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

  reply	other threads:[~2010-08-05 14:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-26 14:53 Corinna Vinschen
2010-08-04 11:35 ` Corinna Vinschen
2010-08-04 22:40   ` Jan Kratochvil
2010-08-05  8:06     ` Corinna Vinschen
2010-08-05 10:04       ` Ulrich Weigand
2010-08-05 12:30         ` Corinna Vinschen
2010-08-05 14:08           ` Ulrich Weigand
2010-08-05 14:30             ` Corinna Vinschen [this message]
2010-08-05 14:59               ` Ulrich Weigand
2010-08-05 15:30                 ` Corinna Vinschen
2010-08-05 16:52                   ` Ulrich Weigand
2010-08-06 10:48                     ` Corinna Vinschen
2010-08-06 11:17                       ` Mark Kettenis
2010-08-06 12:01                         ` Corinna Vinschen
2010-08-06 14:51                       ` Ulrich Weigand
2010-08-06 15:57                         ` Corinna Vinschen
2010-08-06 16:27                           ` Ulrich Weigand
2010-08-06 16:59                             ` Corinna Vinschen
2010-08-06 19:03                               ` Corinna Vinschen
2010-08-08 14:55                                 ` Ulrich Weigand

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=20100805143039.GF4610@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).