summaryrefslogtreecommitdiffstats
path: root/loc2c-test.c
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-09-16 12:18:50 -0400
committerDave Brolley <brolley@redhat.com>2009-09-16 12:18:50 -0400
commit0f4a9cb5967714ace01e0941592040b8c1d83ee7 (patch)
treef97784dbd9392694931c1be99abf7920f6f0484b /loc2c-test.c
parentd83d7b513d38791751e46a05e382b1e6876abefc (diff)
parentd833f810e4ffaf5c9c16eebc7f10b9d14e53e508 (diff)
downloadsystemtap-steved-0f4a9cb5967714ace01e0941592040b8c1d83ee7.tar.gz
systemtap-steved-0f4a9cb5967714ace01e0941592040b8c1d83ee7.tar.xz
systemtap-steved-0f4a9cb5967714ace01e0941592040b8c1d83ee7.zip
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'loc2c-test.c')
-rw-r--r--loc2c-test.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/loc2c-test.c b/loc2c-test.c
index 48691a33..46c45827 100644
--- a/loc2c-test.c
+++ b/loc2c-test.c
@@ -230,34 +230,24 @@ handle_variable (Dwarf_Die *lscopes, int lnscopes, int out,
}
else
{
- /* We are expection a block, constant or loclistptr. */
- unsigned int form = dwarf_whatform (&attr_mem);
- Dwarf_Sword off;
- switch (form)
+ /* We expect a block or a constant. In older elfutils,
+ dwarf_getlocation_addr would not handle the constant for
+ us, but newer ones do. For older ones, we work around
+ it by faking an expression, which is what newer ones do. */
+#if !_ELFUTILS_PREREQ (0,142)
+ Dwarf_Op offset_loc = { .atom = DW_OP_plus_uconst };
+ if (dwarf_formudata (&attr_mem, &offset_loc.number) == 0)
+ c_translate_location (&pool, NULL, NULL, NULL,
+ 1, cubias, pc, &offset_loc, 1,
+ &tail, NULL, NULL);
+ else
+#endif
{
- /* constant */
- case DW_FORM_data1:
- case DW_FORM_data2:
- case DW_FORM_sdata:
- case DW_FORM_udata:
- if (dwarf_formsdata (&attr_mem, &off) != 0)
- error (2, 0, _("Bad offset for %s %s: %s"),
- typetag == DW_TAG_union_type ? "union" : "struct",
- dwarf_diename (die) ?: "<anonymous>",
- dwarf_errmsg (-1));
- if (off != 0)
- c_translate_add_offset (&pool, 1,
- dwarf_diename (die)
- ?: "", off, &tail);
- break;
-
- default:
- locexpr = get_location (cubias, pc, &attr_mem,
- &locexpr_len);
- c_translate_location (&pool, NULL, NULL, NULL,
- 1, cubias, pc, locexpr, locexpr_len,
- &tail, NULL, NULL);
- break;
+ locexpr = get_location (cubias, pc, &attr_mem,
+ &locexpr_len);
+ c_translate_location (&pool, NULL, NULL, NULL,
+ 1, cubias, pc, locexpr, locexpr_len,
+ &tail, NULL, NULL);
}
}
++fields;