Author: florian
Date: Wed May 20 14:33:06 2015
New Revision: 15261
Log:
Use an enum type.
Modified:
branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c
branches/ASPACEM_TWEAKS/coregrind/m_sigframe/sigframe-common.c
branches/ASPACEM_TWEAKS/coregrind/m_signals.c
branches/ASPACEM_TWEAKS/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM_TWEAKS/coregrind/m_syswrap/syswrap-main.c
branches/ASPACEM_TWEAKS/coregrind/pub_core_aspacemgr.h
Modified: branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_aspacemgr/aspacemgr-linux.c Wed May 20 14:33:06 2015
@@ -1266,7 +1266,7 @@
'U' ADDR must be unmapped
'*' ADDR can be mapped or unmapped
*/
-Bool VG_(am_addr_is_in_extensible_client_stack)( Addr addr, HChar kind )
+Bool VG_(am_addr_is_in_extensible_client_stack)( Addr addr, MapKind kind )
{
const NSegment *seg = nsegments + find_nsegment_idx(addr);
@@ -1279,7 +1279,7 @@
return False;
case SkResvn: {
- if (kind == 'M') return False;
+ if (kind == MkMapped) return False;
if (seg->smode != SmUpper) return False;
/* If the the abutting segment towards higher addresses is an SkAnonC
segment, then ADDR is a future stack pointer. */
@@ -1293,7 +1293,7 @@
case SkAnonC: {
/* If the abutting segment towards lower addresses is an SkResvn
segment, then ADDR is a stack pointer into mapped memory. */
- if (kind == 'U') return False;
+ if (kind == MkUnmapped) return False;
const NSegment *next = VG_(am_next_nsegment)(seg, /*forward*/ False);
if (next == NULL || next->kind != SkResvn || next->smode != SmUpper)
return False;
Modified: branches/ASPACEM_TWEAKS/coregrind/m_sigframe/sigframe-common.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_sigframe/sigframe-common.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_sigframe/sigframe-common.c Wed May 20 14:33:06 2015
@@ -64,7 +64,7 @@
/* If the sigframe is allocated on an alternate stack, then we cannot
extend that stack. Nothing to do here. */
stackseg = VG_(am_find_nsegment)(addr);
- } else if (VG_(am_addr_is_in_extensible_client_stack)(addr, '*')) {
+ } else if (VG_(am_addr_is_in_extensible_client_stack)(addr, MkAny)) {
if (VG_(extend_stack)(tid, addr)) {
stackseg = VG_(am_find_nsegment)(addr);
if (0 && stackseg)
Modified: branches/ASPACEM_TWEAKS/coregrind/m_signals.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_signals.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_signals.c Wed May 20 14:33:06 2015
@@ -1736,7 +1736,7 @@
if (tid == 1) { // main thread
Addr esp = VG_(get_SP)(tid);
Addr base = VG_PGROUNDDN(esp - VG_STACK_REDZONE_SZB);
- if (VG_(am_addr_is_in_extensible_client_stack)(base, '*') &&
+ if (VG_(am_addr_is_in_extensible_client_stack)(base, MkAny) &&
VG_(extend_stack)(tid, base)) {
if (VG_(clo_trace_signals))
VG_(dmsg)(" -> extended stack base to %#lx\n",
@@ -2428,7 +2428,7 @@
}
if (info->si_code == VKI_SEGV_MAPERR
- && VG_(am_addr_is_in_extensible_client_stack)(fault, 'U')
+ && VG_(am_addr_is_in_extensible_client_stack)(fault, MkUnmapped)
&& fault >= fault_mask(esp - VG_STACK_REDZONE_SZB)) {
/* If the fault address is above esp but below the current known
stack segment base, and it was a fault because there was
@@ -2436,7 +2436,7 @@
then extend the stack segment.
*/
Addr base = VG_PGROUNDDN(esp - VG_STACK_REDZONE_SZB);
- if (VG_(am_addr_is_in_extensible_client_stack)(base, '*') &&
+ if (VG_(am_addr_is_in_extensible_client_stack)(base, MkAny) &&
VG_(extend_stack)(tid, base)) {
if (VG_(clo_trace_signals))
VG_(dmsg)(" -> extended stack base to %#lx\n",
Modified: branches/ASPACEM_TWEAKS/coregrind/m_syswrap/syswrap-generic.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_syswrap/syswrap-generic.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_syswrap/syswrap-generic.c Wed May 20 14:33:06 2015
@@ -3662,7 +3662,7 @@
vg_assert(grows == VKI_PROT_GROWSDOWN);
- if (VG_(am_addr_is_in_extensible_client_stack)(ARG1, 'M')) {
+ if (VG_(am_addr_is_in_extensible_client_stack)(ARG1, MkMapped)) {
const NSegment *aseg = VG_(am_find_nsegment)(ARG1);
Addr end = ARG1 + ARG2;
ARG1 = aseg->start;
Modified: branches/ASPACEM_TWEAKS/coregrind/m_syswrap/syswrap-main.c
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/m_syswrap/syswrap-main.c (original)
+++ branches/ASPACEM_TWEAKS/coregrind/m_syswrap/syswrap-main.c Wed May 20 14:33:06 2015
@@ -1550,7 +1550,7 @@
So the approximation we're taking here is to extend the stack only
if the client stack pointer does not look bogus. */
- if (VG_(am_addr_is_in_extensible_client_stack)(stackMin, '*'))
+ if (VG_(am_addr_is_in_extensible_client_stack)(stackMin, MkAny))
VG_(extend_stack)( tid, stackMin );
}
# endif
Modified: branches/ASPACEM_TWEAKS/coregrind/pub_core_aspacemgr.h
==============================================================================
--- branches/ASPACEM_TWEAKS/coregrind/pub_core_aspacemgr.h (original)
+++ branches/ASPACEM_TWEAKS/coregrind/pub_core_aspacemgr.h Wed May 20 14:33:06 2015
@@ -47,6 +47,13 @@
/* types SegKind, ShrinkMode and NSegment are described in
the tool-visible header file, not here. */
+/* Describes whether an address is mapped or unmapped/ */
+typedef
+ enum {
+ MkMapped = 0x1,
+ MkUnmapped = 0x2,
+ MkAny = MkMapped | MkUnmapped
+ } MapKind;
//--------------------------------------------------------------
// Initialisation
@@ -90,7 +97,8 @@
/* Check whether ADDR looks like an address or address-to-be located in an
extensible client stack segment. */
-extern Bool VG_(am_addr_is_in_extensible_client_stack)( Addr addr, HChar kind );
+extern Bool VG_(am_addr_is_in_extensible_client_stack)( Addr addr,
+ MapKind kind );
/* If ADDR is located in a segment that looks like a stack segment, return
the start and end addresses of that segment. */
|