diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-08-11 19:52:00 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-08-11 19:52:21 -0400 |
commit | ac4229f1050ee69b3ebfe57e6f7fcee08aaeceec (patch) | |
tree | 7405cfd5a867acea03d5d7a74958978060c48ff2 | |
parent | addec0c02cb433c727f46d8ea78379d62051309c (diff) | |
download | systemtap-steved-ac4229f1050ee69b3ebfe57e6f7fcee08aaeceec.tar.gz systemtap-steved-ac4229f1050ee69b3ebfe57e6f7fcee08aaeceec.tar.xz systemtap-steved-ac4229f1050ee69b3ebfe57e6f7fcee08aaeceec.zip |
let $$vars work even with unsupported c types (e.g., funkytown floats)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | tapsets.cxx | 52 |
2 files changed, 42 insertions, 17 deletions
@@ -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 73a104b4..b35bc338 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2060,6 +2060,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, @@ -2198,7 +2225,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; @@ -4309,24 +4335,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); |