diff options
author | roland <roland> | 2005-08-18 02:46:22 +0000 |
---|---|---|
committer | roland <roland> | 2005-08-18 02:46:22 +0000 |
commit | 377b204ca14fbe0aa052ab28f9a5233181fc11fc (patch) | |
tree | 96b92817a44fffb4ac7ccdd11ddd3b43fe25c7ce /loc2c.c | |
parent | d50f5149161d1e80553e09a75aa441961dd9359c (diff) | |
download | systemtap-steved-377b204ca14fbe0aa052ab28f9a5233181fc11fc.tar.gz systemtap-steved-377b204ca14fbe0aa052ab28f9a5233181fc11fc.tar.xz systemtap-steved-377b204ca14fbe0aa052ab28f9a5233181fc11fc.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.
* 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".
Diffstat (limited to 'loc2c.c')
-rw-r--r-- | loc2c.c | 25 |
1 files changed, 11 insertions, 14 deletions
@@ -8,6 +8,7 @@ #include <dwarf.h> #include <elfutils/libdw.h> #include <assert.h> +#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); |