]> sourceware.org Git - systemtap.git/commitdiff
let $$vars work even with unsupported c types (e.g., funkytown floats)
authorFrank Ch. Eigler <fche@elastic.org>
Mon, 11 Aug 2008 23:52:00 +0000 (19:52 -0400)
committerFrank Ch. Eigler <fche@elastic.org>
Mon, 11 Aug 2008 23:52:00 +0000 (19:52 -0400)
ChangeLog
tapsets.cxx

index 3bcc76adc0e73e6c32eab31fd4266d85824632eb..8d448e78e4074e5b6d3833e4f87d726ae2756382 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-11  Frank Ch. Eigler  <fche@elastic.org>
+
+       * tapsets.cxx (translate_final_fetch_or_store): Reject some
+       unhandleable types such as floats.
+       (dwarf_var...visit_target_symbol): Tweak logic of $$var expansion
+       to quietly skip over any $context variables that cause exceptions.
+
 2008-08-11  Frank Ch. Eigler  <fche@elastic.org>
 
        * tapsets.cxx (dwarf_var_expanding...visit_target_symbol):
index 5fbbb0538b2eed70bf320773055e803d15030e71..2f2e53a6211bd0190df517d461bf4a71b0a8d11e 100644 (file)
@@ -1987,6 +1987,33 @@ struct dwflpp
 
       case DW_TAG_enumeration_type:
       case DW_TAG_base_type:
+
+        // Reject types we can't handle in systemtap
+        {
+          dname = dwarf_diename(die);
+          diestr = (dname != NULL) ? dname : "<unknown>";
+
+          Dwarf_Attribute encoding_attr;
+          Dwarf_Word encoding = -1;
+          dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, &encoding_attr),
+                           & encoding);
+          if (encoding < 0)
+            {
+              // clog << "bad type1 " << encoding << " diestr" << endl;
+              throw semantic_error ("unsupported type (mystery encoding " + lex_cast<string>(encoding) + ")" +
+                                    " for " + diestr);
+            }
+
+          if (encoding == DW_ATE_float
+              || encoding == DW_ATE_complex_float
+              /* XXX || many others? */)
+            {
+              // clog << "bad type " << encoding << " diestr" << endl;
+              throw semantic_error ("unsupported type (encoding " + lex_cast<string>(encoding) + ")" +
+                                    " for " + diestr);
+            }
+        }
+
        ty = pe_long;
        if (lvalue)
          c_translate_store (pool, 1, module_bias, die, typedie, tail,
@@ -2125,7 +2152,6 @@ struct dwflpp
       throw semantic_error("failed to retrieve type "
                           "attribute for local '" + local + "'");
 
-
     /* Translate the ->bar->baz[NN] parts. */
 
     Dwarf_Die die_mem, *die = NULL;
@@ -4358,24 +4384,16 @@ dwarf_var_expanding_copy_visitor::visit_target_symbol (target_symbol *e)
            tsym->tok = sym_tok;
            tsym->base_name = "$";
            tsym->base_name += diename;
-           Dwarf_Attribute attr_mem;
 
            // Ignore any variable that isn't accessible.
-           // dwarf_attr_integrate is checked by literal_stmt_for_local
-           // dwarf_getlocation_addr is checked by translate_location
-           // but if those fail we cannot catch semantic_error.
-           if (dwarf_attr_integrate (&result, DW_AT_location, &attr_mem) != NULL)
-             {
-               Dwarf_Op *expr;
-               size_t len;
-               if (dwarf_getlocation_addr (&attr_mem, addr - q.dw.module_bias,
-                                           &expr, &len, 1) == 0)
-                 continue;
-               this->visit_target_symbol(tsym);
-               pf->raw_components += diename;
-               pf->raw_components += "=%#x ";
-               pf->args.push_back(*(expression**)this->targets.top());
-             }
+            tsym->saved_conversion_error = 0;
+            this->visit_target_symbol(tsym); // NB: throws nothing ...
+            if (! tsym->saved_conversion_error) // ... but this is how we know it happened.
+              {
+                pf->raw_components += diename;
+                pf->raw_components += "=%#x ";
+                pf->args.push_back(*(expression**)this->targets.top());
+              }
          }
        while (dwarf_siblingof (&result, &result) == 0);
 
This page took 0.047222 seconds and 5 git commands to generate.