From a34babfa5246b1f8393c18fde450ec684f11bc21 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 19 Oct 2009 11:13:10 -0400 Subject: provide error message token/context if loc2c doesn't * tapsets.cxx (visit_target_symbol): When catching semantic_error, fill in token value if unset. Can happen for loc2c DIE() msgs. --- tapsets.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 113395e3..59dbc4b3 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2317,6 +2317,7 @@ dwarf_var_expanding_visitor::visit_target_symbol (target_symbol *e) // quietly. provide (e); semantic_error* saveme = new semantic_error (er); // copy it + if (! saveme->tok1) { saveme->tok1 = e->tok; } // fill in token if needed // NB: we can have multiple errors, since a $target variable // may be expanded in several different contexts: // function ("*") { $var } -- cgit From 81fb86d83da9964e7d9e2330d78b2008f18054e4 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 19 Oct 2009 18:11:58 -0700 Subject: Improve some runtime struct layouts Guided by pahole, I've shaved off a few padding bytes here and there. New sizes on x86_64: stap_task_finder_target 192 -> 184 stap_itrace_probe 216 -> 208 stap_utrace_probe 328 -> 312 stap_uprobe_tf 200 -> 192 stap_uprobe_spec 48 -> 40 I only changed field layouts, not types or names, so this should be perfectly safe. (FLW) --- tapsets.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 59dbc4b3..17e6c6cf 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -4433,11 +4433,11 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "static const struct stap_uprobe_spec {"; // NB: read-only structure s.op->newline(1) << "unsigned tfi;"; // index into stap_uprobe_finders[] + s.op->newline() << "unsigned return_p:1;"; s.op->newline() << "unsigned long address;"; s.op->newline() << "const char *pp;"; s.op->newline() << "void (*ph) (struct context*);"; s.op->newline() << "unsigned long sdt_sem_address;"; - s.op->newline() << "unsigned return_p:1;"; s.op->newline(-1) << "} stap_uprobe_specs [] = {"; // NB: read-only structure s.op->indent(1); for (unsigned i =0; i Date: Thu, 29 Oct 2009 08:26:32 +0800 Subject: PR10820: stap -L ignores any variable that isn't accessible * tapsets.cxx (saveargs): check the accessibility. --- tapsets.cxx | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 17e6c6cf..31d162a2 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -326,6 +326,7 @@ function_spec_type struct dwarf_builder; +struct dwarf_var_expanding_visitor; // XXX: This class is a candidate for subclassing to separate @@ -377,7 +378,7 @@ protected: private: string args; - void saveargs(dwarf_query& q, Dwarf_Die* scope_die); + void saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_expanding_visitor& v); }; @@ -2813,12 +2814,13 @@ dwarf_derived_probe::dwarf_derived_probe(const string& funcname, q.has_call = false; q.base_probe->body = old_body; } + // Save the local variables for listing mode + if (q.sess.listing_mode_vars) + saveargs(q, scope_die, v); } // else - null scope_die - $target variables will produce an error during translate phase - // Save the local variables for listing mode - if (q.sess.listing_mode_vars) - saveargs(q, scope_die); + // PR10820: null scope die, local variables aren't accessible, not necessary to invoke saveargs // Reset the sole element of the "locations" vector as a // "reverse-engineered" form of the incoming (q.base_loc) probe @@ -2885,7 +2887,7 @@ dwarf_derived_probe::dwarf_derived_probe(const string& funcname, void -dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die) +dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_expanding_visitor& v) { if (null_die(scope_die)) return; @@ -2923,7 +2925,18 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die) !dwarf_type_name(&type_die, type_name)) continue; - argstream << " $" << arg_name << ":" << type_name; + /* trick from visit_target_symbol_context */ + target_symbol *tsym = new target_symbol; + token *t = new token; + tsym->tok = t; + tsym->base_name = "$"; + tsym->base_name += arg_name; + + /* Ignore any variable that isn't accessible */ + tsym->saved_conversion_error = 0; + v.require (tsym); + if (!tsym->saved_conversion_error) + argstream << " $" << arg_name << ":" << type_name; } while (dwarf_siblingof (&arg, &arg) == 0); -- cgit From 1ee6b5fcc17adf0b02417ac9fa0c05523b8d79c4 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 30 Oct 2009 08:10:04 -0400 Subject: PR10839: compute default KRETACTIVE from num_possible_cpus() instead of NR_CPUS * tapsets.cxx (dwarf_ and kprobe_derived_probe_group): Redefine KRETACTIVE. --- tapsets.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 31d162a2..c117b139 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3047,7 +3047,7 @@ dwarf_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline(); s.op->newline() << "#ifndef KRETACTIVE"; - s.op->newline() << "#define KRETACTIVE (max(15,6*NR_CPUS))"; + s.op->newline() << "#define KRETACTIVE (max(15,6*(int)num_possible_cpus()))"; s.op->newline() << "#endif"; // Forward declare the master entry functions @@ -5036,7 +5036,7 @@ kprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline(); s.op->newline() << "#ifndef KRETACTIVE"; - s.op->newline() << "#define KRETACTIVE (max(15,6*NR_CPUS))"; + s.op->newline() << "#define KRETACTIVE (max(15,6*(int)num_possible_cpus()))"; s.op->newline() << "#endif"; // Forward declare the master entry functions -- cgit From f65166cc4689cff00717bc494d310c8317379d62 Mon Sep 17 00:00:00 2001 From: Charley Wang Date: Mon, 2 Nov 2009 10:18:34 -0500 Subject: PR10849: make MAXSKIPPED overflow trigger an error message --- tapsets.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index c117b139..324237fa 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -228,8 +228,8 @@ common_probe_entryfn_epilogue (translator_output* o, // Check for excessive skip counts. o->newline() << "if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {"; - o->newline(1) << "atomic_set (& session_state, STAP_SESSION_ERROR);"; - o->newline() << "_stp_exit ();"; + o->newline(1) << "if (unlikely (atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; + o->newline() << "_stp_error (\"Skipped too many probes, check MAXSKIPPED or try again with stap -t for more details.\");"; o->newline(-1) << "}"; o->newline() << "#if INTERRUPTIBLE"; @@ -4634,8 +4634,8 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s) s.op->newline() << "#endif"; // NB: duplicates common_entryfn_epilogue, but then this is not a probe entry fn epilogue. s.op->newline() << "if (unlikely (atomic_inc_return (& skipped_count) > MAXSKIPPED)) {"; - s.op->newline(1) << "atomic_set (& session_state, STAP_SESSION_ERROR);"; - s.op->newline() << "_stp_exit ();"; + s.op->newline(1) << "if (unlikely (atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; + s.op->newline() << "_stp_error (\"Skipped too many probes, check MAXSKIPPED or try again with stap -t for more details.\");"; s.op->newline(-1) << "}"; s.op->newline(-1) << "}"; -- cgit