+2013-05-30 Tom Tromey <tromey@redhat.com>
+
+ * cli/cli-cmds.c (cd_command, alias_command): Call do_cleanups.
+ * cli/cli-dump.c (restore_binary_file): Call do_cleanups.
+ * interps.c (interpreter_exec_cmd): Call do_cleanups.
+ * source.c (show_substitute_path_command): Call do_cleanups.
+ (unset_substitute_path_command, set_substitute_path_command):
+ Likewise.
+ * symfile.c (load_command): Call do_cleanups.
+
2013-05-30 Tom Tromey <tromey@redhat.com>
* contrib/cleanup_check.py: New file.
/* Found something other than leading repetitions of "/..". */
int found_real_path;
char *p;
+ struct cleanup *cleanup;
/* If the new directory is absolute, repeat is a no-op; if relative,
repeat might be useful but is more likely to be a mistake. */
dir = "~";
dir = tilde_expand (dir);
- make_cleanup (xfree, dir);
+ cleanup = make_cleanup (xfree, dir);
if (chdir (dir) < 0)
perror_with_name (dir);
if (from_tty)
pwd_command ((char *) 0, 1);
+
+ do_cleanups (cleanup);
}
\f
/* Show the current value of the 'script-extension' option. */
char *args2, *equals, *alias, *command;
char **alias_argv, **command_argv;
dyn_string_t alias_dyn_string, command_dyn_string;
+ struct cleanup *cleanup;
static const char usage[] = N_("Usage: alias [-a] [--] ALIAS = COMMAND");
if (args == NULL || strchr (args, '=') == NULL)
error (_(usage));
args2 = xstrdup (args);
- make_cleanup (xfree, args2);
+ cleanup = make_cleanup (xfree, args2);
equals = strchr (args2, '=');
*equals = '\0';
alias_argv = gdb_buildargv (args2);
command_argv[command_argc - 1],
class_alias, abbrev_flag, c_command->prefixlist);
}
+
+ do_cleanups (cleanup);
}
\f
/* Print a list of files and line numbers which a user may choose from
static void
restore_binary_file (char *filename, struct callback_data *data)
{
+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
FILE *file = fopen_with_cleanup (filename, FOPEN_RB);
gdb_byte *buf;
long len;
len = target_write_memory (data->load_start + data->load_offset, buf, len);
if (len != 0)
warning (_("restore: memory write failed (%s)."), safe_strerror (len));
- return;
+ do_cleanups (cleanup);
}
static void
unsigned int nrules;
unsigned int i;
int old_quiet, use_quiet;
+ struct cleanup *cleanup;
if (args == NULL)
error_no_arg (_("interpreter-exec command"));
prules = gdb_buildargv (args);
- make_cleanup_freeargv (prules);
+ cleanup = make_cleanup_freeargv (prules);
nrules = 0;
for (trule = prules; *trule != NULL; trule++)
interp_set (old_interp, 0);
interp_set_quiet (interp_to_use, use_quiet);
interp_set_quiet (old_interp, old_quiet);
+
+ do_cleanups (cleanup);
}
/* List the possible interpreters which could complete the given text. */
struct substitute_path_rule *rule = substitute_path_rules;
char **argv;
char *from = NULL;
+ struct cleanup *cleanup;
argv = gdb_buildargv (args);
- make_cleanup_freeargv (argv);
+ cleanup = make_cleanup_freeargv (argv);
/* We expect zero or one argument. */
printf_filtered (" `%s' -> `%s'.\n", rule->from, rule->to);
rule = rule->next;
}
+
+ do_cleanups (cleanup);
}
/* Implement the "unset substitute-path" command. */
char **argv = gdb_buildargv (args);
char *from = NULL;
int rule_found = 0;
+ struct cleanup *cleanup;
/* This function takes either 0 or 1 argument. */
- make_cleanup_freeargv (argv);
+ cleanup = make_cleanup_freeargv (argv);
if (argv != NULL && argv[0] != NULL && argv[1] != NULL)
error (_("Incorrect usage, too many arguments in command"));
error (_("No substitution rule defined for `%s'"), from);
forget_cached_source_info ();
+
+ do_cleanups (cleanup);
}
/* Add a new source path substitution rule. */
{
char **argv;
struct substitute_path_rule *rule;
+ struct cleanup *cleanup;
argv = gdb_buildargv (args);
- make_cleanup_freeargv (argv);
+ cleanup = make_cleanup_freeargv (argv);
if (argv == NULL || argv[0] == NULL || argv [1] == NULL)
error (_("Incorrect usage, too few arguments in command"));
add_substitute_path_rule (argv[0], argv[1]);
forget_cached_source_info ();
+
+ do_cleanups (cleanup);
}
\f
static void
load_command (char *arg, int from_tty)
{
+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
+
dont_repeat ();
/* The user might be reloading because the binary has changed. Take
/* After re-loading the executable, we don't really know which
overlays are mapped any more. */
overlay_cache_invalid = 1;
+
+ do_cleanups (cleanup);
}
/* This version of "load" should be usable for any target. Currently