(struct frame_unwind): Add dealloc_cache.
* frame.c (reinit_frame_cache): Call dealloc_cache on all caches.
* libunwind-frame.h (libunwind_frame_dealloc_cache): Declare.
* libunwind-frame.c (libunwind_frame_dealloc_cache): Define.
(libunwind_frame_unwind): Set dealloc_cache.
* ia64-tdep.c (ia64_libunwind_frame_unwind): Set dealloc_cache.
+2007-06-12 Andreas Schwab <schwab@suse.de>
+
+ * frame-unwind.h (frame_dealloc_cache_ftype): Define.
+ (struct frame_unwind): Add dealloc_cache.
+ * frame.c (reinit_frame_cache): Call dealloc_cache on all caches.
+
+ * libunwind-frame.h (libunwind_frame_dealloc_cache): Declare.
+ * libunwind-frame.c (libunwind_frame_dealloc_cache): Define.
+ (libunwind_frame_unwind): Set dealloc_cache.
+ * ia64-tdep.c (ia64_libunwind_frame_unwind): Set dealloc_cache.
+
2007-06-12 Ulrich Weigand <uweigand@de.ibm.com>
Markus Deuling <deuling@de.ibm.com>
typedef CORE_ADDR (frame_prev_pc_ftype) (struct frame_info *next_frame,
void **this_prologue_cache);
+/* Deallocate extra memory associated with the frame cache if any. */
+
+typedef void (frame_dealloc_cache_ftype) (struct frame_info *self,
+ void *this_cache);
struct frame_unwind
{
const struct frame_data *unwind_data;
frame_sniffer_ftype *sniffer;
frame_prev_pc_ftype *prev_pc;
+ frame_dealloc_cache_ftype *dealloc_cache;
};
/* Register a frame unwinder, _prepending_ it to the front of the
void
reinit_frame_cache (void)
{
+ struct frame_info *fi;
+
+ /* Tear down all frame caches. */
+ for (fi = current_frame; fi != NULL; fi = fi->prev)
+ {
+ if (fi->prologue_cache && fi->unwind->dealloc_cache)
+ fi->unwind->dealloc_cache (fi, fi->prologue_cache);
+ if (fi->base_cache && fi->base->unwind->dealloc_cache)
+ fi->base->unwind->dealloc_cache (fi, fi->base_cache);
+ }
+
/* Since we can't really be sure what the first object allocated was */
obstack_free (&frame_cache_obstack, 0);
obstack_init (&frame_cache_obstack);
{
NORMAL_FRAME,
ia64_libunwind_frame_this_id,
- ia64_libunwind_frame_prev_register
+ ia64_libunwind_frame_prev_register,
+ NULL,
+ NULL,
+ NULL,
+ libunwind_frame_dealloc_cache
};
static const struct frame_unwind *
CORE_ADDR base;
CORE_ADDR func_addr;
unw_cursor_t cursor;
+ unw_addr_space_t as;
};
/* We need to qualify the function names with a platform-specific prefix to match
}
cache->base = (CORE_ADDR)fp;
+ cache->as = as;
*this_cache = cache;
return cache;
}
+void
+libunwind_frame_dealloc_cache (struct frame_info *self, void *this_cache)
+{
+ struct libunwind_frame_cache *cache = this_cache;
+ if (cache->as)
+ unw_destroy_addr_space_p (cache->as);
+}
+
unw_word_t
libunwind_find_dyn_list (unw_addr_space_t as, unw_dyn_info_t *di, void *arg)
{
{
NORMAL_FRAME,
libunwind_frame_this_id,
- libunwind_frame_prev_register
+ libunwind_frame_prev_register,
+ NULL,
+ NULL,
+ NULL,
+ libunwind_frame_dealloc_cache
};
/* Verify if there is sufficient libunwind information for the frame to use
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, gdb_byte *valuep);
+void libunwind_frame_dealloc_cache (struct frame_info *self, void *cache);
CORE_ADDR libunwind_frame_base_address (struct frame_info *next_frame, void **this_cache);
int libunwind_is_initialized (void);