Commit 7dc56b36 by Eric Botcazou Committed by Arnaud Charlet

tracebak.c (PPC AIX/Darwin): Define FORCE_CALL to 1.

2006-02-13  Eric Botcazou  <ebotcazou@adacore.com>

	* tracebak.c (PPC AIX/Darwin): Define FORCE_CALL to 1.
	(PPC VxWorks): Likewise.
	(Generic unwinder): Define FORCE_CALL to 0 if not already defined.
	(forced_callee): Make non-inlinable and non-pure.
	(__gnat_backtrace): Call forced_callee if FORCE_CALL is set to 1.

From-SVN: r111103
parent 405b3ed4
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 2000-2005, AdaCore * * Copyright (C) 2000-2006, AdaCore *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -193,7 +193,8 @@ extern void (*Unlock_Task) (void); ...@@ -193,7 +193,8 @@ extern void (*Unlock_Task) (void);
/*--------------------------- PPC AIX/Darwin ----------------------------*/ /*--------------------------- PPC AIX/Darwin ----------------------------*/
#if (defined (__ppc__) && ((defined (_AIX) || defined (__APPLE__)))) #if ((defined (_POWER) && defined (_AIX)) || \
(defined (__ppc__) && defined (__APPLE__)))
#define USE_GENERIC_UNWINDER #define USE_GENERIC_UNWINDER
...@@ -215,7 +216,7 @@ struct layout ...@@ -215,7 +216,7 @@ struct layout
To have __gnat_backtrace retrieve its own return address, we then To have __gnat_backtrace retrieve its own return address, we then
define ... */ define ... */
#define FORCE_CALL #define FORCE_CALL 1
#define FRAME_LEVEL 1 #define FRAME_LEVEL 1
#define BASE_SKIP 1 #define BASE_SKIP 1
...@@ -232,7 +233,7 @@ struct layout ...@@ -232,7 +233,7 @@ struct layout
void *return_address; void *return_address;
}; };
#define FORCE_CALL #define FORCE_CALL 1
#define FRAME_LEVEL 1 #define FRAME_LEVEL 1
/* See the PPC AIX case for an explanation of these values. */ /* See the PPC AIX case for an explanation of these values. */
...@@ -404,13 +405,19 @@ struct layout ...@@ -404,13 +405,19 @@ struct layout
#define MAX(x,y) ((x) > (y) ? (x) : (y)) #define MAX(x,y) ((x) > (y) ? (x) : (y))
#endif #endif
/* Define a dummy function to call if FORCE_CALL is defined. Don't #ifndef FORCE_CALL
define it otherwise, as this could lead to "defined but not used" #define FORCE_CALL 0
warnings. */
#if defined (FORCE_CALL)
static void forced_callee () {}
#endif #endif
/* Make sure the function is not inlined. */
static void forced_callee (void) __attribute__ ((noinline));
static void forced_callee (void)
{
/* Make sure the function is not pure. */
volatile int i __attribute__ ((unused)) = 0;
}
int int
__gnat_backtrace (void **array, __gnat_backtrace (void **array,
int size, int size,
...@@ -423,10 +430,8 @@ __gnat_backtrace (void **array, ...@@ -423,10 +430,8 @@ __gnat_backtrace (void **array,
void *top_stack; void *top_stack;
int cnt = 0; int cnt = 0;
/* Honor FORCE_CALL when defined. */ if (FORCE_CALL)
#if defined (FORCE_CALL) forced_callee ();
forced_callee ();
#endif
/* Force a call to builtin_frame_address with a positive argument /* Force a call to builtin_frame_address with a positive argument
if required. This is necessary e.g. on sparc to have the register if required. This is necessary e.g. on sparc to have the register
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment