public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Systemtap probe for Signals
@ 2006-07-04  8:31 Manoj S Pattabhiraman
  2006-07-04  9:28 ` Li Guanglei
  0 siblings, 1 reply; 5+ messages in thread
From: Manoj S Pattabhiraman @ 2006-07-04  8:31 UTC (permalink / raw)
  To: systemtap

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

Hi,

I just started of with trying systemtap by probing on signal handling.
Those probes are now consolidated under signal.stp.

(See attached file: signal.stp)

Please lemme know your suggestions on the same and how to go forward.

Thanks & Regards,    Manoj
-------------------------------------------------------------------
Manoj S Pattabhiraman, e-mail: mpattabh@in.ibm.com

[-- Attachment #2: signal.stp --]
[-- Type: application/octet-stream, Size: 2744 bytes --]

// Signal tapset
// Copyright (C) 2006 IBM Corp.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.

/*   Note : Since there are so many signals sent to processesat any give point, Its better to filter the
 *          the information according to the requirements. for example, filter only for a particular
 *          signal (if sig==2)  or filter only for a particular process ( if pid_name==stap )
*/

/* probe signal.sendsig
 *
 * Fires when a signal is sent to a process.
 * 
 */

 probe signal.sendsig = kernel.function("send_signal")
 {   
	sig=$sig
        sinfo = $info
	sig_pid = $t->pid
	pid_name = kernel_string($t->comm)
	
	if (sinfo == 2)
		si_code ="SIGSTOP or SIGKILL" 
	else if (sinfo > 0) 
		si_code="SI_KERNEL (SIGFPE, SIGSEGV, SIGTRAP, SIGCHLD, SIGPOLL)" 
	else if (sinfo <= 0) 
		si_code="SI_USER or SI_TIMER or SI_ASYNCIO" 	
	
	argstr = sprintf( "Signal : %u - Process name : %s (%d) - Signal Code : %s ", sig,sig_pid,pid_name,si_code)
}	

/* probe signal.wakeup
 *
 * Wake up the process for new active signals.
 *
 */

probe signal.wakeup =
        kernel.function("signal_wake_up")
{
   sig_pid = $t->pid
   pid_name = kernel_string($t->comm)
   state   = $resume
   if (state == 0)     {
                sig_state = "TASK_INTERRUPTIBLE"
         } else
                {
                sig_state = "TASK_INTERRUPTIBLE | TASK_STOPPED | TASK_TRACED"
        }
  argstr = sprintf( "Wakeup Signal to Process %s (%d) - Process State after the signal : %s ",pid_name,sig_pid,sig_state)	

}

/* probe signal.ignored
 *
 *  Fires whenever a signal is ignored by a process.
 *
 */

 probe signal.ignored = kernel.function("sig_ignored")
 {
	sig_pid = $t->pid
	pid_name = kernel_string($t->comm) 
	sig_info = $sig
	argstr = sprintf( "Signal : %d is ignored by the Process : %s (%d) ",sig_info,pid_name,sig_pid)

 } 	

/* probe signal.handle_stopsig
 *
 *  Fires when a stop signal is sent to a process.
 *
 */

 probe signal.handle_stopsig = kernel.function("handle_stop_signal")
 {
        sig_pid = $p->pid
        pid_name = kernel_string($p->comm)
        sig_info = $sig
	argstr = sprintf(" Stop Signal %d is sent to the process %s (%d)",sig_info,pid_name,sig_pid);
}

/* probe signal.forcesig
 *
 *  Forces SIGSEV when there are some issues while handling signals for the process.
 * 
 */

probe signal.forcesig = kernel.function("force_sigsegv")
 {
        sig_pid = $p->pid
        pid_name = kernel_string($p->comm)
        sig_info = $sig
        argstr = sprintf("Signal %d is forced on to the process %s (%d)",sig_info,pid_name,sig_pid);
}


^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <OF5B05ABF6.75FEE7A3-ON652571A1.003C3F54-652571A1.003C19A3@in.ibm.com>]

end of thread, other threads:[~2006-07-28  8:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-04  8:31 Systemtap probe for Signals Manoj S Pattabhiraman
2006-07-04  9:28 ` Li Guanglei
     [not found] <OF5B05ABF6.75FEE7A3-ON652571A1.003C3F54-652571A1.003C19A3@in.ibm.com>
2006-07-04 13:01 ` Li Guanglei
2006-07-26  7:13 ` Li Guanglei
2006-07-28  8:05   ` Li Guanglei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).