diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-09-26 15:23:10 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-09-26 15:23:10 -0400 |
commit | b487a14d6d160f38dd1dbabe305b373b37972074 (patch) | |
tree | 78875ffa9728682b00f0f35f50e36199c66b644c | |
parent | 80b4ad8b10c4a27d50bc420e44e77961c9638daf (diff) | |
download | systemtap-steved-b487a14d6d160f38dd1dbabe305b373b37972074.tar.gz systemtap-steved-b487a14d6d160f38dd1dbabe305b373b37972074.tar.xz systemtap-steved-b487a14d6d160f38dd1dbabe305b373b37972074.zip |
PR6916: fix STRUCT1 ($var alternatives error message syntax) regression
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | elaborate.cxx | 43 | ||||
-rw-r--r-- | tapsets.cxx | 8 | ||||
-rw-r--r-- | testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | testsuite/systemtap.base/alternatives.exp | 9 |
5 files changed, 53 insertions, 20 deletions
@@ -1,5 +1,13 @@ 2008-09-26 Frank Ch. Eigler <fche@elastic.org> + PR 6916 + * elaborate.cxx (systemtap_session::print_error): Fix + duplicate elimination in face of token compression. + * tapsets.cxx (literal_stmt_for_local, literal_stmt_for_return): + Change error message to fit old pattern. + +2008-09-26 Frank Ch. Eigler <fche@elastic.org> + BZ 6829: avoid calling unregister_uprobe() when responding to a task-finder exec/exit callback, as uprobes likes to clean such things up by itself. diff --git a/elaborate.cxx b/elaborate.cxx index b476948b..94bfd1c5 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1424,26 +1424,43 @@ systemtap_session::print_token (ostream& o, const token* tok) void systemtap_session::print_error (const semantic_error& e) { - string message_str; - stringstream message; + string message_str[2]; // NB: we don't print error messages during listing mode. if (listing_mode) return; - message << "semantic error: " << e.what (); - if (e.tok1 || e.tok2) - message << ": "; - if (e.tok1) print_token (message, e.tok1); - message << e.msg2; - if (e.tok2) print_token (message, e.tok2); - message << endl; - message_str = message.str(); + // We generate two messages. The second one ([1]) is printed + // without token compression, for purposes of duplicate elimination. + // This way, the same message that may be generated once with a + // compressed and once with an uncompressed token still only gets + // printed once. + for (int i=0; i<2; i++) + { + stringstream message; + + message << "semantic error: " << e.what (); + if (e.tok1 || e.tok2) + message << ": "; + if (e.tok1) + { + if (i == 0) print_token (message, e.tok1); + else message << *e.tok1; + } + message << e.msg2; + if (e.tok2) + { + if (i == 0) print_token (message, e.tok2); + else message << *e.tok2; + } + message << endl; + message_str[i] = message.str(); + } // Duplicate elimination - if (seen_errors.find (message_str) == seen_errors.end()) + if (seen_errors.find (message_str[1]) == seen_errors.end()) { - seen_errors.insert (message_str); - cerr << message_str; + seen_errors.insert (message_str[1]); + cerr << message_str[0]; } if (e.chain) diff --git a/tapsets.cxx b/tapsets.cxx index ab8f6c94..b1475997 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2242,7 +2242,9 @@ struct dwflpp die = dwarf_formref_die (&attr_mem, &vardie); stringstream alternatives; print_members(die,alternatives); - throw semantic_error("Translation failure : \n ALTERNATIVES [ " + alternatives.str() + " ] \n"); + throw semantic_error("unable to find local '" + local + "'" + + " near pc " + lex_cast_hex<string>(pc) + + (alternatives.str() == "" ? "" : (" (alternatives:" + alternatives.str () + ")"))); } /* Translate the assignment part, either @@ -2316,7 +2318,9 @@ struct dwflpp die = dwarf_formref_die (&attr_mem, vardie); stringstream alternatives; print_members(die,alternatives); - throw semantic_error("Translation failure : \n ALTERNATIVES [ " + alternatives.str() + " ] \n"); + throw semantic_error("unable to find return value" + " near pc " + lex_cast_hex<string>(pc) + + (alternatives.str() == "" ? "" : (" (alternatives:" + alternatives.str () + ")"))); } diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 234ff66d..f3fad077 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-09-26 Frank Ch. Eigler <fche@elastic.org> + + PR 6916. + * systemtap.base/alternatives.exp: Assert error counts. + 2008-09-15 Mark Wielaard <mjw@redhat.com> * buildok/seventeen.stp: Fix 2.6.27 detection. diff --git a/testsuite/systemtap.base/alternatives.exp b/testsuite/systemtap.base/alternatives.exp index 673f3426..deaf3bf8 100644 --- a/testsuite/systemtap.base/alternatives.exp +++ b/testsuite/systemtap.base/alternatives.exp @@ -26,11 +26,10 @@ proc stap_run_alternatives {args} { verbose -log "starting $args" eval spawn $args expect { - -re {semantic error: .+ \(alternatives: [a-zA-Z_]} - { set alternatives_found 1 } + -re {semantic error: .+ \(alternatives: [a-zA-Z_]} {incr alternatives_found; exp_continue} -re {[^\r]*\r} { verbose -log $expect_out(0,string); exp_continue } eof { } - timeout { exp_continue } + timeout { } } set results [wait] verbose -log "wait results: $results" @@ -39,8 +38,8 @@ proc stap_run_alternatives {args} { set test "LOCAL1" set rc [stap_run_alternatives stap -vu -p2 -e $local1_script] -if {$rc == 1} { pass $test } else { fail $test } +if {$rc == 1} { pass $test } else { fail "$test ($rc)" } set test "STRUCT1" set rc [stap_run_alternatives stap -vu -p2 -e $struct1_script] -if {$rc == 1} { pass $test } else { fail $test } +if {$rc == 1} { pass $test } else { fail "$test ($rc)" } |