]> sourceware.org Git - systemtap.git/commitdiff
2005-08-17 Roland McGrath <roland@redhat.com>
authorroland <roland>
Thu, 18 Aug 2005 02:46:22 +0000 (02:46 +0000)
committerroland <roland>
Thu, 18 Aug 2005 02:46:22 +0000 (02:46 +0000)
* 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".

loc2c.c

diff --git a/loc2c.c b/loc2c.c
index 0b79c672f0d141aebf46b8a67fd6d42a022c0bb7..353b11acf4571fbd95c0b125dd3346d3a43d4417 100644 (file)
--- a/loc2c.c
+++ b/loc2c.c
@@ -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);
This page took 0.027609 seconds and 5 git commands to generate.