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]

how to collect the user space call stack with SystemTap


Hi all,

I want to use SystemTap to collect the user space call stack. According to the following paper, it should be worked.
http://lwn.net/Articles/316193/
http://gnu.wildebeest.org/diary/

So I want to test it and make sure it works on my system, but I got the wrong call stack with following simple test, although the kernel call stack is OK.

My configuration is:
1. Base system is Fedora 11 beta.
2. Update the kernel to 2.6.29 with the utrace patch from http://people.redhat.com/roland/utrace/2.6-current/, the CONFIG_UTRACE=y
CONFIG_UTRACE_PTRACE=y in .config file.
3. SystemTap translator/driver (version 0.9.5/0.140 non-git sources), SystemTap was compiled from source code.

My question is:
1. Does any one get the user space call stack with SystemTap successfully?
2. If you can, would you please share it to me how to setup and enable it? I don't what's wrong with my configuration.

The following is my testing scripts and results:
callstack.stp file:

probe process("/home/mysql/auto/convert").function("test").return
{
??????? printf("return from test\n");
??????? print_backtrace();
??????? printf("caller is %s\n", caller());
}

stap callstack.stp -c /home/mysql/auto/convert
the output is:
i=8978
return from test
?0x00007fffb6800011 : dtor_idx.6274+0x7fffb61ff609/0x0 [/home/mysql/auto/convert]
?0xf800000000000000 : dtor_idx.6274+0xf7ffffffff9ff5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0x06f8000000000000 : dtor_idx.6274+0x6f7ffffff9ff5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0x4006f80000000000 : dtor_idx.6274+0x4006f7ffff9ff5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0x004006f800000000 : dtor_idx.6274+0x4006f7ff9ff5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0x00004006f8000000 : dtor_idx.6274+0x4006f79ff5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0x0000004006f80000 : dtor_idx.6274+0x400697f5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0x000000004006f800 : dtor_idx.6274+0x3fa6edf8/0x0 [/home/mysql/auto/convert] (inexact)
?0x00000000004006f8 : __dso_handle+0x8/0x108 [/home/mysql/auto/convert] (inexact)
?0xf000000000004006 : dtor_idx.6274+0xefffffffffa035fe/0x0 [/home/mysql/auto/convert] (inexact)
?0xbbf0000000000040 : dtor_idx.6274+0xbbefffffff9ff638/0x0 [/home/mysql/auto/convert] (inexact)
?0x6fbbf00000000000 : dtor_idx.6274+0x6fbbefffff9ff5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0xb66fbbf000000000 : dtor_idx.6274+0xb66fbbefff9ff5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0xffb66fbbf0000000 : dtor_idx.6274+0xffb66fbbef9ff5f8/0x0 [/home/mysql/auto/convert] (inexact) 
? 0x7fffb66fbbf00000 : dtor_idx.6274+0x7fffb66fbb8ff5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0x007fffb66fbbf000 : dtor_idx.6274+0x7fffb66f5be5f8/0x0 [/home/mysql/auto/convert] (inexact)
?0x00007fffb66fbbf0 : dtor_idx.6274+0x7fffb60fb1e8/0x0 [/home/mysql/auto/convert] (inexact)
?0x7f00007fffb66fbb : dtor_idx.6274+0x7f00007fff5665b3/0x0 [/home/mysql/auto/convert] (inexact)
?0x057f00007fffb66f : dtor_idx.6274+0x57f00007f9fac67/0x0 [/home/mysql/auto/convert] (inexact)
?0x40057f00007fffb6 : dtor_idx.6274+0x40057f00001ff5ae/0x0 [/home/mysql/auto/convert] (inexact)
?0x0040057f00007fff : dtor_idx.6274+0x40057effa075f7/0x0 [/home/mysql/auto/convert] (inexact)
caller is unknown


The source of convert.c file:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void caller(char *str);
void test(char *str);

int main(int argc, char *argv[])
{
??????? caller("0x2312");
??????? return 0;
}

void caller(char *str)
{
??????? test(str);
}

void test(char *str)
{
??????? long long int i;
??????? i=strtoll(str, NULL, 16);
??????? printf("i=%ld \n", i);
}

Thanks very much,
Xiang


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