* libunwind-frame.c (unw_destroy_addr_space_p): Define.

(destroy_addr_space_name): Define.
	(libunwind_load): Get address of destroy_addr_space function.
	(libunwind_frame_cache): Destroy unw_addr_space_t object before
	returning unsuccessfully.
	(libunwind_frame_sniffer): Destroy unw_addr_space_t object before
	returning.
	(libunwind_sigtramp_frame_sniffer): Likewise.
	(libunwind_get_reg_special): Likewise.
This commit is contained in:
Andreas Schwab 2007-06-06 19:35:02 +00:00
parent dce323d1dd
commit f43ae3f131
2 changed files with 42 additions and 5 deletions

View file

@ -1,3 +1,15 @@
2007-06-06 Andreas Schwab <schwab@suse.de>
* libunwind-frame.c (unw_destroy_addr_space_p): Define.
(destroy_addr_space_name): Define.
(libunwind_load): Get address of destroy_addr_space function.
(libunwind_frame_cache): Destroy unw_addr_space_t object before
returning unsuccessfully.
(libunwind_frame_sniffer): Destroy unw_addr_space_t object before
returning.
(libunwind_sigtramp_frame_sniffer): Likewise.
(libunwind_get_reg_special): Likewise.
2007-06-06 Markus Deuling <deuling@de.ibm.com> 2007-06-06 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (FETCH_POINTER_ARGUMENT): Replace by * gdbarch.sh (FETCH_POINTER_ARGUMENT): Replace by

View file

@ -53,6 +53,7 @@ static int (*unw_is_signal_frame_p) (unw_cursor_t *);
static int (*unw_step_p) (unw_cursor_t *); static int (*unw_step_p) (unw_cursor_t *);
static int (*unw_init_remote_p) (unw_cursor_t *, unw_addr_space_t, void *); static int (*unw_init_remote_p) (unw_cursor_t *, unw_addr_space_t, void *);
static unw_addr_space_t (*unw_create_addr_space_p) (unw_accessors_t *, int); static unw_addr_space_t (*unw_create_addr_space_p) (unw_accessors_t *, int);
static void (*unw_destroy_addr_space_p) (unw_addr_space_t);
static int (*unw_search_unwind_table_p) (unw_addr_space_t, unw_word_t, unw_dyn_info_t *, static int (*unw_search_unwind_table_p) (unw_addr_space_t, unw_word_t, unw_dyn_info_t *,
unw_proc_info_t *, int, void *); unw_proc_info_t *, int, void *);
static unw_word_t (*unw_find_dyn_list_p) (unw_addr_space_t, unw_dyn_info_t *, static unw_word_t (*unw_find_dyn_list_p) (unw_addr_space_t, unw_dyn_info_t *,
@ -85,6 +86,7 @@ static char *is_signal_frame_name = STRINGIFY(UNW_OBJ(is_signal_frame));
static char *step_name = STRINGIFY(UNW_OBJ(step)); static char *step_name = STRINGIFY(UNW_OBJ(step));
static char *init_remote_name = STRINGIFY(UNW_OBJ(init_remote)); static char *init_remote_name = STRINGIFY(UNW_OBJ(init_remote));
static char *create_addr_space_name = STRINGIFY(UNW_OBJ(create_addr_space)); static char *create_addr_space_name = STRINGIFY(UNW_OBJ(create_addr_space));
static char *destroy_addr_space_name = STRINGIFY(UNW_OBJ(destroy_addr_space));
static char *search_unwind_table_name = STRINGIFY(UNW_OBJ(search_unwind_table)); static char *search_unwind_table_name = STRINGIFY(UNW_OBJ(search_unwind_table));
static char *find_dyn_list_name = STRINGIFY(UNW_OBJ(find_dyn_list)); static char *find_dyn_list_name = STRINGIFY(UNW_OBJ(find_dyn_list));
@ -170,13 +172,19 @@ libunwind_frame_cache (struct frame_info *next_frame, void **this_cache)
unw_init_remote_p (&cache->cursor, as, next_frame); unw_init_remote_p (&cache->cursor, as, next_frame);
if (unw_step_p (&cache->cursor) < 0) if (unw_step_p (&cache->cursor) < 0)
return NULL; {
unw_destroy_addr_space_p (as);
return NULL;
}
/* To get base address, get sp from previous frame. */ /* To get base address, get sp from previous frame. */
uw_sp_regnum = descr->gdb2uw (SP_REGNUM); uw_sp_regnum = descr->gdb2uw (SP_REGNUM);
ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &fp); ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &fp);
if (ret < 0) if (ret < 0)
error (_("Can't get libunwind sp register.")); {
unw_destroy_addr_space_p (as);
error (_("Can't get libunwind sp register."));
}
cache->base = (CORE_ADDR)fp; cache->base = (CORE_ADDR)fp;
@ -224,13 +232,17 @@ libunwind_frame_sniffer (struct frame_info *next_frame)
ret = unw_init_remote_p (&cursor, as, next_frame); ret = unw_init_remote_p (&cursor, as, next_frame);
if (ret < 0) if (ret < 0)
return NULL; {
unw_destroy_addr_space_p (as);
return NULL;
}
/* Check to see if we have libunwind info by checking if we are in a /* Check to see if we have libunwind info by checking if we are in a
signal frame. If it doesn't return an error, we have libunwind info signal frame. If it doesn't return an error, we have libunwind info
and can use libunwind. */ and can use libunwind. */
ret = unw_is_signal_frame_p (&cursor); ret = unw_is_signal_frame_p (&cursor);
unw_destroy_addr_space_p (as);
if (ret < 0) if (ret < 0)
return NULL; return NULL;
@ -382,10 +394,14 @@ libunwind_sigtramp_frame_sniffer (struct frame_info *next_frame)
ret = unw_init_remote_p (&cursor, as, next_frame); ret = unw_init_remote_p (&cursor, as, next_frame);
if (ret < 0) if (ret < 0)
return NULL; {
unw_destroy_addr_space_p (as);
return NULL;
}
/* Check to see if we are in a signal frame. */ /* Check to see if we are in a signal frame. */
ret = unw_is_signal_frame_p (&cursor); ret = unw_is_signal_frame_p (&cursor);
unw_destroy_addr_space_p (as);
if (ret > 0) if (ret > 0)
return &libunwind_frame_unwind; return &libunwind_frame_unwind;
@ -422,7 +438,10 @@ libunwind_get_reg_special (struct gdbarch *gdbarch, struct regcache *regcache,
ret = unw_init_remote_p (&cursor, as, regcache); ret = unw_init_remote_p (&cursor, as, regcache);
if (ret < 0) if (ret < 0)
return -1; {
unw_destroy_addr_space_p (as);
return -1;
}
uw_regnum = descr->gdb2uw (regnum); uw_regnum = descr->gdb2uw (regnum);
@ -437,6 +456,8 @@ libunwind_get_reg_special (struct gdbarch *gdbarch, struct regcache *regcache,
ptr = &intval; ptr = &intval;
} }
unw_destroy_addr_space_p (as);
if (ret < 0) if (ret < 0)
return -1; return -1;
@ -485,6 +506,10 @@ libunwind_load (void)
if (unw_create_addr_space_p == NULL) if (unw_create_addr_space_p == NULL)
return 0; return 0;
unw_destroy_addr_space_p = dlsym (handle, destroy_addr_space_name);
if (unw_destroy_addr_space_p == NULL)
return 0;
unw_search_unwind_table_p = dlsym (handle, search_unwind_table_name); unw_search_unwind_table_p = dlsym (handle, search_unwind_table_name);
if (unw_search_unwind_table_p == NULL) if (unw_search_unwind_table_p == NULL)
return 0; return 0;