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: [PATCH] Use target address size for DW_OP_deref in dwarf2expr.c


On Wed, Mar 05 2014, Ulrich Weigand wrote:

> Andreas Arnez wrote:
>
>> For DW_OP_deref, the DWARF standard states: "The size of the data
>> retrieved from the dereferenced address is the size of an address on
>> the target machine."  However, gdb always dereferenced as much as the
>> DWARF address size instead.
>
> But that *is* the target address, as far as DWARF is concerned.
>
> GDB's notion of ctx->addr_size derives from the address_size field
> of the compilation unit header, which is documented in DWARF as:
>
>   A 1-byte unsigned integer representing the size in bytes of
>   an address on the target architecture. [...]
>
> Every other place in the DWARF standard that uses "size of an
> address on the target machine" refers to this field.

Well, section 2.4 "target addresses" states this differently:

    [...] specified by the object file or executable file which contains
    the DWARF information.

But combining these statements, I'm wondering how the case that these
sizes differ is supposed to be interpreted.  It now seems to me that
this isn't actually well defined.  Does this mean that we should revise
the debug-info assembler files in the gdb.dwarf2 test subdirectory?
Almost all of them hard-code the DWARF address size to 4, even for
64-bit target architectures.  Or am I missing something?


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