From: roland Date: Thu, 18 Aug 2005 02:46:22 +0000 (+0000) Subject: 2005-08-17 Roland McGrath X-Git-Tag: release-0.3~65 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=377b204ca14fbe0aa052ab28f9a5233181fc11fc;p=systemtap.git 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.c (base_byte_size): Add assert on expected DIE tag. (c_translate_array, c_translate_pointer): Likewise. * loc2c.h: Amend comments to explicitly state type DIE tags expected. * loc2c.c: #include "loc2c.h". --- diff --git a/loc2c.c b/loc2c.c index 0b79c672f..353b11acf 100644 --- a/loc2c.c +++ b/loc2c.c @@ -8,6 +8,7 @@ #include #include #include +#include "loc2c.h" #define _(x) x @@ -1049,6 +1050,8 @@ c_translate_pointer (struct obstack *pool, int indent, Dwarf_Addr dwbias __attribute__ ((unused)), Dwarf_Die *typedie, struct location **input) { + assert (dwarf_tag (typedie) == DW_TAG_pointer_type); + ++indent; obstack_printf (pool, "%*s{ ", (indent + 2) * 2, ""); @@ -1080,6 +1083,8 @@ c_translate_pointer (struct obstack *pool, int indent, static Dwarf_Word base_byte_size (Dwarf_Die *typedie) { + assert (dwarf_tag (typedie) == DW_TAG_base_type); + Dwarf_Attribute attr_mem; Dwarf_Word size; if (dwarf_attr_integrate (typedie, DW_AT_byte_size, &attr_mem) != NULL @@ -1144,7 +1149,7 @@ emit_bitfield (struct obstack *pool, int indent, void c_translate_fetch (struct obstack *pool, int indent, Dwarf_Addr dwbias __attribute__ ((unused)), - Dwarf_Die *die, Dwarf_Attribute *typeattr, + Dwarf_Die *die, Dwarf_Die *typedie, struct location **input, const char *target) { ++indent; @@ -1153,12 +1158,7 @@ c_translate_fetch (struct obstack *pool, int indent, Dwarf_Word byte_size; if (dwarf_attr_integrate (die, DW_AT_byte_size, &size_attr) == NULL || dwarf_formudata (&size_attr, &byte_size) != 0) - { - Dwarf_Die basedie; - if (dwarf_formref_die (typeattr, &basedie) == NULL) - error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1)); - byte_size = base_byte_size (&basedie); - } + byte_size = base_byte_size (typedie); bool deref = false; if (dwarf_hasattr_integrate (die, DW_AT_bit_offset)) @@ -1195,7 +1195,7 @@ c_translate_fetch (struct obstack *pool, int indent, void c_translate_store (struct obstack *pool, int indent, Dwarf_Addr dwbias __attribute__ ((unused)), - Dwarf_Die *die, Dwarf_Attribute *typeattr, + Dwarf_Die *die, Dwarf_Die *typedie, struct location **input, const char *rvalue) { ++indent; @@ -1204,12 +1204,7 @@ c_translate_store (struct obstack *pool, int indent, Dwarf_Word byte_size; if (dwarf_attr_integrate (die, DW_AT_byte_size, &size_attr) == NULL || dwarf_formudata (&size_attr, &byte_size) != 0) - { - Dwarf_Die basedie; - if (dwarf_formref_die (typeattr, &basedie) == NULL) - error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1)); - byte_size = base_byte_size (&basedie); - } + byte_size = base_byte_size (typedie); bool deref = false; if (dwarf_hasattr_integrate (die, DW_AT_bit_offset)) @@ -1317,6 +1312,8 @@ c_translate_array (struct obstack *pool, int indent, Dwarf_Die *typedie, struct location **input, const char *idx, Dwarf_Word const_idx) { + assert (dwarf_tag (typedie) == DW_TAG_array_type); + ++indent; Dwarf_Word stride = array_stride (typedie);