From b5a994525bdee36e5ef51c41f0d53d472ba86f18 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 4 Sep 2014 16:25:39 -0700 Subject: [PATCH] stap: allow command line arguments in listing mode --- session.cxx | 2 +- testsuite/systemtap.base/listing_mode_sanity.exp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/session.cxx b/session.cxx index ee4e81b72..5f2465a23 100644 --- a/session.cxx +++ b/session.cxx @@ -1449,7 +1449,7 @@ systemtap_session::check_options (int argc, char * const argv []) { for (int i = optind; i < argc; i++) { - if (! have_script) + if (! have_script && ! dump_mode) { script_file = string (argv[i]); have_script = true; diff --git a/testsuite/systemtap.base/listing_mode_sanity.exp b/testsuite/systemtap.base/listing_mode_sanity.exp index 67c7d1ea1..0476cc893 100644 --- a/testsuite/systemtap.base/listing_mode_sanity.exp +++ b/testsuite/systemtap.base/listing_mode_sanity.exp @@ -7,6 +7,7 @@ set test "listing_mode_sanity" # - no 'semantic error' messages, unless -vv is supplied # - no probes found = bad exit code, probes found = good exit code # - check verbatim the output of -l/-L for e.g. kernel.function("vfs_read") +# - arguments to -l are allowed, not treated as a script (but still no -e) # - check that -l ** doesn't crash anything (BZ1065757) proc has_line { output wanted probe } { @@ -91,6 +92,21 @@ if {[regexp "^kernel\\.function\\(\"vfs_read@\[^\"\]*\"\\) \\\$file:struct file\ return } +# Check that arguments to -l work, and aren't treated as have_script +if {[catch {exec stap -l \$1.function(@2) kernel vfs_read 2>@1}]} { + fail "$test (using arguments exited badly)" + return +} else { + pass "$test (using arguments exited ok)" +} +# but a -e script still conflicts with listing +if {[catch {exec stap -l \$1.function(@2) kernel vfs_read -e {probe begin {}} 2>@1}]} { + pass "$test (using arguments and script exited badly)" +} else { + fail "$test (using arguments and script exited ok)" + return +} + # Checks that -vvv -l/-L ** doesn't crash anything (RHBZ1065757) if {[catch {exec stap -vvv -l \*\* 2>/dev/null}]} { fail "$test (stap -l ** exited badly)" -- 2.43.5