interface to partial support for DW_OP_piece in dwarf2expr.[ch]
Jim Blandy <jimb <at> redhat.com>
2004-08-03 07:13:30 GMT
Full support for the Dwarf DW_OP_piece operator in location
expressions would require major work on 'struct value' and its users.
But in many cases, compilers use DW_OP_piece in a restricted way, such
that all the multi-piece locations actually generated could be
expressed using the 'struct symbol' and 'struct value' we have today.
For example, on the PowerPC E500, the 32-bit upper and lower halves of
the 64-bit gprs have separate register numbers in Dwarf information,
but GDB has (pseudo-)registers that refer to the entire 64 bits. So a
Dwarf 3 location expression that places one piece in an upper-half
register and another piece in the corresponding lower-half register
could be represented by a 'struct value' V where VALUE_LVAL (V) ==
lval_register and VALUE_REGNO (V) is the pseudo-register number.
Recognizing these cases requires calling out to architecture-specific
code. When an patch implementing this was first posted, there was
general agreement that dwarf2expr.[ch] ought not call architecture
methods directly, as it did in the patch, but should instead return
the list of pieces; and that dwarf2expr.[ch]'s callers (specifically,
the code in dwarf2loc.c) should take care of whatever wrangling was
needed to turn that list of pieces into the right 'struct value',
architecture-specific or otherwise. That thread starts here:
http://sources.redhat.com/ml/gdb-patches/2003-05/msg00425.html
Here's a sketch of how we might extend the Dwarf expression evaluation
interface to return piece lists, meant to implement the suggestions in
that thread. If this looks reasonable, then I'll do some more work
and post it for further review.
(Continue reading)