From d9b516ca844622e6c59c77e702c842e3e4db8c63 Mon Sep 17 00:00:00 2001 From: roland Date: Thu, 18 Aug 2005 02:46:10 +0000 Subject: 2005-08-17 Roland McGrath * 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. --- loc2c-test.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'loc2c-test.c') 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); -- cgit