From 4be13c03169ded00a0a6b0e7e7ce8d008aaa51d0 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Fri, 6 Nov 2009 10:03:32 +0800 Subject: PR10820-cont': initialize the fields of empty token * tapsets.cxx (dwarf_derived_probe::saveargs): fill fields. --- tapsets.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index d2c33349..17e315e9 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2928,6 +2928,14 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex /* trick from visit_target_symbol_context */ target_symbol *tsym = new target_symbol; token *t = new token; + /* We hypothesize accessing the argument + * The source_loc will be base_loc since no real one */ + t->content = "$"; + t->content += arg_name; + t->type = tok_identifier; + t->location.file = q.base_loc->tok->location.file; + t->location.column = q.base_loc->tok->location.column; + t->location.line = q.base_loc->tok->location.line; tsym->tok = t; tsym->base_name = "$"; tsym->base_name += arg_name; -- cgit From 079915a57182ed3e5981190ccf8216c674aa4406 Mon Sep 17 00:00:00 2001 From: Roland Grunberg Date: Fri, 6 Nov 2009 14:09:06 -0500 Subject: PR10849: Support MAXSKIPPED handling on RHEL4 through implementation of atomic_cmpxchg --- tapsets.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 17e315e9..21704f69 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -228,7 +228,7 @@ common_probe_entryfn_epilogue (translator_output* o, // Check for excessive skip counts. o->newline() << "if (unlikely (atomic_read (& skipped_count) > MAXSKIPPED)) {"; - o->newline(1) << "if (unlikely (atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; + o->newline(1) << "if (unlikely (pseudo_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) << "}"; @@ -4640,7 +4640,7 @@ 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) << "if (unlikely (atomic_cmpxchg(& session_state, STAP_SESSION_RUNNING, STAP_SESSION_ERROR) == STAP_SESSION_RUNNING))"; + s.op->newline(1) << "if (unlikely (pseudo_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 From d87623a1515eada2bd7809b370bf8e7a3294c985 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 6 Nov 2009 16:01:10 -0800 Subject: Constrain $var-checking for -L of .return probes Normally, using a $var in a return probe create a matching entry probe to save the value. We don't want all this machinery though when we're just checking the accessibility of a $var for -L mode. * tapsets.cxx (dwarf_derived_probe::saveargs): Save/restore has_return while the $var accesses are attempted. --- tapsets.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 21704f69..59598cf3 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2901,6 +2901,12 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex dwarf_type_name(&type_die, type_name)) args.insert("$return:"+type_name); + /* Pretend that we aren't in a .return for a moment, just so we can check + * whether variables are accessible. We don't want to all the entry-saving + * code generated during listing mode. */ + bool saved_has_return = has_return; + q.has_return = has_return = false; + Dwarf_Die arg; vector scopes = q.dw.getscopes_die(scope_die); if (dwarf_child (&scopes[0], &arg) == 0) @@ -2927,16 +2933,7 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex /* trick from visit_target_symbol_context */ target_symbol *tsym = new target_symbol; - token *t = new token; - /* We hypothesize accessing the argument - * The source_loc will be base_loc since no real one */ - t->content = "$"; - t->content += arg_name; - t->type = tok_identifier; - t->location.file = q.base_loc->tok->location.file; - t->location.column = q.base_loc->tok->location.column; - t->location.line = q.base_loc->tok->location.line; - tsym->tok = t; + tsym->tok = q.base_loc->tok; tsym->base_name = "$"; tsym->base_name += arg_name; @@ -2947,6 +2944,9 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex args.insert("$"+string(arg_name)+":"+type_name); } while (dwarf_siblingof (&arg, &arg) == 0); + + /* restore the .return status of the probe */ + q.has_return = has_return = saved_has_return; } -- cgit From 36b155fa54b96e8f71b8c0997a4de76738de0338 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 6 Nov 2009 20:57:55 -0500 Subject: expand comment on has_return=0 treatment of -L foo.return probes --- tapsets.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 59598cf3..d20c0ab1 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2901,9 +2901,13 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex dwarf_type_name(&type_die, type_name)) args.insert("$return:"+type_name); - /* Pretend that we aren't in a .return for a moment, just so we can check - * whether variables are accessible. We don't want to all the entry-saving - * code generated during listing mode. */ + /* Pretend that we aren't in a .return for a moment, just so we can + * check whether variables are accessible. We don't want to all the + * entry-saving code generated during listing mode. This works + * because the set of $context variables available in a .return + * probe (apart from $return) is the same set as available for the + * corresponding .call probe, since we collect those variables at + * .call time. */ bool saved_has_return = has_return; q.has_return = has_return = false; -- cgit From e29b2f5a9c72fa413af00023384a39d4b667f17a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 6 Nov 2009 18:17:19 -0800 Subject: Fix a comment typo --- tapsets.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index d20c0ab1..e0346c69 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2902,7 +2902,7 @@ dwarf_derived_probe::saveargs(dwarf_query& q, Dwarf_Die* scope_die, dwarf_var_ex args.insert("$return:"+type_name); /* Pretend that we aren't in a .return for a moment, just so we can - * check whether variables are accessible. We don't want to all the + * check whether variables are accessible. We don't want any of the * entry-saving code generated during listing mode. This works * because the set of $context variables available in a .return * probe (apart from $return) is the same set as available for the -- cgit