summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2007-11-30 18:55:43 -0500
committerFrank Ch. Eigler <fche@elastic.org>2007-11-30 18:55:43 -0500
commitbe01a078db770c236308d8375f96ebb6076a93a1 (patch)
tree658c53e02897b352cddd4c3a7ad9ab576fa8286e
parent80237db77374679171ac68f22cab0aee8c9b3d12 (diff)
parent44386f7789fbbb0b144c84847f35da6b10215af0 (diff)
downloadsystemtap-steved-be01a078db770c236308d8375f96ebb6076a93a1.tar.gz
systemtap-steved-be01a078db770c236308d8375f96ebb6076a93a1.tar.xz
systemtap-steved-be01a078db770c236308d8375f96ebb6076a93a1.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
-rw-r--r--ChangeLog12
-rw-r--r--elaborate.cxx23
-rw-r--r--tapsets.cxx9
-rw-r--r--testsuite/ChangeLog10
-rwxr-xr-xtestsuite/semok/twentyeight.stp4
-rw-r--r--testsuite/systemtap.base/marker.exp38
6 files changed, 74 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index cde76f43..a3bc3d97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-11-29 David Smith <dsmith@redhat.com>
+
+ * tapsets.cxx (mark_derived_probe::initialize_probe_context_vars):
+ Handles the case where one marker has more than one string
+ argument.
+
+2007-11-27 David Smith <dsmith@redhat.com>
+
+ PR 5377.
+ * elaborate.cxx (match_node::find_and_build): Handle wildcards in
+ probe points correctly.
+
2007-11-26 Frank Ch. Eigler <fche@elastic.org>
* elaborate.cxx (derived_probe ctor): Don't duplicate condition
diff --git a/elaborate.cxx b/elaborate.cxx
index c277d8d5..0ac0f4da 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -357,16 +357,35 @@ match_node::find_and_build (systemtap_session& s,
if (match.globmatch(subkey))
{
- // recurse
+ if (s.verbose > 2)
+ clog << "wildcard '" << loc->components[pos]->functor
+ << "' matched '" << subkey.name << "'" << endl;
+
+ // When we have a wildcard, we need to create a copy of
+ // the probe point. Then we'll create a copy of the
+ // wildcard component, and substitute the non-wildcard
+ // functor.
+ probe_point *non_wildcard_pp = new probe_point(*loc);
+ probe_point::component *non_wildcard_component
+ = new probe_point::component(*loc->components[pos]);
+ non_wildcard_component->functor = subkey.name;
+ non_wildcard_pp->components[pos] = non_wildcard_component;
+
+ // recurse (with the non-wildcard probe point)
try
{
- subnode->find_and_build (s, p, loc, pos+1, results);
+ subnode->find_and_build (s, p, non_wildcard_pp, pos+1,
+ results);
}
catch (const semantic_error& e)
{
// Ignore semantic_errors while expanding wildcards.
// If we get done and nothing was expanded, the code
// following the loop will complain.
+
+ // If this wildcard didn't match, cleanup.
+ delete non_wildcard_pp;
+ delete non_wildcard_component;
}
}
}
diff --git a/tapsets.cxx b/tapsets.cxx
index 3b992d4d..35fe1e4b 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -5290,6 +5290,7 @@ mark_derived_probe::initialize_probe_context_vars (translator_output* o)
if (! target_symbol_seen)
return;
+ bool deref_fault_needed = false;
for (unsigned i = 0; i < mark_args.size(); i++)
{
string localname = "l->__mark_arg" + lex_cast<string>(i+1);
@@ -5307,9 +5308,8 @@ mark_derived_probe::initialize_probe_context_vars (translator_output* o)
<< " tmp_str = va_arg(*c->mark_va_list, "
<< mark_args[i]->c_type << ");";
o->newline() << "deref_string (" << localname
- << ", tmp_str, MAXSTRINGLEN);";
- // Need to report errors?
- o->newline() << "deref_fault: ; }";
+ << ", tmp_str, MAXSTRINGLEN); }";
+ deref_fault_needed = true;
break;
default:
@@ -5317,6 +5317,9 @@ mark_derived_probe::initialize_probe_context_vars (translator_output* o)
break;
}
}
+ if (deref_fault_needed)
+ // Need to report errors?
+ o->newline() << "deref_fault: ;";
}
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 075245aa..dd7234ad 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2007-11-29 David Smith <dsmith@redhat.com>
+
+ * systemtap.base/marker.exp: Gets marker list from
+ Module.markers. K_MARKER03 is always run since it is designed to
+ fail.
+
+2007-11-27 David Smith <dsmith@redhat.com>
+
+ * semok/twentyeight.stp: Tests wildcarded probe points.
+
2007-11-19 Frank Ch. Eigler <fche@elastic.org>
* parseok/five.stp, semok/twentyseven.stp: Test "!" probe point flag.
diff --git a/testsuite/semok/twentyeight.stp b/testsuite/semok/twentyeight.stp
new file mode 100755
index 00000000..f9854134
--- /dev/null
+++ b/testsuite/semok/twentyeight.stp
@@ -0,0 +1,4 @@
+#! stap -p2
+
+# Make sure wildcards are handled
+probe kerne*.funct*("sys_read").* {}
diff --git a/testsuite/systemtap.base/marker.exp b/testsuite/systemtap.base/marker.exp
index 3dc0a6bf..1b750409 100644
--- a/testsuite/systemtap.base/marker.exp
+++ b/testsuite/systemtap.base/marker.exp
@@ -51,16 +51,21 @@ set kernel_script {"probe kernel.mark(\"%s\") { }"}
set kernel_script_arg {"probe kernel.mark(\"%s\") { print(%s) }"}
set kernel_script_arg2 {"probe kernel.mark(\"%s\") { %s = 0 }"}
-# Try to figure out if kernel markers are present in the kernel itself
-# or in any loaded module
-set fl [open "| egrep __mark_.+\.\[0-9\]+ /proc/kallsyms"]
-while {[gets $fl s] >= 0} {
- if [regexp {__mark_([^.]+)\.[0-9]+\t?} $s match name subexp module] {
- set kernel_markers_found 1
- lappend kernel_marker_names $name
+# Try to read in the marker list from the Module.markers file.
+set uname [exec /bin/uname -r]
+set arch [exec arch]
+set path "/usr/src/kernels/$uname-$arch/Module.markers"
+if {! [catch {open $path RDONLY} fl]} {
+ while {[gets $fl s] >= 0} {
+ # This regexp only picks up markers that contain arguments.
+ # This helps ensure that K_MARKER04 passes correctly.
+ if [regexp {^([^ \t]+)\t[^ \t]+.+$} $s match name] {
+ set kernel_markers_found 1
+ lappend kernel_marker_names $name
+ }
}
+ catch {close $fl}
}
-catch {close $fl}
#
# Do some marker tests.
@@ -86,15 +91,13 @@ if {$kernel_markers_found == 0} {
stap_compile $TEST_NAME 1 $script
}
+# We can go ahead and try this test even if the kernel doesn't have
+# marker support, since we're probing a marker that doesn't exist.
set TEST_NAME "K_MARKER03"
-if {$kernel_markers_found == 0} {
- untested "$TEST_NAME : no kernel markers present"
-} else {
- # Try compiling a script that probes a kernel marker that doesn't
- # exist.
- set script [format $kernel_script "X_marker_that_does_not_exist_X"]
- stap_compile $TEST_NAME 0 $script
-}
+# Try compiling a script that probes a kernel marker that doesn't
+# exist.
+set script [format $kernel_script "X_marker_that_does_not_exist_X"]
+stap_compile $TEST_NAME 0 $script
set TEST_NAME "K_MARKER04"
if {$kernel_markers_found == 0} {
@@ -102,7 +105,8 @@ if {$kernel_markers_found == 0} {
} else {
# Try compiling a script that prints the first argument of a
# marker. This one might fail if the marker we pick doesn't have
- # any arguments.
+ # any arguments (but hopefully our kernel marker list only
+ # contains markers that have at least one argument).
set script [format $kernel_script_arg \
[lindex $kernel_marker_names 0] {\$arg1}]
stap_compile $TEST_NAME 1 $script