summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-08-11 19:52:00 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-08-11 19:52:00 -0400
commit00cf370953d55d0c79a746b4e7d65ce29266afc4 (patch)
treea1fa8dcc18823029ad96bfbcfa62db810d350046
parentd6ef1e94a52b667876293ff3de84097dcbd46f7c (diff)
downloadsystemtap-steved-00cf370953d55d0c79a746b4e7d65ce29266afc4.tar.gz
systemtap-steved-00cf370953d55d0c79a746b4e7d65ce29266afc4.tar.xz
systemtap-steved-00cf370953d55d0c79a746b4e7d65ce29266afc4.zip
let $$vars work even with unsupported c types (e.g., funkytown floats)
-rw-r--r--ChangeLog7
-rw-r--r--tapsets.cxx52
2 files changed, 42 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bcc76ad..8d448e78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
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):
Don't add a \n at the end of $$vars/$$parms/$$locals.
diff --git a/tapsets.cxx b/tapsets.cxx
index 5fbbb053..2f2e53a6 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -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);