* valops.c (find_overload_match): Call do_cleanups before early
return. * top.c (execute_command): Call do_cleanups before early return. (command_loop): Likewise. * stack.c (backtrace_command): Make a null cleanup early. Don't conditionally call do_cleanups. * python/py-value.c (TRY_CATCH): Move cleanup handling into TRY_CATCH. * python/py-breakpoint.c (gdbpy_breakpoint_has_py_cond): Rearrange so cleanups are always run. * mi/mi-cmd-var.c (mi_cmd_var_delete): Reset old_cleanups. * findcmd.c (parse_find_args): Call do_cleanups on early return path. * dbxread.c (elfstab_build_psymtabs): Make a null cleanup early. Don't conditionally call do_cleanups. * cli/cli-script.c (execute_user_command): Initialize 'old_chain' later.
This commit is contained in:
parent
57eb9b5086
commit
5fe41fbfa2
10 changed files with 46 additions and 23 deletions
|
@ -1,3 +1,23 @@
|
||||||
|
2011-06-27 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* valops.c (find_overload_match): Call do_cleanups before early
|
||||||
|
return.
|
||||||
|
* top.c (execute_command): Call do_cleanups before early return.
|
||||||
|
(command_loop): Likewise.
|
||||||
|
* stack.c (backtrace_command): Make a null cleanup early. Don't
|
||||||
|
conditionally call do_cleanups.
|
||||||
|
* python/py-value.c (TRY_CATCH): Move cleanup handling into
|
||||||
|
TRY_CATCH.
|
||||||
|
* python/py-breakpoint.c (gdbpy_breakpoint_has_py_cond): Rearrange
|
||||||
|
so cleanups are always run.
|
||||||
|
* mi/mi-cmd-var.c (mi_cmd_var_delete): Reset old_cleanups.
|
||||||
|
* findcmd.c (parse_find_args): Call do_cleanups on early return
|
||||||
|
path.
|
||||||
|
* dbxread.c (elfstab_build_psymtabs): Make a null cleanup early.
|
||||||
|
Don't conditionally call do_cleanups.
|
||||||
|
* cli/cli-script.c (execute_user_command): Initialize 'old_chain'
|
||||||
|
later.
|
||||||
|
|
||||||
2011-06-27 Eric Botcazou <ebotcazou@adacore.com>
|
2011-06-27 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
* MAINTAINERS (Write After Approval): Use default email address.
|
* MAINTAINERS (Write After Approval): Use default email address.
|
||||||
|
|
|
@ -317,13 +317,13 @@ execute_user_command (struct cmd_list_element *c, char *args)
|
||||||
static int user_call_depth = 0;
|
static int user_call_depth = 0;
|
||||||
extern int max_user_call_depth;
|
extern int max_user_call_depth;
|
||||||
|
|
||||||
old_chain = setup_user_args (args);
|
|
||||||
|
|
||||||
cmdlines = c->user_commands;
|
cmdlines = c->user_commands;
|
||||||
if (cmdlines == 0)
|
if (cmdlines == 0)
|
||||||
/* Null command */
|
/* Null command */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
old_chain = setup_user_args (args);
|
||||||
|
|
||||||
if (++user_call_depth > max_user_call_depth)
|
if (++user_call_depth > max_user_call_depth)
|
||||||
error (_("Max user call depth exceeded -- command aborted."));
|
error (_("Max user call depth exceeded -- command aborted."));
|
||||||
|
|
||||||
|
|
|
@ -3433,7 +3433,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
|
||||||
bfd *sym_bfd = objfile->obfd;
|
bfd *sym_bfd = objfile->obfd;
|
||||||
char *name = bfd_get_filename (sym_bfd);
|
char *name = bfd_get_filename (sym_bfd);
|
||||||
struct dbx_symfile_info *info;
|
struct dbx_symfile_info *info;
|
||||||
struct cleanup *back_to = NULL;
|
struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
|
||||||
|
|
||||||
/* There is already a dbx_symfile_info allocated by our caller.
|
/* There is already a dbx_symfile_info allocated by our caller.
|
||||||
It might even contain some info from the ELF symtab to help us. */
|
It might even contain some info from the ELF symtab to help us. */
|
||||||
|
@ -3477,7 +3477,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
|
||||||
symbuf_left = bfd_section_size (objfile->obfd, stabsect);
|
symbuf_left = bfd_section_size (objfile->obfd, stabsect);
|
||||||
stabs_data = symfile_relocate_debug_section (objfile, stabsect, NULL);
|
stabs_data = symfile_relocate_debug_section (objfile, stabsect, NULL);
|
||||||
if (stabs_data)
|
if (stabs_data)
|
||||||
back_to = make_cleanup (free_current_contents, (void *) &stabs_data);
|
make_cleanup (free_current_contents, (void *) &stabs_data);
|
||||||
|
|
||||||
/* In an elf file, we've already installed the minimal symbols that came
|
/* In an elf file, we've already installed the minimal symbols that came
|
||||||
from the elf (non-stab) symbol table, so always act like an
|
from the elf (non-stab) symbol table, so always act like an
|
||||||
|
@ -3487,7 +3487,6 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
|
||||||
case it does, it will install them itself. */
|
case it does, it will install them itself. */
|
||||||
dbx_symfile_read (objfile, 0);
|
dbx_symfile_read (objfile, 0);
|
||||||
|
|
||||||
if (back_to)
|
|
||||||
do_cleanups (back_to);
|
do_cleanups (back_to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
|
||||||
len = value_as_long (v);
|
len = value_as_long (v);
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
|
do_cleanups (old_cleanups);
|
||||||
printf_filtered (_("Empty search range.\n"));
|
printf_filtered (_("Empty search range.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ mi_cmd_var_delete (char *command, char **argv, int argc)
|
||||||
children_only_p = 1;
|
children_only_p = 1;
|
||||||
do_cleanups (old_cleanups);
|
do_cleanups (old_cleanups);
|
||||||
name = xstrdup (argv[1]);
|
name = xstrdup (argv[1]);
|
||||||
make_cleanup (free_current_contents, &name);
|
old_cleanups = make_cleanup (free_current_contents, &name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we didn't error out, now NAME contains the name of the
|
/* If we didn't error out, now NAME contains the name of the
|
||||||
|
|
|
@ -771,10 +771,9 @@ gdbpy_breakpoint_has_py_cond (struct breakpoint_object *bp_obj)
|
||||||
get_current_arch ();
|
get_current_arch ();
|
||||||
struct cleanup *cleanup = ensure_python_env (garch, current_language);
|
struct cleanup *cleanup = ensure_python_env (garch, current_language);
|
||||||
|
|
||||||
if (py_bp == NULL)
|
if (py_bp != NULL)
|
||||||
return 0;
|
|
||||||
|
|
||||||
has_func = PyObject_HasAttrString (py_bp, stop_func);
|
has_func = PyObject_HasAttrString (py_bp, stop_func);
|
||||||
|
|
||||||
do_cleanups (cleanup);
|
do_cleanups (cleanup);
|
||||||
|
|
||||||
return has_func;
|
return has_func;
|
||||||
|
|
|
@ -553,8 +553,6 @@ static PyObject *
|
||||||
valpy_str (PyObject *self)
|
valpy_str (PyObject *self)
|
||||||
{
|
{
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
struct ui_file *stb;
|
|
||||||
struct cleanup *old_chain;
|
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
struct value_print_options opts;
|
struct value_print_options opts;
|
||||||
volatile struct gdb_exception except;
|
volatile struct gdb_exception except;
|
||||||
|
@ -562,18 +560,18 @@ valpy_str (PyObject *self)
|
||||||
get_user_print_options (&opts);
|
get_user_print_options (&opts);
|
||||||
opts.deref_ref = 0;
|
opts.deref_ref = 0;
|
||||||
|
|
||||||
stb = mem_fileopen ();
|
|
||||||
old_chain = make_cleanup_ui_file_delete (stb);
|
|
||||||
|
|
||||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
struct ui_file *stb = mem_fileopen ();
|
||||||
|
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
|
||||||
|
|
||||||
common_val_print (((value_object *) self)->value, stb, 0,
|
common_val_print (((value_object *) self)->value, stb, 0,
|
||||||
&opts, python_language);
|
&opts, python_language);
|
||||||
s = ui_file_xstrdup (stb, NULL);
|
s = ui_file_xstrdup (stb, NULL);
|
||||||
}
|
|
||||||
GDB_PY_HANDLE_EXCEPTION (except);
|
|
||||||
|
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
|
}
|
||||||
|
GDB_PY_HANDLE_EXCEPTION (except);
|
||||||
|
|
||||||
result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
|
result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
|
||||||
xfree (s);
|
xfree (s);
|
||||||
|
|
|
@ -1425,7 +1425,7 @@ backtrace_command_stub (void *data)
|
||||||
static void
|
static void
|
||||||
backtrace_command (char *arg, int from_tty)
|
backtrace_command (char *arg, int from_tty)
|
||||||
{
|
{
|
||||||
struct cleanup *old_chain = NULL;
|
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
|
||||||
int fulltrace_arg = -1, arglen = 0, argc = 0;
|
int fulltrace_arg = -1, arglen = 0, argc = 0;
|
||||||
struct backtrace_command_args btargs;
|
struct backtrace_command_args btargs;
|
||||||
|
|
||||||
|
@ -1435,7 +1435,7 @@ backtrace_command (char *arg, int from_tty)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
argv = gdb_buildargv (arg);
|
argv = gdb_buildargv (arg);
|
||||||
old_chain = make_cleanup_freeargv (argv);
|
make_cleanup_freeargv (argv);
|
||||||
argc = 0;
|
argc = 0;
|
||||||
for (i = 0; argv[i]; i++)
|
for (i = 0; argv[i]; i++)
|
||||||
{
|
{
|
||||||
|
@ -1481,7 +1481,6 @@ backtrace_command (char *arg, int from_tty)
|
||||||
if (fulltrace_arg >= 0 && arglen > 0)
|
if (fulltrace_arg >= 0 && arglen > 0)
|
||||||
xfree (arg);
|
xfree (arg);
|
||||||
|
|
||||||
if (old_chain)
|
|
||||||
do_cleanups (old_chain);
|
do_cleanups (old_chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,10 @@ execute_command (char *p, int from_tty)
|
||||||
|
|
||||||
/* This can happen when command_line_input hits end of file. */
|
/* This can happen when command_line_input hits end of file. */
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
|
{
|
||||||
|
do_cleanups (cleanup);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
target_log_command (p);
|
target_log_command (p);
|
||||||
|
|
||||||
|
@ -542,7 +545,10 @@ command_loop (void)
|
||||||
get_prompt () : (char *) NULL,
|
get_prompt () : (char *) NULL,
|
||||||
instream == stdin, "prompt");
|
instream == stdin, "prompt");
|
||||||
if (command == 0)
|
if (command == 0)
|
||||||
|
{
|
||||||
|
do_cleanups (old_chain);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
make_command_stats_cleanup (1);
|
make_command_stats_cleanup (1);
|
||||||
|
|
||||||
|
|
|
@ -2670,6 +2670,7 @@ find_overload_match (struct type **arg_types, int nargs,
|
||||||
if (func_name == NULL)
|
if (func_name == NULL)
|
||||||
{
|
{
|
||||||
*symp = fsym;
|
*symp = fsym;
|
||||||
|
do_cleanups (all_cleanups);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue