diff options
-rw-r--r-- | loc2c-test.c | 28 | ||||
-rw-r--r-- | loc2c.c | 2 | ||||
-rw-r--r-- | loc2c.h | 2 |
3 files changed, 24 insertions, 8 deletions
diff --git a/loc2c-test.c b/loc2c-test.c index 26734096..ed4769ec 100644 --- a/loc2c-test.c +++ b/loc2c-test.c @@ -222,13 +222,29 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out, 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")); + switch (typetag) + { + case DW_TAG_base_type: + if (store) + c_translate_store (&pool, 1, cubias, die, typedie, &tail, "value"); + else + c_translate_fetch (&pool, 1, cubias, die, typedie, &tail, "value"); + break; - if (store) - c_translate_store (&pool, 1, cubias, die, typedie, &tail, "value"); - else - c_translate_fetch (&pool, 1, cubias, die, typedie, &tail, "value"); + case DW_TAG_pointer_type: + if (store) + error (2, 0, _("store not supported for pointer type")); + c_translate_pointer (&pool, 1, cubias, typedie, &tail); + c_translate_addressof (&pool, 1, cubias, die, typedie, &tail, "value"); + break; + + default: + if (store) + error (2, 0, _("store supported only for base type")); + else + error (2, 0, _("fetch supported only for base type or pointer")); + break; + } printf ("#define PROBEADDR %#" PRIx64 "ULL\n", pc); @@ -1284,7 +1284,7 @@ void c_translate_addressof (struct obstack *pool, int indent, Dwarf_Addr dwbias __attribute__ ((unused)), Dwarf_Die *die, - Dwarf_Attribute *typeattr __attribute__ ((unused)), + Dwarf_Die *typedie __attribute__ ((unused)), struct location **input, const char *target) { ++indent; @@ -54,7 +54,7 @@ void c_translate_array (struct obstack *pool, int indent, is a register or noncontiguous object. */ void c_translate_addressof (struct obstack *pool, int indent, Dwarf_Addr dwbias, Dwarf_Die *die, - Dwarf_Attribute *typeattr, + Dwarf_Die *typedie, struct location **input, const char *target); /* Translate a fragment to fetch the value of variable or member DIE |