diff options
-rw-r--r-- | auxprogs/aix5_VKI_info.c | 1 | ||||
-rw-r--r-- | coregrind/m_aspacemgr/aspacemgr-aix5.c | 31 | ||||
-rw-r--r-- | coregrind/m_main.c | 4 | ||||
-rw-r--r-- | include/vki/vki-ppc32-aix5.h | 1 | ||||
-rw-r--r-- | include/vki/vki-ppc64-aix5.h | 1 |
5 files changed, 34 insertions, 4 deletions
diff --git a/auxprogs/aix5_VKI_info.c b/auxprogs/aix5_VKI_info.c index e597b6fe7..b2095c810 100644 --- a/auxprogs/aix5_VKI_info.c +++ b/auxprogs/aix5_VKI_info.c @@ -268,6 +268,7 @@ int main ( void ) 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); diff --git a/coregrind/m_aspacemgr/aspacemgr-aix5.c b/coregrind/m_aspacemgr/aspacemgr-aix5.c index 18f438a2a..89a862736 100644 --- a/coregrind/m_aspacemgr/aspacemgr-aix5.c +++ b/coregrind/m_aspacemgr/aspacemgr-aix5.c @@ -201,7 +201,9 @@ static AixSegments asegs_told; /* 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. */ @@ -1162,6 +1164,8 @@ void VG_(am_aix5_set_initial_client_sp)( Addr sp ) { static Bool done = False; AixSegment seg; + Word n_fake_stack_pages; + Word m1 = 1048576; aspacem_assert(!done); done = True; @@ -1180,7 +1184,6 @@ void VG_(am_aix5_set_initial_client_sp)( Addr sp ) 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); @@ -1197,7 +1200,29 @@ void VG_(am_aix5_set_initial_client_sp)( Addr 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); diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 50992f48a..85f349597 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1470,12 +1470,14 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) # 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. */ @@ -1484,7 +1486,7 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp ) = 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 diff --git a/include/vki/vki-ppc32-aix5.h b/include/vki/vki-ppc32-aix5.h index 8cb3c82a6..76ad19d45 100644 --- a/include/vki/vki-ppc32-aix5.h +++ b/include/vki/vki-ppc32-aix5.h @@ -290,6 +290,7 @@ struct vki_sigaction { #define VKI_SEGV_MAPERR 50 #define VKI_TRAP_TRACE 61 +#define VKI_TRAP_BRKPT 60 #define VKI_BUS_OBJERR 3 #define VKI_BUS_ADRERR 2 #define VKI_BUS_ADRALN 1 diff --git a/include/vki/vki-ppc64-aix5.h b/include/vki/vki-ppc64-aix5.h index aec2347ae..fecbc8ca7 100644 --- a/include/vki/vki-ppc64-aix5.h +++ b/include/vki/vki-ppc64-aix5.h @@ -292,6 +292,7 @@ struct vki_sigaction { #define VKI_SEGV_MAPERR 50 #define VKI_TRAP_TRACE 61 +#define VKI_TRAP_BRKPT 60 #define VKI_BUS_OBJERR 3 #define VKI_BUS_ADRERR 2 #define VKI_BUS_ADRALN 1 |