Reset *THIS_CACHE in frame_unwind_try_unwinder in case of exception

It is required that unwinder->sniffer should set *this_cache to NULL if
the unwinder is not applicable or exception is thrown, so
78ac5f8316 adds clear_pointer_cleanup to set
*this_cache to NULL in case of exception in order to fix PR 14100.
https://sourceware.org/ml/gdb-patches/2012-08/msg00075.html

This patch removes that clear_pointer_cleanup, and catch all exception in
the caller of unwinder->sniffer.  In case of exception, reset *this_case.

gdb:

2017-08-11  Yao Qi  <yao.qi@linaro.org>

	* dwarf2-frame.c (clear_pointer_cleanup): Remove.
	(dwarf2_frame_cache): Remove reset_cache_cleanup.
	(dwarf2_frame_cache):
	* frame-unwind.c (frame_unwind_try_unwinder): Catch
	RETURN_MASK_ALL and set *this_case to NULL.
	* frame-unwind.h: Update comments.
This commit is contained in:
Yao Qi 2017-08-11 09:30:02 +01:00
parent 1c90d9f022
commit be7d3cd5f1
4 changed files with 17 additions and 16 deletions

View file

@ -960,20 +960,9 @@ struct dwarf2_frame_cache
int entry_cfa_sp_offset_p;
};
/* A cleanup that sets a pointer to NULL. */
static void
clear_pointer_cleanup (void *arg)
{
void **ptr = (void **) arg;
*ptr = NULL;
}
static struct dwarf2_frame_cache *
dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
{
struct cleanup *reset_cache_cleanup;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
const int num_regs = gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch);
@ -989,7 +978,6 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = FRAME_OBSTACK_ZALLOC (struct dwarf2_frame_cache);
cache->reg = FRAME_OBSTACK_CALLOC (num_regs, struct dwarf2_frame_state_reg);
*this_cache = cache;
reset_cache_cleanup = make_cleanup (clear_pointer_cleanup, this_cache);
/* Unwind the PC.
@ -1078,7 +1066,6 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
if (ex.error == NOT_AVAILABLE_ERROR)
{
cache->unavailable_retaddr = 1;
discard_cleanups (reset_cache_cleanup);
return cache;
}
@ -1184,7 +1171,6 @@ incomplete CFI data; unspecified registers (e.g., %s) at %s"),
&& fs.regs.reg[fs.retaddr_column].how == DWARF2_FRAME_REG_UNDEFINED)
cache->undefined_retaddr = 1;
discard_cleanups (reset_cache_cleanup);
return cache;
}