[Dwarf-Discuss] DWARF on systems where memory is not byte addressable

Robinson, Paul Paul.Robinson@am.sony.com
Thu Jul 26 21:25:23 GMT 2012

Joeri van Ruth wrote:
> However, I assume that if the DWARF standard were explicit about the
> size of a byte, it would define a byte to be 8 bits.

As Michael said, if DWARF were to say anything more than it does, it 
should be in terms of memory-addressable units; although finding specific 
wording that is unambiguous for all the funky architectures in the world
would be something of a trick.

> If we set the DW_AT_byte_size of an integer to 1, gdb will do the
> address arithmetic correctly, that is, look for int_array[1] at
> address int_array + 1, not + 4, but if you ask for the value of an int
> variable it will only display the lower 8 bits.

Truncating the value is a GDB bug.  You could try specifying bit_size=32
as well as byte_size=1, and see what happens. No promises.

Do you store one char per word, or multiple chars per word?
If it's one char per word, then bit_size=8 should be reasonable.
If it's multiple chars per word, then "char*" has to be more than a
simple address, and you'll have to define a new address class
(DW_ADDR_xxxxx) and teach the debugger how to interpret
values with that address class.


More information about the Dwarf-discuss mailing list