projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove tp_t typedef
[deliverable/binutils-gdb.git]
/
gdb
/
dwarf2-frame-tailcall.c
diff --git
a/gdb/dwarf2-frame-tailcall.c
b/gdb/dwarf2-frame-tailcall.c
index 912cdf4ac964c6732ae5976c62cf56b813134ee0..1d3e1f445bba24407c8d73c1018f55f03210406e 100644
(file)
--- a/
gdb/dwarf2-frame-tailcall.c
+++ b/
gdb/dwarf2-frame-tailcall.c
@@
-1,6
+1,6
@@
/* Virtual tail call frames unwinder for GDB.
/* Virtual tail call frames unwinder for GDB.
- Copyright (C) 2010-201
2
Free Software Foundation, Inc.
+ Copyright (C) 2010-201
8
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-18,14
+18,12
@@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "gdb_assert.h"
#include "frame.h"
#include "dwarf2-frame-tailcall.h"
#include "dwarf2loc.h"
#include "frame-unwind.h"
#include "block.h"
#include "hashtab.h"
#include "frame.h"
#include "dwarf2-frame-tailcall.h"
#include "dwarf2loc.h"
#include "frame-unwind.h"
#include "block.h"
#include "hashtab.h"
-#include "exceptions.h"
#include "gdbtypes.h"
#include "regcache.h"
#include "value.h"
#include "gdbtypes.h"
#include "regcache.h"
#include "value.h"
@@
-70,7
+68,7
@@
struct tailcall_cache
static hashval_t
cache_hash (const void *arg)
{
static hashval_t
cache_hash (const void *arg)
{
- const struct tailcall_cache *cache = arg;
+ const struct tailcall_cache *cache =
(const struct tailcall_cache *)
arg;
return htab_hash_pointer (cache->next_bottom_frame);
}
return htab_hash_pointer (cache->next_bottom_frame);
}
@@
-80,8
+78,8
@@
cache_hash (const void *arg)
static int
cache_eq (const void *arg1, const void *arg2)
{
static int
cache_eq (const void *arg1, const void *arg2)
{
- const struct tailcall_cache *cache1 = arg1;
- const struct tailcall_cache *cache2 = arg2;
+ const struct tailcall_cache *cache1 =
(const struct tailcall_cache *)
arg1;
+ const struct tailcall_cache *cache2 =
(const struct tailcall_cache *)
arg2;
return cache1->next_bottom_frame == cache2->next_bottom_frame;
}
return cache1->next_bottom_frame == cache2->next_bottom_frame;
}
@@
-93,11
+91,9
@@
cache_eq (const void *arg1, const void *arg2)
static struct tailcall_cache *
cache_new_ref1 (struct frame_info *next_bottom_frame)
{
static struct tailcall_cache *
cache_new_ref1 (struct frame_info *next_bottom_frame)
{
- struct tailcall_cache *cache;
+ struct tailcall_cache *cache
= XCNEW (struct tailcall_cache)
;
void **slot;
void **slot;
- cache = xzalloc (sizeof (*cache));
-
cache->next_bottom_frame = next_bottom_frame;
cache->refc = 1;
cache->next_bottom_frame = next_bottom_frame;
cache->refc = 1;
@@
-164,7
+160,7
@@
cache_find (struct frame_info *fi)
if (slot == NULL)
return NULL;
if (slot == NULL)
return NULL;
- cache = *slot;
+ cache =
(struct tailcall_cache *)
*slot;
gdb_assert (cache != NULL);
return cache;
}
gdb_assert (cache != NULL);
return cache;
}
@@
-199,7
+195,7
@@
pretended_chain_levels (struct call_site_chain *chain)
return chain->length;
chain_levels = chain->callers + chain->callees;
return chain->length;
chain_levels = chain->callers + chain->callees;
- gdb_assert (chain_levels < chain->length);
+ gdb_assert (chain_levels <
=
chain->length);
return chain_levels;
}
return chain_levels;
}
@@
-213,7
+209,7
@@
static void
tailcall_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
tailcall_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct tailcall_cache *cache = *this_cache;
+ struct tailcall_cache *cache =
(struct tailcall_cache *)
*this_cache;
struct frame_info *next_frame;
/* Tail call does not make sense for a sentinel frame. */
struct frame_info *next_frame;
/* Tail call does not make sense for a sentinel frame. */
@@
-223,9
+219,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 = 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
}
/* Find PC to be unwound from THIS_FRAME. THIS_FRAME must be a part of
@@
-236,7
+232,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 next_levels = existing_next_levels (this_frame, cache);
struct call_site_chain *chain = cache->chain;
- int caller_no;
gdb_assert (chain != NULL);
gdb_assert (chain != NULL);
@@
-269,7
+264,7
@@
dwarf2_tailcall_prev_register_first (struct frame_info *this_frame,
void **tailcall_cachep, int regnum)
{
struct gdbarch *this_gdbarch = get_frame_arch (this_frame);
void **tailcall_cachep, int regnum)
{
struct gdbarch *this_gdbarch = get_frame_arch (this_frame);
- struct tailcall_cache *cache = *tailcall_cachep;
+ struct tailcall_cache *cache =
(struct tailcall_cache *)
*tailcall_cachep;
CORE_ADDR addr;
if (regnum == gdbarch_pc_regnum (this_gdbarch))
CORE_ADDR addr;
if (regnum == gdbarch_pc_regnum (this_gdbarch))
@@
-298,7
+293,7
@@
static struct value *
tailcall_frame_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
tailcall_frame_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
- struct tailcall_cache *cache = *this_cache;
+ struct tailcall_cache *cache =
(struct tailcall_cache *)
*this_cache;
struct value *val;
gdb_assert (this_frame != cache->next_bottom_frame);
struct value *val;
gdb_assert (this_frame != cache->next_bottom_frame);
@@
-367,19
+362,19
@@
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 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 gdbarch *prev_gdbarch;
struct call_site_chain *chain = NULL;
- struct frame_info *fi;
struct tailcall_cache *cache;
struct tailcall_cache *cache;
- volatile struct gdb_exception except;
gdb_assert (*tailcall_cachep == NULL);
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. */
/* Catch any unwinding errors. */
- TRY
_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
int sp_regnum;
{
int sp_regnum;
@@
-391,20
+386,23
@@
dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
/* call_site_find_chain can throw an exception. */
chain = call_site_find_chain (prev_gdbarch, prev_pc, this_pc);
/* call_site_find_chain can throw an exception. */
chain = call_site_find_chain (prev_gdbarch, prev_pc, this_pc);
- if (entry_cfa_sp_offsetp == NULL)
- break;
- sp_regnum = gdbarch_sp_regnum (prev_gdbarch);
- if (sp_regnum == -1)
- break;
- prev_sp = frame_unwind_register_unsigned (this_frame, sp_regnum);
- prev_sp_p = 1;
+ if (entry_cfa_sp_offsetp != NULL)
+ {
+ sp_regnum = gdbarch_sp_regnum (prev_gdbarch);
+ if (sp_regnum != -1)
+ {
+ prev_sp = frame_unwind_register_unsigned (this_frame, sp_regnum);
+ prev_sp_p = 1;
+ }
+ }
}
}
-
if (except.reason < 0
)
+
CATCH (except, RETURN_MASK_ERROR
)
{
if (entry_values_debug)
exception_print (gdb_stdout, except);
return;
}
{
if (entry_values_debug)
exception_print (gdb_stdout, except);
return;
}
+ END_CATCH
/* Ambiguous unwind or unambiguous unwind verified as matching. */
if (chain == NULL || chain->length == 0)
/* Ambiguous unwind or unambiguous unwind verified as matching. */
if (chain == NULL || chain->length == 0)
@@
-434,7
+432,7
@@
dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
static void
tailcall_frame_dealloc_cache (struct frame_info *self, void *this_cache)
{
static void
tailcall_frame_dealloc_cache (struct frame_info *self, void *this_cache)
{
- struct tailcall_cache *cache = this_cache;
+ struct tailcall_cache *cache =
(struct tailcall_cache *)
this_cache;
cache_unref (cache);
}
cache_unref (cache);
}
@@
-446,7
+444,7
@@
static struct gdbarch *
tailcall_frame_prev_arch (struct frame_info *this_frame,
void **this_prologue_cache)
{
tailcall_frame_prev_arch (struct frame_info *this_frame,
void **this_prologue_cache)
{
- struct tailcall_cache *cache = *this_prologue_cache;
+ struct tailcall_cache *cache =
(struct tailcall_cache *)
*this_prologue_cache;
return get_frame_arch (cache->next_bottom_frame);
}
return get_frame_arch (cache->next_bottom_frame);
}
@@
-466,9
+464,6
@@
const struct frame_unwind dwarf2_tailcall_frame_unwind =
tailcall_frame_prev_arch
};
tailcall_frame_prev_arch
};
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern initialize_file_ftype _initialize_tailcall_frame;
-
void
_initialize_tailcall_frame (void)
{
void
_initialize_tailcall_frame (void)
{
This page took
0.026159 seconds
and
4
git commands to generate.