Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: "Martin M. Hunt" <hunt@redhat.com>
Cc: Mark Kettenis <kettenis@gnu.org>, gdb@sources.redhat.com
Subject: Re: dwarf2-frame.c question for maintainers
Date: Thu, 15 Jul 2004 18:15:00 -0000	[thread overview]
Message-ID: <40F6C5C3.3040302@gnu.org> (raw)
In-Reply-To: <1089912741.3028.14.camel@dragon>

> On Wed, 2004-07-14 at 12:28, Andrew Cagney wrote:
> 
>>>>>> >>> How come extract_typed_address, in read_reg, doesn't sign extend?
>>>
>>>> > 
>>>> > 
>>>> > I should have explained that. It does.  However extract_typed_address is
>>>> > incorrect because it makes the invalid assumption that sizeof(address)
>>>> > == sizeof(register).  So that has to go and be replaced with something
>>>> > like
>>>> > extract_signed_integer (buf, register_size (current_gdbarch, regnum));
>>
>>> 
>>> You mean the builtin_type_void_data_ptr parameter to 
>>> extract_typed_address?  Ah.
>>> 
>>> I see builtin_type_void_data_ptr dates back to 1.1 (Mark?).  It could 
>>> instead use the register's type?
> 
> 
> extract_typed_address calls extract_[un]signed_integer with size =
> TYPE_LENGTH of builtin_type_void_data_ptr.
> 
> Here's exactly what I am seeing.  Maybe you can tell me if read_reg is
> the problem.
> 
> For example big-endian Mips, with o64 or (eabi and mlong32):
> (registers are 64 bits and pointers are 32 bits)
> 
> read_reg calls frame_unwind_register (next_frame, regnum, buf)
> after that, buf has something like ffffffff801fffb8
> 
> Now if you do extract_typed_address(), it knows addresses are 4 bytes
> and returns 0xffffffff sign extended to 0xfffffffffffffff

Right, as it stands, that call is just wrong.

> If instead, you call extract_[un]signed_integer((buf, register_size
> (current_gdbarch, regnum)), it returns 0xffffffff801fffb8
> 
> The real problem here is the the size.  AFAICT, sign-extension here is
> unimportant; I get the same test results calling 
> extract_unsigned_integer in read_reg() for mips, because, as you can
> see, nothing needs extending, just the whole register needs read.
> However, I can't prove that is always the case because I am not familiar
> enough with the code.

Consider o32.  Both the ABI and ISA are 32-bits, but GDB's CORE_ADDR may 
be 64-bits.  Even if it doesn't appear to make a difference, the MIPS 
needs to always sign extend addresses/registers - that's the dogma :-)

Andrew



  reply	other threads:[~2004-07-15 17:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-13 22:01 Martin M. Hunt
2004-07-14 17:29 ` Andrew Cagney
2004-07-14 17:56   ` Martin M. Hunt
2004-07-14 19:38     ` Andrew Cagney
2004-07-15 17:32       ` Mark Kettenis
2004-07-15 17:40       ` Martin M. Hunt
2004-07-15 18:15         ` Andrew Cagney [this message]
2004-07-15 18:35           ` Martin M. Hunt
2004-07-15 18:45             ` Andrew Cagney
2004-07-15 18:54               ` Martin M. Hunt
2004-07-16 21:16                 ` 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=40F6C5C3.3040302@gnu.org \
    --to=cagney@gnu.org \
    --cc=gdb@sources.redhat.com \
    --cc=hunt@redhat.com \
    --cc=kettenis@gnu.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