When handling syscalls, don't try to figure out if the pre-handler set
the syscall result by inspecting RES after the pre-handler has run.
Instead, give each thread a syscall_result_set Bool, and make
SET_RESULT set it. Inspect that Bool.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3254 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/core.h b/coregrind/core.h
index f145a3a..ac62deb 100644
--- a/coregrind/core.h
+++ b/coregrind/core.h
@@ -863,6 +863,11 @@
/* Architecture-specific thread state */
ThreadArchState arch;
+
+ /* Used in the syscall handlers. Set to True to indicate that the
+ PRE routine for a syscall has set the syscall result already and
+ so the syscall does not need to be handed to the kernel. */
+ Bool syscall_result_set;
};
//ThreadState;
@@ -1424,7 +1429,10 @@
#define ARG5 SYSCALL_ARG5(tst->arch)
#define ARG6 SYSCALL_ARG6(tst->arch)
-#define SET_RESULT(val) PLATFORM_SET_SYSCALL_RESULT(tst->arch, (val))
+#define SET_RESULT(val) \
+ do { PLATFORM_SET_SYSCALL_RESULT(tst->arch, (val)); \
+ tst->syscall_result_set = True; \
+ } while (0)
#define PRINT(format, args...) \
if (VG_(clo_trace_syscalls)) \