systemtap userspace stack trace

Tim Mooney Tim.Mooney@ndsu.edu
Wed Jun 30 00:22:00 GMT 2010


Hi All!

I just returned from Red Hat Summit and attended William Cohen's talk
on SystemTap, which was pretty timely because I had been trying to use
systemtap the previous week to debug a problem and had become stuck.

On a RHEL 4 x86_64 system I run, I have a daemon that forks children
that frequently segfault.  I want to install a systemtap script that
watches for segfaults for that particular execname and prints the
userspace stack trace.  Until William's talk I wasn't even certain
userspace tracing was possible -- now I know it is, but I'm not certain
whether what I'm looking for can be done.

The approach I had taken was to start with sigkill.stp and modify it as
such:

probe signal.send {
     if ( (sig_name == "SIGBUS") || (sig_name == "SIGSEGV") )
         printf("Process exited with fatal signal\n");
}

This works, but of course I discovered that it only prints kernel space
info.  I need userspace, to try track down where in the daemon the problem
is happening.

Is what I'm after even possible?  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);
}

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?

Thanks,

Tim
-- 
Tim Mooney                                             Tim.Mooney@ndsu.edu
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164



More information about the Systemtap mailing list