summaryrefslogtreecommitdiffstats
path: root/gcc/ada/tracebak.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 13:55:31 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 13:55:31 +0000
commitbba351394c80e6c1a56dd296ab373b2c618550e6 (patch)
tree0ad4ed1d7f614706088903e9bd92f2b630672add /gcc/ada/tracebak.c
parente1dc3134843fff33c3ba0aaf94423aafcface1bd (diff)
downloadppe42-gcc-bba351394c80e6c1a56dd296ab373b2c618550e6.tar.gz
ppe42-gcc-bba351394c80e6c1a56dd296ab373b2c618550e6.zip
2004-10-26 Pascal Obry <obry@gnat.com>
* tracebak.c (IS_BAD_PTR): Use IsBadCodePtr on Win32 to check for ptr validity (process must have read access). Set to 0 in all other cases. (STOP_FRAME): Now check for ptr validity to avoid a segmentation violation on Win32. (VALID_STACK_FRAME): Check for ptr validity on Win32 to avoid a segmentation violation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89675 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/tracebak.c')
-rw-r--r--gcc/ada/tracebak.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c
index 45b2df11bb8..83d51ccfd28 100644
--- a/gcc/ada/tracebak.c
+++ b/gcc/ada/tracebak.c
@@ -278,6 +278,13 @@ struct layout
#elif defined (i386)
+#ifdef __WIN32
+#include <windows.h>
+#define IS_BAD_PTR(ptr) (IsBadCodePtr((void *)ptr))
+#else
+#define IS_BAD_PTR(ptr) 0
+#endif
+
#define USE_GENERIC_UNWINDER
struct layout
@@ -291,7 +298,8 @@ struct layout
#define FRAME_OFFSET 0
#define PC_ADJUST -2
#define STOP_FRAME(CURRENT, TOP_STACK) \
- ((unsigned int)(CURRENT)->return_address < LOWEST_ADDR \
+ (IS_BAD_PTR((long)(CURRENT)->return_address) \
+ || (unsigned int)(CURRENT)->return_address < LOWEST_ADDR \
|| (CURRENT)->return_address == 0|| (CURRENT)->next == 0 \
|| (void *) (CURRENT) < (TOP_STACK))
@@ -310,10 +318,11 @@ struct layout
*/
#define VALID_STACK_FRAME(ptr) \
- (((*((ptr) - 3) & 0xff) == 0xe8) \
- || ((*((ptr) - 5) & 0xff) == 0x9a) \
- || ((*((ptr) - 1) & 0xff) == 0xff) \
- || (((*(ptr) & 0xd0ff) == 0xd0ff)))
+ (!IS_BAD_PTR(ptr) \
+ && (((*((ptr) - 3) & 0xff) == 0xe8) \
+ || ((*((ptr) - 5) & 0xff) == 0x9a) \
+ || ((*((ptr) - 1) & 0xff) == 0xff) \
+ || (((*(ptr) & 0xd0ff) == 0xd0ff))))
/*------------------------------- mips-irix -------------------------------*/
@@ -324,7 +333,6 @@ struct layout
#endif
-
/*---------------------------------------------------------------------*
*-- The post GCC 3.3 infrastructure based implementation --*
*---------------------------------------------------------------------*/
OpenPOWER on IntegriCloud