[Patch]Fix the args' output of syscall execve

Cai Fei caifei@cn.fujitsu.com
Thu Aug 16 12:56:00 GMT 2007


Hi, all
I'm using stap for tracing syscall execve. The following is part of my 
program:
---------------------------------------------------------
char *exec_argv[4] = {"arg1", "arg2", "arg3", NULL};
......
execve("./hello", exec_argv, NULL);
......
---------------------------------------------------------
and my stap file:
---------------------------------------------------------
probe syscall.execve {
      if (pid() == target() || ppid() == target()) next
      printf("%s\n", name)
      printf("%s\n", filename)
      printf("%s\n", args)
}
---------------------------------------------------------
and the output of stap command:
---------------------------------------------------------
execve
./hello
arg2 arg3
---------------------------------------------------------

I think users may be confused without the first argument. So I fixed it:

--- systemtap-20070811/tapset/aux_syscalls.stp	2007-08-11 00:39:43.000000000 +0900
+++ systemtap-20070811new/tapset/aux_syscalls.stp	2007-08-16 10:23:14.000000000 +0900
@@ -608,9 +608,6 @@ function __get_argv:string(a:long)
 	char buf[80];
 	char *ptr = buf;
 
-	if (argv)
-		argv++;
-
 	while (argv != NULL) {
 		if (get_user (vstr, argv))
       			break;


Regards, CaiFei



More information about the Systemtap mailing list