Virtualise the stack rlimit for the main thread and make valgrind enforce
that limit when growing the stack. Also add a message when the stack in any
thread overflows.
CCMAIL: 73818-done@bugs.kde.org
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2689 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c
index 183fa2e..a077d58 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -113,6 +113,7 @@
Addr VG_(valgrind_last);
vki_rlimit VG_(client_rlimit_data);
+vki_rlimit VG_(client_rlimit_stack);
/* This is set early to indicate whether this CPU has the
SSE/fxsave/fxrestor features. */
@@ -2496,7 +2497,10 @@
VG_(getrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
zero.rlim_max = VG_(client_rlimit_data).rlim_max;
VG_(setrlimit)(VKI_RLIMIT_DATA, &zero);
-
+
+ // Get the current process stack rlimit.
+ VG_(getrlimit)(VKI_RLIMIT_STACK, &VG_(client_rlimit_stack));
+
//--------------------------------------------------------------
// Check we were launched by stage1
// p: n/a