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

Daniel Jacobowitz
2007-04-24T18:13:13Z

On Mon, Apr 23, 2007 at 02:06:42PM -0700, Kevin Buettner wrote:
> 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.

That is what I had in mind - we have an interface for doing arithmetic
with target values, but there's all sorts of places we do not use it.
But if you're justifiably offended by the inefficiency, let's not do
it now. Your original patch is fine with me.

(If you fix the formatting issues "struct type *" shouldn't be
followed by a space, "unsigned_address_type()" should have one.)

--
Daniel Jacobowitz
CodeSourcery