summaryrefslogtreecommitdiffstats
path: root/loc2c-test.c
diff options
context:
space:
mode:
authorroland <roland>2005-08-18 02:46:10 +0000
committerroland <roland>2005-08-18 02:46:10 +0000
commitd9b516ca844622e6c59c77e702c842e3e4db8c63 (patch)
tree98fcbde5c829cbd0e4dc17a4d470d79749dcab7f /loc2c-test.c
parente97bcaa1e868db40b90d63a9ff58295c98b3abb2 (diff)
downloadsystemtap-steved-d9b516ca844622e6c59c77e702c842e3e4db8c63.tar.gz
systemtap-steved-d9b516ca844622e6c59c77e702c842e3e4db8c63.tar.xz
systemtap-steved-d9b516ca844622e6c59c77e702c842e3e4db8c63.zip
2005-08-17 Roland McGrath <roland@redhat.com>
* loc2c.c (c_translate_fetch): Take TYPEDIE instead of TYPEATTR. (c_translate_store): Likewise. * loc2c.h: Update decls. * loc2c-test.c (handle_variable): Update callers. Look up type, resolve typedefs, and check that it's DW_TAG_base_type. * tapsets.cxx (dwflpp::literal_stmt_for_local): Likewise.
Diffstat (limited to 'loc2c-test.c')
-rw-r--r--loc2c-test.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/loc2c-test.c b/loc2c-test.c
index 5edcd149..05f51c25 100644
--- a/loc2c-test.c
+++ b/loc2c-test.c
@@ -188,10 +188,31 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out,
error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1));
}
+ /* Fetch the type DIE corresponding to the final location to be accessed.
+ It must be a base type or a typedef for one. */
+
+ Dwarf_Die typedie_mem;
+ Dwarf_Die *typedie;
+ int typetag;
+ while (1)
+ {
+ typedie = dwarf_formref_die (&attr_mem, &typedie_mem);
+ if (typedie == NULL)
+ error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1));
+ typetag = dwarf_tag (typedie);
+ if (typetag != DW_TAG_typedef)
+ break;
+ if (dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem) == NULL)
+ error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1));
+ }
+
+ if (typetag != DW_TAG_base_type)
+ error (2, 0, _("fetch or store supported only for base type"));
+
if (store)
- c_translate_store (&pool, 1, cubias, die, &attr_mem, &tail, "value");
+ c_translate_store (&pool, 1, cubias, die, typedie, &tail, "value");
else
- c_translate_fetch (&pool, 1, cubias, die, &attr_mem, &tail, "value");
+ c_translate_fetch (&pool, 1, cubias, die, typedie, &tail, "value");
printf ("#define PROBEADDR %#" PRIx64 "ULL\n", pc);