[RFC PATCH] Typed DWARF stack

Tom Tromey tromey@redhat.com
Wed May 4 20:27:00 GMT 2011


>>>>> "Jakub" == Jakub Jelinek <jakub@redhat.com> writes:

Tom> Should DW_OP_bra be restricted to integral types?  Several other opcodes

Jakub> Yes.  If you want to test other types, just compare them against 0
Jakub> using DW_OP_ne etc.

Great, thanks.

Tom> Currently, the comparison operators are all defined as performing signed
Tom> operations.  So, what should happen in this case:
Tom> 
Tom> DW_OP_lit0
Tom> DW_OP_GNU_convert <unsigned int>
Tom> DW_OP_GNU_const_type <unsigned int> -1
Tom> DW_OP_gt
Tom> 
Tom> That is, should this ignore the type (perhaps just using the type
Tom> width), or is this a bug in the spec?

Jakub> Whenever you have explicit type, use that type for comparisons,
Jakub> including its signedness.

DW_OP_mod also need special treatment.

What my patch does now is that it generally uses a signed integer type
of the appropriate width for "legacy" DWARF values.  Then, for mod, if
the value's type is this special type, it converts it to an
identically-sized unsigned type, and converts back after the operation.

For DW_OP_shr, I always convert the LHS to an appropriately-sized
unsigned type first.

Tom



More information about the Gcc-patches mailing list