2011-05-26 Pedro Alves <pedro@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / libunwind-frame.c
index 2cdb1ab1f17eab8949e56efe99e5b0fa208371f7..677d4c5da21de13b261df56410f487833bc95dff 100644 (file)
 
 #include "complaints.h"
 
+/* 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.  */
+#ifndef __LITTLE_ENDIAN
+#define __LITTLE_ENDIAN 1234
+#endif
+#ifndef __BIG_ENDIAN
+#define __BIG_ENDIAN    4321
+#endif
+
 static int libunwind_initialized;
 static struct gdbarch_data *libunwind_descr_handle;
 
@@ -152,14 +162,20 @@ libunwind_frame_cache (struct frame_info *this_frame, void **this_cache)
   /* Allocate a new cache.  */
   cache = FRAME_OBSTACK_ZALLOC (struct libunwind_frame_cache);
 
-  /* We can assume we are unwinding a normal frame.  Even if this is
-     for a signal trampoline, ia64 signal "trampolines" use a normal
-     subroutine call to start the signal handler.  */
   cache->func_addr = get_frame_func (this_frame);
-  if (cache->func_addr == 0
-      && get_next_frame (this_frame)
-      && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME)
-    return NULL;
+  if (cache->func_addr == 0)
+    /* This can happen when the frame corresponds to a function for which
+       there is no debugging information nor any entry in the symbol table.
+       This is probably a static function for which an entry in the symbol
+       table was not created when the objfile got linked (observed in
+       libpthread.so on ia64-hpux).
+
+       The best we can do, in that case, is use the frame PC as the function
+       address.  We don't need to give up since we still have the unwind
+       record to help us perform the unwinding.  There is also another
+       compelling to continue, because abandonning now means stopping
+       the backtrace, which can never be helpful for the user.  */
+    cache->func_addr = get_frame_pc (this_frame);
 
   /* Get a libunwind cursor to the previous frame.
   
@@ -221,6 +237,7 @@ libunwind_find_dyn_list (unw_addr_space_t as, unw_dyn_info_t *di, void *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,
This page took 0.025064 seconds and 4 git commands to generate.