From f719ec7cc85a79206bbfe2521786fd84a6608bac Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Mon, 16 Jun 2008 15:47:06 -0400 Subject: Create alternative list only as needed. --- ChangeLog | 5 +++++ elaborate.cxx | 57 +++++++++++++++++++++++++++++---------------------------- session.h | 2 +- 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15f05059..b6ba86ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-16 Stan Cox + + * elaborate.cxx (semantic_pass_opt2): Only create function + alternatives if needed. Overload compare. + 2008-06-13 Stan Cox * elaborate.cxx (print_warning): Add optional_str parameter. diff --git a/elaborate.cxx b/elaborate.cxx index efdf2e96..00fd9094 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1229,7 +1229,8 @@ systemtap_session::print_error (const semantic_error& e) } void -systemtap_session::print_warning (const string& message_str, string optional_str = "") +systemtap_session::print_warning (const string& message_str, + const string& optional_str = "") { // Duplicate elimination if (seen_warnings.find (message_str) == seen_warnings.end()) @@ -1643,18 +1644,17 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p) vector::iterator it; for ( it = s.probes[i]->locals.begin() ; it != s.probes[i]->locals.end(); it++ ) - if (l->name.compare(((vardecl*)*it)->name) != 0) + if (l->name != ((vardecl*)*it)->name) o << " " << ((vardecl*)*it)->name; for ( it = s.globals.begin() ; it != s.globals.end() ; it++ ) - if (l->name.compare(((vardecl*)*it)->name) != 0) + if (l->name != ((vardecl*)*it)->name) o << " " << ((vardecl*)*it)->name; s.print_warning ("read-only local variable " + stringify(*l->tok), " (alternatives: " + o.str () + ")"); } - j++; } } @@ -1682,30 +1682,31 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p) // don't increment j } else - { - stringstream o; - vector::iterator it; - for ( it = s.functions[i]->formal_args.begin() ; - it != s.functions[i]->formal_args.end(); it++ ) - if (l->name.compare(((vardecl*)*it)->name) != 0) - o << " " << ((vardecl*)*it)->name; - for ( it = s.functions[i]->locals.begin() ; - it != s.functions[i]->locals.end(); it++ ) - if (l->name.compare(((vardecl*)*it)->name) != 0) - o << " " << ((vardecl*)*it)->name; - for ( it = s.globals.begin() ; - it != s.globals.end() ; it++ ) - if (l->name.compare(((vardecl*)*it)->name) != 0) - o << " " << ((vardecl*)*it)->name; - - if (vut.written.find (l) == vut.written.end()) - if (! s.suppress_warnings) - s.print_warning ("read-only local variable " - + stringify(*l->tok), - " (alternatives:" + o.str () + ")"); - - j++; - } + { + if (vut.written.find (l) == vut.written.end()) + if (! s.suppress_warnings) + { + stringstream o; + vector::iterator it; + for ( it = s.functions[i]->formal_args.begin() ; + it != s.functions[i]->formal_args.end(); it++ ) + if (l->name != ((vardecl*)*it)->name) + o << " " << ((vardecl*)*it)->name; + for ( it = s.functions[i]->locals.begin() ; + it != s.functions[i]->locals.end(); it++ ) + if (l->name != ((vardecl*)*it)->name) + o << " " << ((vardecl*)*it)->name; + for ( it = s.globals.begin() ; + it != s.globals.end() ; it++ ) + if (l->name != ((vardecl*)*it)->name) + o << " " << ((vardecl*)*it)->name; + + s.print_warning ("read-only local variable " + + stringify(*l->tok), + " (alternatives:" + o.str () + ")"); + } + j++; + } } for (unsigned i=0; i Date: Mon, 16 Jun 2008 16:41:33 -0500 Subject: Improved callback handling. 2008-06-16 David Smith * task_finder.c (stap_start_task_finder): Improved callback handling. --- runtime/ChangeLog | 5 +++++ runtime/task_finder.c | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 3912a4cf..ca7bf082 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,8 @@ +2008-06-16 David Smith + + * task_finder.c (stap_start_task_finder): Improved callback + handling. + 2008-06-10 David Smith * task_finder.c (struct stap_task_finder_target): Added diff --git a/runtime/task_finder.c b/runtime/task_finder.c index 8448f29c..e853cb2a 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -654,19 +654,21 @@ stap_start_task_finder(void) cb_tgt = list_entry(cb_node, struct stap_task_finder_target, callback_list); - if (cb_tgt == NULL || cb_tgt->callback == NULL) + if (cb_tgt == NULL) continue; // Call the callback. Assume that if // the thread is a thread group // leader, it is a process. - rc = cb_tgt->callback(tsk, 1, - (tsk->pid == tsk->tgid), - cb_tgt); - if (rc != 0) { - _stp_error("attach callback for %d failed: %d", - (int)tsk->pid, rc); - goto stf_err; + if (cb_tgt->callback != NULL) { + rc = cb_tgt->callback(tsk, 1, + (tsk->pid == tsk->tgid), + cb_tgt); + if (rc != 0) { + _stp_error("attach callback for %d failed: %d", + (int)tsk->pid, rc); + goto stf_err; + } } // Set up events we need for attached tasks. -- cgit