From bdef2583fcf7270a613cc992772bc1a36f98cabb Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 25 Apr 2006 17:58:28 +0000 Subject: 2006-04-25 Frank Ch. Eigler * 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. --- ChangeLog | 7 +++++++ elaborate.cxx | 24 +++++++++++++++++++++--- elaborate.h | 3 ++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 542c5311..d0af1329 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-04-25 Frank Ch. Eigler + + * 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 PR 2427. 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; jbody->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); -- cgit