diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | elaborate.cxx | 24 | ||||
-rw-r--r-- | elaborate.h | 3 |
3 files changed, 30 insertions, 4 deletions
@@ -1,5 +1,12 @@ 2006-04-25 Frank Ch. Eigler <fche@elastic.org> + * elaborate.cxx (typeresolution_info::unresolved,invalid, + mismatch): Print current function/probe name in error message. + (semantic_pass_types): Pass sufficient information. + * elaborate.h: Corresponding changes. + +2006-04-25 Frank Ch. Eigler <fche@elastic.org> + PR 2427. * staptree.cxx (varuse_collecting_visitor::visit_embeddedcode): Support /* pure */ declaration. Stop using __tvar_ naming hack. diff --git a/elaborate.cxx b/elaborate.cxx index 976becd6..f5b0496b 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1559,6 +1559,7 @@ semantic_pass_types (systemtap_session& s) for (unsigned j=0; j<s.functions.size(); j++) { functiondecl* fn = s.functions[j]; + ti.current_probe = 0; ti.current_function = fn; ti.t = pe_unknown; fn->body->visit (& ti); @@ -1574,6 +1575,7 @@ semantic_pass_types (systemtap_session& s) { derived_probe* pn = s.probes[j]; ti.current_function = 0; + ti.current_probe = pn; ti.t = pe_unknown; pn->body->visit (& ti); } @@ -1601,6 +1603,13 @@ semantic_pass_types (systemtap_session& s) } + +typeresolution_info::typeresolution_info (systemtap_session& s): + session(s), current_function(0), current_probe(0) +{ +} + + void typeresolution_info::visit_literal_number (literal_number* e) { @@ -2423,7 +2432,10 @@ typeresolution_info::unresolved (const token* tok) if (assert_resolvability) { - cerr << "semantic error: unresolved type for "; + string nm = (current_function ? current_function->name : + current_probe ? current_probe->name : + "?"); + cerr << "semantic error: " + nm + " with unresolved type for "; if (tok) cerr << *tok; else @@ -2440,7 +2452,10 @@ typeresolution_info::invalid (const token* tok, exp_type pe) if (assert_resolvability) { - cerr << "semantic error: invalid type " << pe << " for "; + string nm = (current_function ? current_function->name : + current_probe ? current_probe->name : + "?"); + cerr << "semantic error: " + nm + " with invalid type " << pe << " for "; if (tok) cerr << *tok; else @@ -2457,7 +2472,10 @@ typeresolution_info::mismatch (const token* tok, exp_type t1, exp_type t2) if (assert_resolvability) { - cerr << "semantic error: type mismatch for "; + string nm = (current_function ? current_function->name : + current_probe ? current_probe->name : + "?"); + cerr << "semantic error: " + nm + " with type mismatch for "; if (tok) cerr << *tok; else diff --git a/elaborate.h b/elaborate.h index 7317e940..2255037e 100644 --- a/elaborate.h +++ b/elaborate.h @@ -47,12 +47,13 @@ public: struct typeresolution_info: public visitor { - typeresolution_info (systemtap_session& s): session (s) {} + typeresolution_info (systemtap_session& s); systemtap_session& session; unsigned num_newly_resolved; unsigned num_still_unresolved; bool assert_resolvability; functiondecl* current_function; + derived_probe* current_probe; void mismatch (const token* tok, exp_type t1, exp_type t2); void unresolved (const token* tok); |