diff --git a/gcc/ada/tb-gcc.c b/gcc/ada/tb-gcc.c index 0fe923e53f8a..1a3566ec3796 100644 --- a/gcc/ada/tb-gcc.c +++ b/gcc/ada/tb-gcc.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2004 Ada Core Technologies, Inc * + * Copyright (C) 2004-2005, 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- * @@ -54,10 +54,21 @@ typedef struct { * trace_callback * ******************/ +#if defined (__ia64__) && defined (__hpux__) +#include +#endif + static _Unwind_Reason_Code trace_callback (struct _Unwind_Context * uw_context, uw_data_t * uw_data) { - void * pc = (void *) _Unwind_GetIP (uw_context); + void * pc; + +#if defined (__ia64__) && defined (__hpux__) + /* Work around problem with _Unwind_GetIP on ia64 HP-UX. */ + uwx_get_reg ((struct uwx_env *) uw_context, UWX_REG_IP, (uint64_t *) &pc); +#else + pc = (void *) _Unwind_GetIP (uw_context); +#endif if (uw_data->n_frames_skipped < uw_data->n_frames_to_skip) { diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c index f7c431b77b95..db825d155eef 100644 --- a/gcc/ada/tracebak.c +++ b/gcc/ada/tracebak.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 2000-2005 Ada Core Technologies, Inc. * + * Copyright (C) 2000-2005, 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- * @@ -300,7 +300,11 @@ struct layout }; #define LOWEST_ADDR 0 -#define FRAME_LEVEL 0 +#define FRAME_LEVEL 1 +/* builtin_frame_address (1) is expected to work on this target, and (0) might + return the soft stack pointer, which does not designate a location where a + backchain and a return address might be found. */ + #define FRAME_OFFSET 0 #define PC_ADJUST -2 #define STOP_FRAME(CURRENT, TOP_STACK) \ @@ -309,7 +313,7 @@ struct layout || (CURRENT)->return_address == 0|| (CURRENT)->next == 0 \ || (void *) (CURRENT) < (TOP_STACK)) -#define BASE_SKIP 1 +#define BASE_SKIP (1+FRAME_LEVEL) /* On i386 architecture we check that at the call point we really have a call insn. Possible call instructions are: @@ -349,9 +353,13 @@ struct layout /*----------------------------- ia64 ---------------------------------*/ -#elif defined (__ia64__) && !defined (USE_LIBUNWIND_EXCEPTIONS) +#elif defined (__ia64__) && (defined (linux) || defined (__hpux__)) #define USE_GCC_UNWINDER +/* Use _Unwind_Backtrace driven exceptions on ia64 HP-UX and ia64 + GNU/Linux, where _Unwind_Backtrace is provided by the system unwind + library. On HP-UX 11.23 this requires patch PHSS_33352, which adds + _Unwind_Backtrace to the system unwind library. */ #define PC_ADJUST -16 /* Every call on ia64 is part of a 128 bit bundle, so an adjustment of