Queries on SystemTap - with focus on User Space debugging

Adrien Kunysz adrien@kunysz.be
Sat May 21 23:31:00 GMT 2011


On Sat, May 21, 2011 at 08:27:59PM +0530, Manjusha Ajay wrote:
> - Can 'pstack' or any such tracing/profiling commands be invoked within a
> SystemTap session which collects the corresponding user space data when
> the process hits a particular probe.

For this specific case you are probably better off using the
print_ubacktrace() function.
 
> For example, I tried the following script to collect stack trace of a
> particular process.
> 
> probe process("process_name").syscall
> {
>         pid = pid()
>         if (pid == target())
>         {
>                 if ($syscall == 11)
>                 {
>                 stop_cmd = sprintf("kill -s STOP %d", pid)
>                 system(stop_cmd)                                       //
> Trying to stop the process to collect the required data when it receives
> SIGSEGV
> 
>                         cms = sprintf("pstack %d", pid())
>                         system(cmd)
>                         }
>                         cont_cmd = sprintf ("kill -s CONT %d", pid)
>                 system(cont_cmd)
>              }
> }
> 
> Output:
> Process 6343 not found  // output of pstack
> sh: line 0: kill: (6343) - No such process
> sh: line 0: kill: (6343) - No such process
> 
> Here bash commands executed through 'system' tapset are invoked after the
> process is dead.
> 
> My intent to get the userspace backtrace of any process which exits with a
> segmentation fault.  Is such a generic tracing method available in
> systemtap?
> Iam using Linux Red Hat release 5.4  and please comment on the backward
> compatibility of the tool with Red Hat release 4.7.

IIRC RHEL 4 doesn't have userland tracing. You can still put probes on
system calls with "syscall.whatever" but I don't think you'll have
ubacktrace().

I can't comment properly on DTrace as I have no experience with it but
from my understanding it's functionnaly equivalent to SystemTap
although the internals are significantly different.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/systemtap/attachments/20110521/336d336a/attachment.sig>


More information about the Systemtap mailing list