summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2013-07-16 12:06:25 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2013-07-16 12:06:25 +0200
commitb51f364c4241aa247a7a22f92c06f1f1a4ab99b4 (patch)
tree31d0d194e5659cb0cfaaddcd2ca05c5a09a4f89f /test
parent9afc2ee682d2f9fd3ad938756c841d7f0eed5f21 (diff)
downloadstrace-b51f364c4241aa247a7a22f92c06f1f1a4ab99b4.tar.gz
strace-b51f364c4241aa247a7a22f92c06f1f1a4ab99b4.tar.bz2
strace-b51f364c4241aa247a7a22f92c06f1f1a4ab99b4.tar.xz
Improve sigreturn decoding on x86 to show RT signal bits too.
This includes decoding of 32-bit sigreturn by 64-bit strace, which previously wasn't done. Added a test for it. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/.gitignore1
-rw-r--r--test/Makefile2
-rw-r--r--test/sigreturn.c30
3 files changed, 32 insertions, 1 deletions
diff --git a/test/.gitignore b/test/.gitignore
index ce242fd..7eb39cf 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -10,3 +10,4 @@ wait_must_be_interruptible
threaded_execve
mtd
ubi
+sigreturn
diff --git a/test/Makefile b/test/Makefile
index 97ae746..92142b1 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -3,7 +3,7 @@ CFLAGS += -Wall
PROGS = \
vfork fork sig skodic clone leaderkill childthread \
sigkill_rain wait_must_be_interruptible threaded_execve \
- mtd ubi
+ mtd ubi sigreturn
all: $(PROGS)
diff --git a/test/sigreturn.c b/test/sigreturn.c
new file mode 100644
index 0000000..246a3ce
--- /dev/null
+++ b/test/sigreturn.c
@@ -0,0 +1,30 @@
+/*
+ * Check that strace output contains RT_1 RT_3 RT_31 RT_32 here:
+ * rt_sigprocmask(SIG_BLOCK, [CHLD RT_1 RT_3 RT_31 RT_32], NULL, 8) = 0
+ * and here:
+ * sigreturn() (mask [CHLD RT_1 RT_3 RT_31 RT_32]) = 0
+ *
+ * On x86, both 32-bit and 64-bit strace needs to be checked.
+ */
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+void null_handler(int sig)
+{
+}
+
+int main(int argc, char *argv[])
+{
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set, SIGCHLD);
+ sigaddset(&set, 33);
+ sigaddset(&set, 35);
+ sigaddset(&set, 63);
+ sigaddset(&set, 64);
+ sigprocmask(SIG_BLOCK, &set, NULL);
+ signal(SIGWINCH, null_handler);
+ raise(SIGWINCH);
+ return 0;
+}