* [patch] fix the bug of conflict of -c and -x option
@ 2007-08-20 14:03 Lai Jiangshan
2007-08-20 15:35 ` David Smith
0 siblings, 1 reply; 2+ messages in thread
From: Lai Jiangshan @ 2007-08-20 14:03 UTC (permalink / raw)
To: systemtap
hi, all
using the following command to test target(), we can find that
the return value of target() is the pid of "readlink /proc/self",
but not 1234 as expected. Obviously, the -c and -x options are
conflict! pid specified by -x option will be overwritten if the -c
option is also specified.
$ stap -c "readlink /proc/self" -x 1234 -e 'probe begin{printf("target()=%d\n",target())}'
19681
target()=19681
the man page of stap says nothing about the conflict of -c and -x.
I think it will be better if the following patch can be applied.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
diff -Nur systemtap-20070818/main.cxx systemtap-20070818-new/main.cxx
--- systemtap-20070818/main.cxx 2007-08-15 00:29:40.000000000 +0900
+++ systemtap-20070818-new/main.cxx 2007-08-20 14:24:36.000000000 +0900
@@ -448,6 +448,12 @@
usage (s, 1);
}
+ if((s.cmd != "") && (s.target_pid))
+ {
+ cerr << "You can't specify -c and -x options together." <<endl;
+ usage (s, 1);
+ }
+
if (s.last_pass > 4 && release_changed)
{
if (s.verbose)
diff -Nur systemtap-20070818/runtime/staprun/common.c systemtap-20070818-new/runtime/staprun/common.c
--- systemtap-20070818/runtime/staprun/common.c 2007-08-15 00:23:59.000000000 +0900
+++ systemtap-20070818-new/runtime/staprun/common.c 2007-08-20 14:44:16.000000000 +0900
@@ -104,6 +104,11 @@
"option only has an effect when the module is inserted.\n");
usage(argv[0]);
}
+
+ if (target_cmd && target_pid) {
+ err("You can't specify the '-c' and '-x' options together.\n");
+ usage(argv[0]);
+ }
}
void usage(char *prog)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] fix the bug of conflict of -c and -x option
2007-08-20 14:03 [patch] fix the bug of conflict of -c and -x option Lai Jiangshan
@ 2007-08-20 15:35 ` David Smith
0 siblings, 0 replies; 2+ messages in thread
From: David Smith @ 2007-08-20 15:35 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: systemtap
Lai Jiangshan wrote:
> hi, all
>
> using the following command to test target(), we can find that
> the return value of target() is the pid of "readlink /proc/self",
> but not 1234 as expected. Obviously, the -c and -x options are
> conflict! pid specified by -x option will be overwritten if the -c
> option is also specified.
>
> $ stap -c "readlink /proc/self" -x 1234 -e 'probe
> begin{printf("target()=%d\n",target())}'
> 19681
> target()=19681
>
> the man page of stap says nothing about the conflict of -c and -x.
>
> I think it will be better if the following patch can be applied.
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
>
... patch deleted ...
Lai,
Thanks for the patch - I've committed it. I'll also be adding two
testcases to see this code gets exercised.
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-20 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-20 14:03 [patch] fix the bug of conflict of -c and -x option Lai Jiangshan
2007-08-20 15:35 ` David Smith
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).