[PATCH] fix old sigaction display

Denys Vlasenko dvlasenk at redhat.com
Wed Jan 18 14:29:36 UTC 2012


Attached testcase open-codes old sigaction syscall.
(Current libc usually uses rt_sigaction).
Before patch, output is:

sigaction(SIGTRAP, {0x804825b, [], SA_RESTORER, 0x8048253}, NULL, 0x8048253) = 0
getpid()                                = 5842
kill(5842, SIGTRAP)                     = 0
--- {si_signo=SIGTRAP, si_code=SI_USER, si_pid=5842, si_uid=0, si_value={int=134513920, ptr=0x8048500}} (Trace/breakpoint trap) ---
write(1, "Got sig:5\n", 10)             = 10
sigreturn() (mask [])                   = 0
rt_sigprocmask(SIG_BLOCK, [TRAP], NULL, 8) = 0
getpid()                                = 5842
kill(5842, SIGTRAP)                     = 0
rt_sigprocmask(SIG_UNBLOCK, [TRAP], NULL, 8) = 0
--- {si_signo=SIGTRAP, si_code=SI_USER, si_pid=5842, si_uid=0, si_value={int=134513920, ptr=0x8048500}} (Trace/breakpoint trap) ---
write(1, "Got sig:5\n", 10)             = 10
sigreturn() (mask [])                   = 0
sigaction(SIGTRAP, {SIG_IGN, , NULL, 0x8048253) = 0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
getpid()                                = 5842
kill(5842, SIGTRAP)                     = 0
--- {si_signo=SIGTRAP, si_code=SI_USER, si_pid=5842, si_uid=0, si_value={int=134513920, ptr=0x8048500}} (Trace/breakpoint trap) ---
sigaction(SIGTRAP, {0x804825b, [], SA_RESTORER, 0x8048253}, NULL, 0x8048253) = 0
getpid()                                = 5842
kill(5842, SIGTRAP)                     = 0
--- {si_signo=SIGTRAP, si_code=SI_USER, si_pid=5842, si_uid=0, si_value={int=134513920, ptr=0x8048500}} (Trace/breakpoint trap) ---
write(1, "Got sig:5\n", 10)             = 10
sigreturn() (mask [])                   = 0
_exit(0)                                = ?
+++ exited with 0 +++

Note messed-up line.

Patch makes it display as:

sigaction(SIGTRAP, {SIG_IGN, [], SA_RESTORER, 0x8048253}, NULL, 0x8048253) = 0




* signal (sys_sigaction): Fix display of sigaction with
SIG_DFL/SIG_IGN handlers.

-- 
vda

diff -d -urpN strace.6/signal.c strace.7/signal.c
--- strace.6/signal.c	2012-01-18 13:47:01.883493605 +0100
+++ strace.7/signal.c	2012-01-18 15:19:26.334601560 +0100
@@ -1022,20 +1022,20 @@ sys_sigaction(struct tcb *tcp)
  			}
  #endif /* !USE_PROCFS */
  			tprintf("{%#lx, ", (long) sa.SA_HANDLER);
+		}
  #ifndef LINUX
-			printsigmask(&sa.sa_mask, 0);
+		printsigmask(&sa.sa_mask, 0);
  #else
-			long_to_sigset(sa.sa_mask, &sigset);
-			printsigmask(&sigset, 0);
+		long_to_sigset(sa.sa_mask, &sigset);
+		printsigmask(&sigset, 0);
  #endif
-			tprints(", ");
-			printflags(sigact_flags, sa.sa_flags, "SA_???");
+		tprints(", ");
+		printflags(sigact_flags, sa.sa_flags, "SA_???");
  #ifdef SA_RESTORER
-			if (sa.sa_flags & SA_RESTORER)
-				tprintf(", %p", sa.sa_restorer);
+		if (sa.sa_flags & SA_RESTORER)
+			tprintf(", %p", sa.sa_restorer);
  #endif
-			tprints("}");
-		}
+		tprints("}");
  	}
  	if (entering(tcp))
  		tprints(", ");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.c
Type: text/x-csrc
Size: 2669 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20120118/d13f91af/attachment.bin>


More information about the Strace-devel mailing list