- report the size requested size in pthread_attr_setstacksize() when
the size is bigger then the hardcoded value in valgrind. This
makes it easier to find out which value to use for
VG_PTHREAD_STACK_SIZE.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@378 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c
index 3ed46c0..c2b0f68 100644
--- a/coregrind/vg_libpthread.c
+++ b/coregrind/vg_libpthread.c
@@ -249,14 +249,17 @@
size_t __stacksize)
{
size_t limit;
+ char buf[1024];
ensure_valgrind("pthread_attr_setstacksize");
limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB
- 1000; /* paranoia */
if (__stacksize < limit)
return 0;
- barf("pthread_attr_setstacksize: "
- "requested size >= VG_PTHREAD_STACK_SIZE\n "
- "edit vg_include.h and rebuild.");
+ snprintf(buf, sizeof(buf), "pthread_attr_setstacksize: "
+ "requested size %d >= VG_PTHREAD_STACK_SIZE\n "
+ "edit vg_include.h and rebuild.", __stacksize);
+ buf[sizeof(buf)-1] = '\0'; /* Make sure it is zero terminated */
+ barf(buf);
}