printf("#define VKI_SEGV_MAPERR %d\n", SEGV_MAPERR);
printf("\n");
printf("#define VKI_TRAP_TRACE %d\n", TRAP_TRACE);
+ printf("#define VKI_TRAP_BRKPT %d\n", TRAP_BRKPT);
printf("#define VKI_BUS_OBJERR %d\n", BUS_OBJERR);
printf("#define VKI_BUS_ADRERR %d\n", BUS_ADRERR);
printf("#define VKI_BUS_ADRALN %d\n", BUS_ADRALN);
/* The assumed size of the main thread's stack, so that we can add a
segment for it at startup. */
-#define N_FAKE_STACK_PAGES 4096 /* 16M fake stack */
+#define N_FAKE_STACK_PAGES_MIN 4096 /* 16M fake stack */ /* default size */
+#define N_FAKE_STACK_PAGES_MAX 32768 /* 128M fake stack */ /* max size? */
+
/* Hacks which are probably for AIX 'millicode'. Note: ensure
these stay page aligned. */
{
static Bool done = False;
AixSegment seg;
+ Word n_fake_stack_pages;
+ Word m1 = 1048576;
aspacem_assert(!done);
done = True;
0xFFF'FFFF'FFFF'E920, and the accessible area extends to
0xFFF'FFFF'FFFF'FFFF. So in both cases, (64k roundup of sp) - 1
gives the end of the accessible area. */
-
VG_(debugLog)(1,"aspacem", "aix5_set_initial_client_sp( %p )\n",
(void*)sp);
seg.end = AM_64K_ROUNDUP(sp) - 1;
}
- seg.start = seg.end+1 - N_FAKE_STACK_PAGES * VKI_PAGE_SIZE;
+ n_fake_stack_pages = N_FAKE_STACK_PAGES_MIN;
+ if (VG_(clo_main_stacksize) > 0
+ && ((m1+VG_(clo_main_stacksize)) / VKI_PAGE_SIZE) > n_fake_stack_pages) {
+ n_fake_stack_pages = (m1+VG_(clo_main_stacksize)) / VKI_PAGE_SIZE;
+ }
+ if (n_fake_stack_pages > N_FAKE_STACK_PAGES_MAX) {
+ /* Allocation of the stack failed. We have to stop. */
+ VG_(debugLog)(
+ 0, "aspacem",
+ "valgrind: "
+ "I failed to allocate space for the application's stack.\n");
+ VG_(debugLog)(
+ 0, "aspacem",
+ "valgrind: "
+ "This may be the result of a very large --max-stackframe=\n");
+ VG_(debugLog)(
+ 0, "aspacem",
+ "valgrind: "
+ "setting. Cannot continue. Sorry.\n\n");
+ ML_(am_exit)(0);
+ }
+
+ seg.start = seg.end+1 - n_fake_stack_pages * VKI_PAGE_SIZE;
VG_(debugLog)(1,"aspacem", "aix5_set_initial_client_sp: stack seg:\n");
show_AixSegment(1,0, &seg);
# error "Uknown platform"
# endif
+ /* NOTE: this call reads VG_(clo_max_stackframe). */
the_iifii = VG_(ii_create_image)( the_iicii );
# if defined(VGO_aix5)
/* Tell aspacem where the initial client stack is, so that it
can later produce a faked-up NSegment in response to
VG_(am_find_nsegment) for that address range, if asked. */
+ /* NOTE: this call reads VG_(clo_max_stackframe). */
VG_(am_aix5_set_initial_client_sp)( the_iifii.initial_client_SP );
/* Now have a look at said fake segment, so we can find out
the size of it. */
= VG_(am_find_nsegment)( the_iifii.initial_client_SP );
vg_assert(seg);
sz = seg->end - seg->start + 1;
- vg_assert(sz >= 0 && sz <= 64*1024*1024); /* stay sane */
+ vg_assert(sz >= 0 && sz <= (256+1)*1024*1024); /* stay sane */
the_iifii.clstack_max_size = sz;
}
# endif