This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] dwarf2_read_address(): sign extend as appropriate


On Mon, 23 Apr 2007 12:56:46 -0400
Daniel Jacobowitz <drow@false.org> wrote:

> On Mon, Apr 23, 2007 at 09:49:00AM -0700, Kevin Buettner wrote:
> > We can't use address_from_register() in this instance since
> > dwarf2_read_address() is not fetching an address from a register, but
> > rather from some DWARF2 info.
> 
> How about value_as_address?  I don't like the need for another call
> site for gdbarch_integer_to_address; it's historically tricky...

dwarf2_read_address() isn't reading an address from some value in the
inferior, but rather is decoding some sequence of bytes as an address
in the DWARF2 info.  As such, dwarf2_read_address() doesn't have
anything readily available to pass to value_as_address().  That means
that a suitable value would have to be constructed and then immediately
decomposed, leading to an expression which might look something like this:

    result = value_as_address (value_from_longest 
		                (unsigned_address_type (),
                                 extract_unsigned_integer 
				   (buf,
		                    TARGET_ADDR_BIT / TARGET_CHAR_BIT)));

Please let me know if this is what you had in mind.  If so, I'll
try it out and post the results.

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]