fix error in nios2-tdep.c
[deliverable/binutils-gdb.git] / gdb / dwarf2-frame-tailcall.c
index 38131151e61001f8393a9122825fb6b89dfe65d9..dd69d94a2a171ef993888acd57597cade3e285eb 100644 (file)
@@ -1,6 +1,6 @@
 /* Virtual tail call frames unwinder for GDB.
 
-   Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -29,6 +29,7 @@
 #include "gdbtypes.h"
 #include "regcache.h"
 #include "value.h"
+#include "dwarf2-frame.h"
 
 /* Contains struct tailcall_cache indexed by next_bottom_frame.  */
 static htab_t cache_htab;
@@ -222,9 +223,9 @@ tailcall_frame_this_id (struct frame_info *this_frame, void **this_cache,
   *this_id = get_frame_id (next_frame);
   (*this_id).code_addr = get_frame_pc (this_frame);
   (*this_id).code_addr_p = 1;
-  (*this_id).inline_depth = (cache->chain_levels
-                            - existing_next_levels (this_frame, cache));
-  gdb_assert ((*this_id).inline_depth > 0);
+  (*this_id).artificial_depth = (cache->chain_levels
+                                - existing_next_levels (this_frame, cache));
+  gdb_assert ((*this_id).artificial_depth > 0);
 }
 
 /* Find PC to be unwound from THIS_FRAME.  THIS_FRAME must be a part of
@@ -235,7 +236,6 @@ pretend_pc (struct frame_info *this_frame, struct tailcall_cache *cache)
 {
   int next_levels = existing_next_levels (this_frame, cache);
   struct call_site_chain *chain = cache->chain;
-  int caller_no;
 
   gdb_assert (chain != NULL);
 
@@ -280,7 +280,7 @@ dwarf2_tailcall_prev_register_first (struct frame_info *this_frame,
       if (next_levels == cache->chain_levels - 1)
        addr = cache->prev_sp;
       else
-       addr = get_frame_base (this_frame) - cache->entry_cfa_sp_offset;
+       addr = dwarf2_frame_cfa (this_frame) - cache->entry_cfa_sp_offset;
     }
   else
     return NULL;
@@ -366,29 +366,27 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
 {
   CORE_ADDR prev_pc = 0, prev_sp = 0;  /* GCC warning.  */
   int prev_sp_p = 0;
-  CORE_ADDR this_pc, pc;
+  CORE_ADDR this_pc;
   struct gdbarch *prev_gdbarch;
   struct call_site_chain *chain = NULL;
-  struct frame_info *fi;
   struct tailcall_cache *cache;
   volatile struct gdb_exception except;
 
   gdb_assert (*tailcall_cachep == NULL);
 
-  this_pc = get_frame_pc (this_frame);
+  /* PC may be after the function if THIS_FRAME calls noreturn function,
+     get_frame_address_in_block will decrease it by 1 in such case.  */
+  this_pc = get_frame_address_in_block (this_frame);
 
   /* Catch any unwinding errors.  */
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
-      int pc_regnum, sp_regnum;
+      int sp_regnum;
 
       prev_gdbarch = frame_unwind_arch (this_frame);
-      pc_regnum = gdbarch_pc_regnum (prev_gdbarch);
-      if (pc_regnum == -1)
-       break;
 
       /* Simulate frame_unwind_pc without setting this_frame->prev_pc.p.  */
-      prev_pc = frame_unwind_register_unsigned (this_frame, pc_regnum);
+      prev_pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
 
       /* call_site_find_chain can throw an exception.  */
       chain = call_site_find_chain (prev_gdbarch, prev_pc, this_pc);
This page took 0.02548 seconds and 4 git commands to generate.