This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use target address size for DW_OP_deref in dwarf2expr.c
- From: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>
- To: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- Cc: gdb-patches at sourceware dot org, krebbel at linux dot vnet dot ibm dot com (Andreas Krebbel)
- Date: Thu, 06 Mar 2014 11:28:09 +0100
- Subject: Re: [PATCH] Use target address size for DW_OP_deref in dwarf2expr.c
- Authentication-results: sourceware.org; auth=none
- References: <201403052215 dot s25MF27v022445 at d06av02 dot portsmouth dot uk dot ibm dot com>
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?