Index: gdb/ia64-libunwind-tdep.c |
diff --git a/gdb/libunwind-frame.c b/gdb/ia64-libunwind-tdep.c |
similarity index 92% |
rename from gdb/libunwind-frame.c |
rename to gdb/ia64-libunwind-tdep.c |
index 94449b0c698d0dc5678f6f4a82833a3919665b3d..e1c89c48a532e2f799551be43961dccfdeef6f7e 100644 |
--- a/gdb/libunwind-frame.c |
+++ b/gdb/ia64-libunwind-tdep.c |
@@ -1,4 +1,4 @@ |
-/* Frame unwinder for frames using the libunwind library. |
+/* Frame unwinder for ia64 frames using the libunwind library. |
Copyright (C) 2003-2004, 2006-2012 Free Software Foundation, Inc. |
@@ -36,10 +36,18 @@ |
#include "gdb_assert.h" |
#include "gdb_string.h" |
-#include "libunwind-frame.h" |
+#include "ia64-libunwind-tdep.h" |
#include "complaints.h" |
+/* IA-64 is the only target that currently uses ia64-libunwind-tdep. |
+ Note how UNW_TARGET, UNW_OBJ, etc. are compile time constants below. |
+ Those come from libunwind's headers, and are target dependent. |
+ Also, some of libunwind's typedefs are target dependent, as e.g., |
+ unw_word_t. If some other target wants to use this, we will need |
+ to do some abstracting in order to make it possible to select which |
+ libunwind we're talking to at runtime (and have one per arch). */ |
+ |
/* The following two macros are normally defined in <endian.h>. |
But systems such as ia64-hpux do not provide such header, so |
we just define them here if not already defined. */ |
@@ -87,7 +95,11 @@ struct libunwind_frame_cache |
#ifndef LIBUNWIND_SO |
/* Use the stable ABI major version number. `libunwind-ia64.so' is a link time |
only library, not a runtime one. */ |
-#define LIBUNWIND_SO "libunwind-" STRINGIFY(UNW_TARGET) ".so.7" |
+#define LIBUNWIND_SO "libunwind-" STRINGIFY(UNW_TARGET) ".so.8" |
+ |
+/* Provide also compatibility with older .so. The two APIs are compatible, .8 |
+ is only extended a bit, GDB does not use the extended API at all. */ |
+#define LIBUNWIND_SO_7 "libunwind-" STRINGIFY(UNW_TARGET) ".so.7" |
#endif |
static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg)); |
@@ -233,17 +245,6 @@ libunwind_find_dyn_list (unw_addr_space_t as, unw_dyn_info_t *di, void *arg) |
return unw_find_dyn_list_p (as, di, arg); |
} |
-static const struct frame_unwind libunwind_frame_unwind = |
-{ |
- NORMAL_FRAME, |
- default_frame_unwind_stop_reason, |
- libunwind_frame_this_id, |
- libunwind_frame_prev_register, |
- NULL, |
- libunwind_frame_sniffer, |
- libunwind_frame_dealloc_cache, |
-}; |
- |
/* Verify if there is sufficient libunwind information for the frame to use |
libunwind frame unwinding. */ |
int |
@@ -376,17 +377,6 @@ libunwind_frame_prev_register (struct frame_info *this_frame, |
return val; |
} |
-CORE_ADDR |
-libunwind_frame_base_address (struct frame_info *this_frame, void **this_cache) |
-{ |
- struct libunwind_frame_cache *cache = |
- libunwind_frame_cache (this_frame, this_cache); |
- |
- if (cache == NULL) |
- return (CORE_ADDR)NULL; |
- return cache->base; |
-} |
- |
/* The following is a glue routine to call the libunwind unwind table |
search function to get unwind information for a specified ip address. */ |
int |
@@ -505,9 +495,27 @@ static int |
libunwind_load (void) |
{ |
void *handle; |
+ char *so_error = NULL; |
handle = dlopen (LIBUNWIND_SO, RTLD_NOW); |
if (handle == NULL) |
+ { |
+ so_error = xstrdup (dlerror ()); |
+#ifdef LIBUNWIND_SO_7 |
+ handle = dlopen (LIBUNWIND_SO_7, RTLD_NOW); |
+#endif /* LIBUNWIND_SO_7 */ |
+ } |
+ if (handle == NULL) |
+ { |
+ fprintf_unfiltered (gdb_stderr, _("[GDB failed to load %s: %s]\n"), |
+ LIBUNWIND_SO, so_error); |
+#ifdef LIBUNWIND_SO_7 |
+ fprintf_unfiltered (gdb_stderr, _("[GDB failed to load %s: %s]\n"), |
+ LIBUNWIND_SO_7, dlerror ()); |
+#endif /* LIBUNWIND_SO_7 */ |
+ } |
+ xfree (so_error); |
+ if (handle == NULL) |
return 0; |
/* Initialize pointers to the dynamic library functions we will use. */ |