> >> <n> DW_OP_byte_swap > >> > >> The DW_OP_byte_swap operation pops the top stack entry, > >> byte swaps the value > >> and pushes back the swapped value on the dwarf stack. > >> e.g. so 0x12345678 will become 0x78563412, useful to > >> change endianity of raw > >> data.
While I can see the potential usefulness of a byte-swap operator, it's not clear to me that it's the right approach for Chirag's case. In his example, the __gbloffset__ variable has a DW_AT_type which is explicitly given a DW_AT_endianity attribute. A DWARF consumer would be expected to pay attention to the byte order when presenting the value of that variable, but the DW_OP_call4 pushes just the address of the variable as a value of "generic" type, and DW_OP_deref will dereference it without knowing its type. What we're missing is an operator to attach a type to the current value on top of the stack; if we had that, we could do (DW_OP_call4, DW_OP_attach_type, DW_OP_deref) and expect the DWARF consumer to honor the byte order and do a byte swap implicitly when executing the DW_OP_deref. Or, we could specify that DW_OP_call* should not only push the result of evaluating the DW_AT_location of the target DIE, but also attach the DW_AT_type of the target DIE to that value. Or, we could add DW_OP_call*_type operators, and leave the original DW_OP_call* operators to deal with values of generic type only. -cary _______________________________________________ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org