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: systemtap userspace stack trace


Tim Mooney <Tim.Mooney@ndsu.edu> writes:

> [...]  On a RHEL 4 x86_64 system I run [...]

... only very limited user-space probing is available, due to the lack
of kernel utrace/uprobes facilities.

> I want to install a systemtap script that
> watches for segfaults for that particular execname and prints the
> userspace stack trace.  [...]
> Is what I'm after even possible?  

(As mjw said, print_ubacktrace() may start working under such
conditions.)

> I understand that I could do something
> like:
>
> probe process("lpd").function("*").call
> {
>    printf("=>%s(%s)\n", probefunc(), $$parms);
> }
> probe process("lpd").function("*").return
> {
>   printf("<=%s:%s\n", probefunc(), $$return);
> }

These sorts of probes definitely require RHEL5 or higher.


> probe signal.send {
>     if ( (sig_name == "SIGBUS") || (sig_name == "SIGSEGV") )
>         printf("Process exited with fatal signal\n");
> 		exit();
> }
>
>
> and just let it run, dumping lots of output to the terminal
> until the segfault, but I'm wondering if there's a better way?

There are a bunch of different approaches that should not generate
so much trace data.  One very similar one would be:

global waldo
probe process("lpd").function("*").call { 
   waldo[tid()]=sprintf("=>%s(%s)\n", probefunc(), $$parms);
}
probe process("lpd").function("*").return
{
   waldo[tid()]=sprintf("<=%s(%s)\n", probefunc(), $$return);
}
probe signal.send {
   if ( (sig_name == "SIGBUS") || (sig_name == "SIGSEGV") &&
         sig_pid == target()) {
      printf("Process exited with fatal signal: %s\n", waldo[sig_pid]);
      exit();
   }
}

... but this would still computes backtraces kind of by hand, and
slowly, and still relies on rhel5+ / fedora / or other utrace-patched
kernels.


- FChE


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