]> granicus.if.org Git - strace/blobdiff - signal.c
tests: extend printstr test
[strace] / signal.c
index c8b0a5f595649474aea2f4d981d0b320a50e16c6..79054c709e44ced129c49f32417f9c97ff9fc4f5 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -300,30 +300,25 @@ SYS_FUNC(ssetmask)
 
 struct old_sigaction {
        /* sa_handler may be a libc #define, need to use other name: */
-#ifdef MIPS
+#if defined MIPS
        unsigned int sa_flags;
        unsigned long sa_handler__;
-       /* Kernel treats sa_mask as an array of longs. */
-       unsigned long sa_mask[NSIG / sizeof(long)];
+       unsigned long sa_mask;
+#elif defined ALPHA
+       unsigned long sa_handler__;
+       unsigned long sa_mask;
+       unsigned int sa_flags;
 #else
        unsigned long sa_handler__;
        unsigned long sa_mask;
        unsigned long sa_flags;
-#endif /* !MIPS */
-#if HAVE_SA_RESTORER
        unsigned long sa_restorer;
 #endif
-};
-
-struct old_sigaction32 {
-       /* sa_handler may be a libc #define, need to use other name: */
-       uint32_t sa_handler__;
-       uint32_t sa_mask;
-       uint32_t sa_flags;
-#if HAVE_SA_RESTORER
-       uint32_t sa_restorer;
+}
+#ifdef ALPHA
+       ATTRIBUTE_PACKED
 #endif
-};
+;
 
 static void
 decode_old_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
@@ -332,7 +327,12 @@ decode_old_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
 
 #ifndef current_wordsize
        if (current_wordsize < sizeof(sa.sa_handler__)) {
-               struct old_sigaction32 sa32;
+               struct old_sigaction32 {
+                       uint32_t sa_handler__;
+                       uint32_t sa_mask;
+                       uint32_t sa_flags;
+                       uint32_t sa_restorer;
+               } sa32;
 
                if (umove_or_printaddr(tcp, addr, &sa32))
                        return;
@@ -340,9 +340,7 @@ decode_old_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
                memset(&sa, 0, sizeof(sa));
                sa.sa_handler__ = sa32.sa_handler__;
                sa.sa_flags = sa32.sa_flags;
-#if HAVE_SA_RESTORER && defined SA_RESTORER
                sa.sa_restorer = sa32.sa_restorer;
-#endif
                sa.sa_mask = sa32.sa_mask;
        } else
 #endif
@@ -352,15 +350,11 @@ decode_old_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
        tprints("{sa_handler=");
        print_sa_handler(sa.sa_handler__);
        tprints(", sa_mask=");
-#ifdef MIPS
-       tprintsigmask_addr("", sa.sa_mask);
-#else
-       tprintsigmask_val("", sa.sa_mask);
-#endif
+       tprint_old_sigmask_val("", sa.sa_mask);
        tprints(", sa_flags=");
        printflags(sigact_flags, sa.sa_flags, "SA_???");
-#if HAVE_SA_RESTORER && defined SA_RESTORER
-       if (sa.sa_flags & SA_RESTORER) {
+#if !(defined ALPHA || defined MIPS)
+       if (sa.sa_flags & 0x04000000U) {
                tprints(", sa_restorer=");
                printaddr(sa.sa_restorer);
        }
@@ -371,7 +365,14 @@ decode_old_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
 SYS_FUNC(sigaction)
 {
        if (entering(tcp)) {
-               printsignal(tcp->u_arg[0]);
+               int signo = tcp->u_arg[0];
+#if defined SPARC || defined SPARC64
+               if (signo < 0) {
+                       tprints("-");
+                       signo = -signo;
+               }
+#endif
+               printsignal(signo);
                tprints(", ");
                decode_old_sigaction(tcp, tcp->u_arg[1]);
                tprints(", ");