You are not logged in.

#1 2011-10-17 13:11:47

gauthma
Member
Registered: 2010-02-16
Posts: 218
Website

[Solved] Signals and strace

Hello all,

From strace's man page, we get:

Signals are printed as a signal symbol and a signal string.  An excerpt from stracing and interrupting the command ``sleep 666'' is:

       sigsuspend([] <unfinished ...>
       --- SIGINT (Interrupt) ---
       +++ killed by SIGINT +++

However when I run the code, this what I get (I pressed Ctrl-C after double pressing <Enter>):

open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2109216, ...}) = 0
mmap(NULL, 2109216, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f270e17a000
close(3)                                = 0
nanosleep({666, 0}, 

^C <unfinished ...>

Ideas? More generally, how can I discover which signal is a program receiving (without modifying the source).

Thanks in advance.

Last edited by gauthma (2011-10-23 00:57:58)

Offline

#2 2011-10-17 15:03:35

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [Solved] Signals and strace

You're invoking the program in the context of strace rather than running the program and attaching strace to the PID.

$ sleep 60

In another term, launch strace and then go back to the first and ^c.

$ strace -p $(pgrep sleep)
Process 26801 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = ? ERESTART_RESTARTBLOCK (To be restarted)
--- {si_signo=SIGINT, si_code=SI_KERNEL, si_value={int=1, ptr=0x1}} (Interrupt) ---
Process 26801 detached

Offline

#3 2011-10-23 00:55:26

gauthma
Member
Registered: 2010-02-16
Posts: 218
Website

Re: [Solved] Signals and strace

Yes, that was it. Thank you very much for the help! smile

Offline

Board footer

Powered by FluxBB