What does multiple DW_OP_piece mean in DWARF?
Dan Towner
dant@picochip.com
Mon Oct 31 12:43:00 GMT 2011
Hi all,
Could someone tell me whether the following sequence of DWARF information
is correct please, and if it is, how it should be interpreted? GCC emits
something like the following [1]:
.byte 0x75 # DW_OP_breg5
.sleb128 0
.byte 0x93 # DW_OP_piece
.uleb128 0x4
.byte 0x93 # DW_OP_piece
.uleb128 0x4
Is it valid to emit two DW_OP_pieces with no separating location? My copy
of the spec for DWARF (v4 taken from www.dwarfstd.org) seems to suggest
that all pieces must have a location preceeding them. There is also a
comment in dwarf2out.c which says:
"DW_OP_piece is only added if the location description expression already
doesn't end with DW_OP_piece"
so it would seem like two contiguous pieces is wrong, but it seems to
occur so frequently I wonder if it is a correct output after all.
I am working on a symbolic debugger for the Picochip platform, and need to
understand why this sequence is emitted, and what the debugger should do
with it. I can supply test cases if necessary, but hopefully someone may
know if this sequence is intentional or not.
thanks,
dan.
[1] Using `gcc -O1 -dA -S', on versions 4.4.5 and 4.6.2 on x86_64 and
Picochip. There are subtle variations, but the same basic pattern keeps
reappearing.
More information about the Gcc
mailing list