diff options
author | Stan Cox <scox@redhat.com> | 2009-03-31 11:54:26 -0400 |
---|---|---|
committer | Stan Cox <scox@redhat.com> | 2009-03-31 11:54:26 -0400 |
commit | c5746f91b1ba8f374b4230e16cb33e1b9206ca2b (patch) | |
tree | 7d185a70bc61ab0fb211b0c14b7cbc53f8244474 | |
parent | 2397bb1aae49121d35cbd9f3863b4f6df202201f (diff) | |
download | systemtap-steved-c5746f91b1ba8f374b4230e16cb33e1b9206ca2b.tar.gz systemtap-steved-c5746f91b1ba8f374b4230e16cb33e1b9206ca2b.tar.xz systemtap-steved-c5746f91b1ba8f374b4230e16cb33e1b9206ca2b.zip |
Customize .mark -l output.
* tapsets.cxx (dwarf_builder::build): Add .mark name wildcard check.
Customize -l handling.
* testsuite/systemtap.base/static_uprobes.exp: Test .mark name wildcard.
-rw-r--r-- | tapsets.cxx | 15 | ||||
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.exp | 38 |
2 files changed, 46 insertions, 7 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index 690d7e28..50ee563a 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -5806,16 +5806,29 @@ dwarf_builder::build(systemtap_session & sess, probe_arg = *((__uint64_t*)((char*)pdata->d_buf + probe_scn_offset)); if (probe_scn_offset % (sizeof(__uint64_t)*2)) probe_scn_offset = (probe_scn_offset + sizeof(__uint64_t)*2) - (probe_scn_offset % (sizeof(__uint64_t)*2)); - if (strcmp (location->components[1]->arg->tok->content.c_str(), probe_name.c_str()) != 0) + if ((strcmp (location->components[1]->arg->tok->content.c_str(), + probe_name.c_str()) == 0) + || (dw->name_has_wildcard (location->components[1]->arg->tok->content.c_str()) + && dw->function_name_matches_pattern + (probe_name.c_str(), + location->components[1]->arg->tok->content.c_str()))) + ; + else continue; const token* sv_tok = location->components[1]->arg->tok; location->components[1]->functor = TOK_STATEMENT; location->components[1]->arg = new literal_number((int)probe_arg); location->components[1]->arg->tok = sv_tok; ((literal_map_t&)parameters)[TOK_STATEMENT] = location->components[1]->arg; + dwarf_query q(sess, base, location, *dw, parameters, finished_results); q.has_mark = true; dw->query_modules(&q); + if (sess.listing_mode) + { + finished_results.back()->locations[0]->components[1]->functor = TOK_MARK; + finished_results.back()->locations[0]->components[1]->arg = new literal_string (probe_name.c_str()); + } } return; } diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 620d5576..820626b8 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -1,5 +1,7 @@ set test "static_uprobes" +# Test miscellaneous features of .mark probes + # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_uprobes.c" set sup_exepath "[pwd]/static_uprobes.x" @@ -80,6 +82,9 @@ provider static_uprobes { }; " close $fp + +# Test dtrace + if {[installtest_p]} { set dtrace $env(SYSTEMTAP_PATH)/dtrace } else { @@ -90,9 +95,9 @@ if {[catch {exec $dtrace -h -s $sup_dpath} res]} { } catch {exec rm -f $sup_dpath} if {[file exists $sup_hpath]} then { - pass "$test generating header" + pass "$test dtrace" } else { - fail "$test generating header" + fail "$test dtrace" catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} return } @@ -133,6 +138,8 @@ if {$utrace_support_found == 0} { return } +# Run stap on executable built with dtrace generated header file + set ok 0 verbose -log "spawn stap -c $sup_exepath $sup_stppath" @@ -151,14 +158,16 @@ wait if {$ok == 5} { pass "$test C" } { fail "$test C ($ok)" } +# Test passing various C types to .mark probes + set sup_flags "$sup_flags additional_flags=-O0" set res [target_compile $srcdir/$subdir/sdt_types.c sdt_types.x executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "$test compiling -g" + fail "$test compiling types -g" return } else { - pass "$test compiling -g" + pass "$test compiling types -g" } set ok 0 @@ -176,9 +185,26 @@ expect { wait if { $ok != 0 } { - fail $fail + fail "$test $fail" +} else { + pass "$test types" +} + +# Test .mark probe wildcard matching + +set ok 0 +spawn stap -l "process(\"./sdt_types.x\").mark(\"*\")" +expect { + -timeout 180 + -re {mark\(\".*\"\)} { incr ok; exp_continue } + timeout { fail "$test C (timeout)" } + eof { } +} + +if { $ok == 45 } { + pass "$test wildcard" } else { - pass types + fail "$test wildcard ($ok)" } if { $verbose == 0 } { |