This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Forw: [ahoole at islandnet dot com: Accessing a va_list element from a probe]
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- To: systemtap at sourceware dot org
- Date: Sun, 5 Jan 2014 15:18:03 -0500
- Subject: Forw: [ahoole at islandnet dot com: Accessing a va_list element from a probe]
- Authentication-results: sourceware.org; auth=none
From: "Alexander M. Hoole" <ahoole@islandnet.com>
Subject: Accessing a va_list element from a probe
Date: Sun, 5 Jan 2014 11:50:39 -0800
[...]
I was wondering if you have ever attempted to access a va_list from a probe
in user-space. I can access the arguments; however, I'm presently puzzled
as to how to elegantly access the individual items of the va_list. For
example, if we setup a probe as follows:
.
probe process("/lib64/libc-2.17.so").function("printf")
{
printf("\tPID=%d, CMD=%s\n",pid(),execname())
printf("\tArgs: %s\n", $$parms)
printf("\tArg[1]: %s\n", user_string($format))
printf("\tArg[2]: %p\n", $arg)
}
.
According to stap -L we have the following arguments available:
.
# stap -L 'process("/lib64/libc-2.17.so").function("printf")'
process("/usr/lib64/libc-2.17.so").function("__printf@/usr/src/debug/glibc-2
.17-c758a686/stdio-common/printf.c:28") $format:char const* $arg:va_list
$done:int
.
If a program were to call something like the following:
.
printf("Person %s is %d years old\n", name, age);
.
Do you have any ideas how I could access name and age?
Any assistance would be appreciated.
Thanks,
Alex