[Liboil-commit] testsuite/Makefile.am testsuite/double_catch.c

David Schleef ds at kemper.freedesktop.org
Thu Mar 13 01:23:32 PDT 2008


 testsuite/Makefile.am    |    3 +-
 testsuite/double_catch.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)

New commits:
commit 93e6fd53fc511aecd7bf5e8a4caf6ea36f77db9f
Author: David Schleef <ds at ginger.bigkitten.com>
Date:   Thu Mar 13 01:25:24 2008 -0700

    Add double SIGILL catch program from #14763

diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 1169ad9..9b92be1 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -2,7 +2,8 @@
 SUBDIRS = instruction
 
 programs = align moo introspect proto1 proto2 test1 proto3 proto4 stride \
-	dso_check abs md5 md5_profile trans copy zigzag mmx_engine stack_align
+	dso_check abs md5 md5_profile trans copy zigzag mmx_engine stack_align \
+	double_catch
 
 check_PROGRAMS = $(programs)
 noinst_PROGRAMS = list_impls
diff --git a/testsuite/double_catch.c b/testsuite/double_catch.c
new file mode 100644
index 0000000..0e4fd8b
--- /dev/null
+++ b/testsuite/double_catch.c
@@ -0,0 +1,52 @@
+#include <liboil/liboilfault.h>
+#include <signal.h>
+#include <stdio.h>
+#include <setjmp.h>
+void blip(void *far) {
+	write(2,"hip\n",4);
+	asm("ud2");
+	write(2,"hop\n",4);
+}
+
+jmp_buf buf;
+void handle(int num) {
+	fprintf(stderr,"my catch!\n");
+	longjmp(buf, 1);
+}
+int main(void) {
+#if 0
+	struct sigaction act;
+	int ret;
+
+	memset(&act, 0, sizeof(act));
+	act.sa_handler = &handle;
+	act.sa_flags = SA_NOMASK;
+	sigaction(SIGILL, &act, NULL);
+
+	ret = setjmp(buf);
+	if (!ret) {
+		fprintf(stderr,"soo..\n");
+		blip(NULL);
+	}
+	if (ret)
+		fprintf(stderr,"failed\n");
+
+	ret = setjmp(buf);
+	if (!ret) {
+		fprintf(stderr,"soo..\n");
+		blip(NULL);
+	}
+	if (ret)
+		fprintf(stderr,"failed\n");
+
+#else
+	oil_fault_check_enable();
+	fprintf(stderr,"soo..\n");
+	if (!oil_fault_check_try(blip, NULL))
+		fprintf(stderr,"failed\n");
+	fprintf(stderr,"soo..\n");
+	if (!oil_fault_check_try(blip, NULL))
+		fprintf(stderr,"failed\n");
+	fprintf(stderr,"done..\n");
+#endif
+}


More information about the Liboil-commit mailing list