diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-09-16 12:22:04 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-09-16 12:22:04 +0200 |
commit | 86598ebfa13479b4ba3b6b7a9de25c3e497ff57e (patch) | |
tree | cf4db8f202856ad1d9546ab377b88c3379d14951 /dwflpp.cxx | |
parent | e3e5c5563d361c206fba99b98b0f9f8a135089ce (diff) | |
download | systemtap-steved-86598ebfa13479b4ba3b6b7a9de25c3e497ff57e.tar.gz systemtap-steved-86598ebfa13479b4ba3b6b7a9de25c3e497ff57e.tar.xz systemtap-steved-86598ebfa13479b4ba3b6b7a9de25c3e497ff57e.zip |
Clean up dwflpp::translate_location workaround for DW_AT_data_member_location.
Do the same workaround as loc2c-test.c does. Just treat a constant member
location offset as a DW_OP_plus_uconst and call c_translate_location for it.
Also Remove c_translate_add_offset.
* dwflpp.cxx (dwflpp::translate_location): Check elfutils version and only
do workaround for elfutils < 0.142.
* loc2c.h (c_translate_add_offset): Removed.
* loc2c.c (c_translate_add_offset): Likewise.
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r-- | dwflpp.cxx | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -1674,21 +1674,20 @@ dwflpp::translate_location(struct obstack *pool, { /* DW_AT_data_member_location, can be either constant offsets - (struct member fields), or full blown location expressions. */ + (struct member fields), or full blown location expressions. + In older elfutils, dwarf_getlocation_addr would not handle the + constant for us, but newer ones do. For older ones, we work + it by faking an expression, which is what newer ones do. */ +#if !_ELFUTILS_PREREQ (0,142) if (dwarf_whatattr (attr) == DW_AT_data_member_location) { - unsigned int form = dwarf_whatform (attr); - if (form == DW_FORM_data1 || form == DW_FORM_data2 - || form == DW_FORM_sdata || form == DW_FORM_udata) - { - Dwarf_Sword off; - if (dwarf_formsdata (attr, &off) != 0) - throw semantic_error (string ("dwarf_formsdata failed, ") - + string (dwarf_errmsg (-1)), e->tok); - c_translate_add_offset (pool, 1, NULL, off, tail); - return *tail; - } + Dwarf_Op offset_loc = { .atom = DW_OP_plus_uconst }; + if (dwarf_formudata (attr, &offset_loc.number) == 0) + return c_translate_location (pool, &loc2c_error, this, + &loc2c_emit_address, 1, 0, pc, + &offset_loc, 1, NULL, NULL); } +#endif Dwarf_Op *expr; size_t len; |