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: Queries on SystemTap - with focus on User Space debugging


manjusha.ajay wrote:

> [...]
> probe process("test_segfault").syscall
>  {
>  pid = pid()
>  if (pid == target())
>  {
>      if ($syscall == 11)

Syscall #11 may be execve or munmap; neither appears to have much to
do with SIGSEGV (which is signal #11).  We do not have a convenient
probe point in the tapset to commemorate signal delivery, but the 
following ought to do:

% stap -L 'kernel.function("send_sig")'
kernel.function("send_sig@kernel/signal.c:1300") $sig:int $p:struct task_struct* $priv:int

i.e., 

probe kernel.function("send_sig") {
      if ($sig == 11 && p && task_pid(p) == target()) {
         ....
      }
}


>      {
>      // Trying to stop the process to collect the
>      // required data when it receives SIGSEGV
>      stop_cmd = sprintf("kill -s STOP %d", pid)
>      system(stop_cmd)
>
>      print_ubacktrace()
>
>      // Resume the process
>      cont_cmd = sprintf ("kill -s CONT %d", pid)
>      system(cont_cmd)
>     }
>     }
>  }


This is more than necessary.  You neither need to kill -STOP or -CONT
around a print_ubacktrace().  Just print_ubacktrace().  The other
problem is that the system() tapset function does not run the given
command string immediately.  It enqueues it for execution *soon*.
This should explain why in your tests some of the kill jobs showed an
error with a missing process: it was gone by the time the enqueued
jobs got started.

- FChE


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