This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch]Fix the args' output of syscall execve


On Thu, 2007-08-16 at 10:52 +0900, Cai Fei wrote:
> 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;
> 

I checked this in with a few changes.  argv[0] was being skipped because
it is typically just the filename again. But you are correct that it
should be in args.  However for argstr, I think it makes things less
readable to include it.  So I changed __get_argv and __compat_get_argv
to optionally skip argv[0].





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]