* ada-lang.c (is_known_support_routine): Add explicit free of
'func_name' from find_frame_funname. (ada_unhandled_exception_name_addr_from_raise): Add cleanups for func_name from find_frame_funname. * python/py-frame.c (frapy_name): Add explicit free of 'name' from find_frame_funname. * stack.c (find_frame_funname): Add comment explaining that funcp must be freed by the caller. Return copy of symbol names instead of pointers. (print_frame): Add a cleanup for 'funname' from find_frame_funname. * stack.h (find_frame_funname): Remove "const" from 'funname' parameter.
This commit is contained in:
parent
5f2e6b00f8
commit
55b87a526f
5 changed files with 53 additions and 17 deletions
|
@ -1,3 +1,19 @@
|
||||||
|
2013-05-22 Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
|
* ada-lang.c (is_known_support_routine): Add explicit free of
|
||||||
|
'func_name' from find_frame_funname.
|
||||||
|
(ada_unhandled_exception_name_addr_from_raise): Add cleanups
|
||||||
|
for func_name from find_frame_funname.
|
||||||
|
* python/py-frame.c (frapy_name): Add explicit free of
|
||||||
|
'name' from find_frame_funname.
|
||||||
|
* stack.c (find_frame_funname): Add comment explaining that
|
||||||
|
funcp must be freed by the caller.
|
||||||
|
Return copy of symbol names instead of pointers.
|
||||||
|
(print_frame): Add a cleanup for 'funname' from
|
||||||
|
find_frame_funname.
|
||||||
|
* stack.h (find_frame_funname): Remove "const" from
|
||||||
|
'funname' parameter.
|
||||||
|
|
||||||
2013-05-22 Tom Tromey <tromey@redhat.com>
|
2013-05-22 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
PR c++/15401:
|
PR c++/15401:
|
||||||
|
|
|
@ -11113,7 +11113,7 @@ static int
|
||||||
is_known_support_routine (struct frame_info *frame)
|
is_known_support_routine (struct frame_info *frame)
|
||||||
{
|
{
|
||||||
struct symtab_and_line sal;
|
struct symtab_and_line sal;
|
||||||
const char *func_name;
|
char *func_name;
|
||||||
enum language func_lang;
|
enum language func_lang;
|
||||||
int i;
|
int i;
|
||||||
const char *fullname;
|
const char *fullname;
|
||||||
|
@ -11160,9 +11160,13 @@ is_known_support_routine (struct frame_info *frame)
|
||||||
{
|
{
|
||||||
re_comp (known_auxiliary_function_name_patterns[i]);
|
re_comp (known_auxiliary_function_name_patterns[i]);
|
||||||
if (re_exec (func_name))
|
if (re_exec (func_name))
|
||||||
return 1;
|
{
|
||||||
|
xfree (func_name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xfree (func_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11206,6 +11210,7 @@ ada_unhandled_exception_name_addr_from_raise (void)
|
||||||
int frame_level;
|
int frame_level;
|
||||||
struct frame_info *fi;
|
struct frame_info *fi;
|
||||||
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
|
struct ada_inferior_data *data = get_ada_inferior_data (current_inferior ());
|
||||||
|
struct cleanup *old_chain;
|
||||||
|
|
||||||
/* To determine the name of this exception, we need to select
|
/* To determine the name of this exception, we need to select
|
||||||
the frame corresponding to RAISE_SYM_NAME. This frame is
|
the frame corresponding to RAISE_SYM_NAME. This frame is
|
||||||
|
@ -11216,17 +11221,24 @@ ada_unhandled_exception_name_addr_from_raise (void)
|
||||||
if (fi != NULL)
|
if (fi != NULL)
|
||||||
fi = get_prev_frame (fi);
|
fi = get_prev_frame (fi);
|
||||||
|
|
||||||
|
old_chain = make_cleanup (null_cleanup, NULL);
|
||||||
while (fi != NULL)
|
while (fi != NULL)
|
||||||
{
|
{
|
||||||
const char *func_name;
|
char *func_name;
|
||||||
enum language func_lang;
|
enum language func_lang;
|
||||||
|
|
||||||
find_frame_funname (fi, &func_name, &func_lang, NULL);
|
find_frame_funname (fi, &func_name, &func_lang, NULL);
|
||||||
if (func_name != NULL
|
if (func_name != NULL)
|
||||||
&& strcmp (func_name, data->exception_info->catch_exception_sym) == 0)
|
{
|
||||||
break; /* We found the frame we were looking for... */
|
make_cleanup (xfree, func_name);
|
||||||
fi = get_prev_frame (fi);
|
|
||||||
|
if (strcmp (func_name,
|
||||||
|
data->exception_info->catch_exception_sym) == 0)
|
||||||
|
break; /* We found the frame we were looking for... */
|
||||||
|
fi = get_prev_frame (fi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
do_cleanups (old_chain);
|
||||||
|
|
||||||
if (fi == NULL)
|
if (fi == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -122,7 +122,7 @@ static PyObject *
|
||||||
frapy_name (PyObject *self, PyObject *args)
|
frapy_name (PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
struct frame_info *frame;
|
struct frame_info *frame;
|
||||||
const char *name;
|
char *name = NULL;
|
||||||
enum language lang;
|
enum language lang;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
volatile struct gdb_exception except;
|
volatile struct gdb_exception except;
|
||||||
|
@ -133,10 +133,17 @@ frapy_name (PyObject *self, PyObject *args)
|
||||||
|
|
||||||
find_frame_funname (frame, &name, &lang, NULL);
|
find_frame_funname (frame, &name, &lang, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (except.reason < 0)
|
||||||
|
xfree (name);
|
||||||
|
|
||||||
GDB_PY_HANDLE_EXCEPTION (except);
|
GDB_PY_HANDLE_EXCEPTION (except);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
result = PyUnicode_Decode (name, strlen (name), host_charset (), NULL);
|
{
|
||||||
|
result = PyUnicode_Decode (name, strlen (name), host_charset (), NULL);
|
||||||
|
xfree (name);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = Py_None;
|
result = Py_None;
|
||||||
|
|
15
gdb/stack.c
15
gdb/stack.c
|
@ -1004,10 +1004,10 @@ get_last_displayed_sal (struct symtab_and_line *sal)
|
||||||
|
|
||||||
|
|
||||||
/* Attempt to obtain the FUNNAME, FUNLANG and optionally FUNCP of the function
|
/* Attempt to obtain the FUNNAME, FUNLANG and optionally FUNCP of the function
|
||||||
corresponding to FRAME. */
|
corresponding to FRAME. FUNNAME needs to be freed by the caller. */
|
||||||
|
|
||||||
void
|
void
|
||||||
find_frame_funname (struct frame_info *frame, const char **funname,
|
find_frame_funname (struct frame_info *frame, char **funname,
|
||||||
enum language *funlang, struct symbol **funcp)
|
enum language *funlang, struct symbol **funcp)
|
||||||
{
|
{
|
||||||
struct symbol *func;
|
struct symbol *func;
|
||||||
|
@ -1055,12 +1055,12 @@ find_frame_funname (struct frame_info *frame, const char **funname,
|
||||||
/* We also don't know anything about the function besides
|
/* We also don't know anything about the function besides
|
||||||
its address and name. */
|
its address and name. */
|
||||||
func = 0;
|
func = 0;
|
||||||
*funname = SYMBOL_PRINT_NAME (msymbol.minsym);
|
*funname = xstrdup (SYMBOL_PRINT_NAME (msymbol.minsym));
|
||||||
*funlang = SYMBOL_LANGUAGE (msymbol.minsym);
|
*funlang = SYMBOL_LANGUAGE (msymbol.minsym);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*funname = SYMBOL_PRINT_NAME (func);
|
*funname = xstrdup (SYMBOL_PRINT_NAME (func));
|
||||||
*funlang = SYMBOL_LANGUAGE (func);
|
*funlang = SYMBOL_LANGUAGE (func);
|
||||||
if (funcp)
|
if (funcp)
|
||||||
*funcp = func;
|
*funcp = func;
|
||||||
|
@ -1075,8 +1075,8 @@ find_frame_funname (struct frame_info *frame, const char **funname,
|
||||||
|
|
||||||
if (func_only)
|
if (func_only)
|
||||||
{
|
{
|
||||||
|
xfree (*funname);
|
||||||
*funname = func_only;
|
*funname = func_only;
|
||||||
make_cleanup (xfree, func_only);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1092,7 +1092,7 @@ find_frame_funname (struct frame_info *frame, const char **funname,
|
||||||
msymbol = lookup_minimal_symbol_by_pc (pc);
|
msymbol = lookup_minimal_symbol_by_pc (pc);
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
{
|
{
|
||||||
*funname = SYMBOL_PRINT_NAME (msymbol.minsym);
|
*funname = xstrdup (SYMBOL_PRINT_NAME (msymbol.minsym));
|
||||||
*funlang = SYMBOL_LANGUAGE (msymbol.minsym);
|
*funlang = SYMBOL_LANGUAGE (msymbol.minsym);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1105,7 +1105,7 @@ print_frame (struct frame_info *frame, int print_level,
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||||
struct ui_out *uiout = current_uiout;
|
struct ui_out *uiout = current_uiout;
|
||||||
const char *funname = NULL;
|
char *funname = NULL;
|
||||||
enum language funlang = language_unknown;
|
enum language funlang = language_unknown;
|
||||||
struct ui_file *stb;
|
struct ui_file *stb;
|
||||||
struct cleanup *old_chain, *list_chain;
|
struct cleanup *old_chain, *list_chain;
|
||||||
|
@ -1120,6 +1120,7 @@ print_frame (struct frame_info *frame, int print_level,
|
||||||
old_chain = make_cleanup_ui_file_delete (stb);
|
old_chain = make_cleanup_ui_file_delete (stb);
|
||||||
|
|
||||||
find_frame_funname (frame, &funname, &funlang, &func);
|
find_frame_funname (frame, &funname, &funlang, &func);
|
||||||
|
make_cleanup (xfree, funname);
|
||||||
|
|
||||||
annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
|
annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
|
||||||
gdbarch, pc);
|
gdbarch, pc);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
void select_frame_command (char *level_exp, int from_tty);
|
void select_frame_command (char *level_exp, int from_tty);
|
||||||
|
|
||||||
void find_frame_funname (struct frame_info *frame, const char **funname,
|
void find_frame_funname (struct frame_info *frame, char **funname,
|
||||||
enum language *funlang, struct symbol **funcp);
|
enum language *funlang, struct symbol **funcp);
|
||||||
|
|
||||||
typedef void (*iterate_over_block_arg_local_vars_cb) (const char *print_name,
|
typedef void (*iterate_over_block_arg_local_vars_cb) (const char *print_name,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue