Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb@sources.redhat.com, Jim Blandy <jimb@redhat.com>,
	Kevin Buettner <kevinb@redhat.com>
Subject: Re: DWARF-2 and address sizes
Date: Fri, 31 Jan 2003 22:36:00 -0000	[thread overview]
Message-ID: <20030131223639.GA3585@nevyn.them.org> (raw)
In-Reply-To: <3E3AF1DC.3040706@redhat.com>

On Fri, Jan 31, 2003 at 04:59:56PM -0500, Andrew Cagney wrote:
> >[Kevin, I noticed you doing some work in this area re S/390, maybe you've
> >got a comment?  Anyone else?  I'm grasping at straws.]
> >
> >I'm trying to figure out how to handle addresses in the DWARF expression
> >evaluator.  First consider DW_OP_deref: the following data is "the size of
> >an address on the target machine", which I would personally take to mean
> >cu_header->addr_size.  Is this ever different from TARGET_ADDRESS_BIT /
> >TARGET_CHAR_BIT, which is what Daniel was originally using?
> 
> I can imagine architectures wack-o enough for cu_header->addr_size != 
> TARGET_ADDRESS_BIT / TARGET_CHAR_BIT.  Someone doing a 16 bit port using 
> 32 bit elf.

I wonder if MIPS64 Linux kernels do this, since they're technically
ELF32?  Hmm, probably not.

GCC defines the address size as a constant (4) on ip2k and stormy16,
and in terms of pointer size elsewhere.  I don't know any platform
where objects with different pointer sizes can be linked together, and
it seems dubiously useful at best.

I'm willing to document this as an assertion, store the dwarf2 address
size and signedness somewhere global, and bail if I detect a violation. 
But I'll skip that for now; it can be a later cleanup.  I've already
got too many pieces in this patch.

> But I don't think you'll encounter a case where cu_header->addr_size 
> isn't locally consistent with the rest of the file.
> 
> > Do we have to
> >worry about a binary in which different compilation units (or different
> >shared objects, even) have a different value for this?
> 
> See if binutils allows it.  If not ...

Binutils, sadly, doesn't care.  It only uses the address size within a
compilation unit.

> 
> >If the consensus is "no, that's too stupid to be allowed to live", then 
> >this
> >gets much easier.
> >
> >(Then consider DW_OP_deref_size; this is a fun one, since it has to be
> >zero-extended to the size of an address on the target machine according to
> >the spec, and then in GDB it may have to be zero or sign extended to the
> >size of a CORE_ADDR for storage.  I haven't tested any of this on MIPS yet
> >and I don't want to, damn it.  I don't know of any MIPS ABI with multiple
> >pointer sizes, and you can't link different ABIs, so encountering
> >DW_OP_deref_size is probably impossible.  I hope.)
> 
> Have a look at dwarf2read.c:read_address() the existing code already 
> handles one case of this.

Yes.  I don't know if it sign extends properly in all cases - I guess
it does if signed_address_p always matches whether a CORE_ADDR is a
signed type, but that's dubious.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2003-01-31 22:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-31 21:29 Daniel Jacobowitz
2003-01-31 22:00 ` Andrew Cagney
2003-01-31 22:36   ` Daniel Jacobowitz [this message]
2003-02-01  6:20     ` Daniel Berlin
2003-02-01 17:01       ` Daniel Jacobowitz
2003-02-04  2:26         ` Jim Blandy
2003-02-01  7:29     ` Andrew Cagney

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=20030131223639.GA3585@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=ac131313@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=jimb@redhat.com \
    --cc=kevinb@redhat.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