* *
* 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 *
* terms of the GNU General Public License as published by the Free Soft- *
/*--------------------------- PPC AIX/Darwin ----------------------------*/
-#if (defined (__ppc__) && ((defined (_AIX) || defined (__APPLE__))))
+#if ((defined (_POWER) && defined (_AIX)) || \
+(defined (__ppc__) && defined (__APPLE__)))
#define USE_GENERIC_UNWINDER
To have __gnat_backtrace retrieve its own return address, we then
define ... */
-#define FORCE_CALL
+#define FORCE_CALL 1
#define FRAME_LEVEL 1
#define BASE_SKIP 1
void *return_address;
};
-#define FORCE_CALL
+#define FORCE_CALL 1
#define FRAME_LEVEL 1
/* See the PPC AIX case for an explanation of these values. */
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#endif
-/* Define a dummy function to call if FORCE_CALL is defined. Don't
- define it otherwise, as this could lead to "defined but not used"
- warnings. */
-#if defined (FORCE_CALL)
-static void forced_callee () {}
+#ifndef FORCE_CALL
+#define FORCE_CALL 0
#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
__gnat_backtrace (void **array,
int size,
void *top_stack;
int cnt = 0;
- /* Honor FORCE_CALL when defined. */
-#if defined (FORCE_CALL)
- forced_callee ();
-#endif
+ if (FORCE_CALL)
+ forced_callee ();
/* Force a call to builtin_frame_address with a positive argument
if required. This is necessary e.g. on sparc to have the register