aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-30 16:24:36 +0000
committerTom Tromey <tromey@redhat.com>2013-05-30 16:24:36 +0000
commit5b3fca71ae2013ecb997f9d71c3fc7dfdf69936d (patch)
tree18f8aa52e4b42f2ea624240679e698f6aef8d181 /gdb/source.c
parentaf83e3f886c6e098f997d6f03dcf5e807a14a4f2 (diff)
downloadgdb-5b3fca71ae2013ecb997f9d71c3fc7dfdf69936d.zip
gdb-5b3fca71ae2013ecb997f9d71c3fc7dfdf69936d.tar.gz
gdb-5b3fca71ae2013ecb997f9d71c3fc7dfdf69936d.tar.bz2
some cleanup checker fixes
Fix some bugs pointed out by the cleanup checker. This one just fixes some simple CLI reports, where CLI commands know that their caller will do cleanups. This an older style with few instances, so it is simpler to fix them up than to teach the checker about it. * 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.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/source.c b/gdb/source.c
index 710b90c..161a6c4 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1840,9 +1840,10 @@ show_substitute_path_command (char *args, int from_tty)
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. */
@@ -1866,6 +1867,8 @@ show_substitute_path_command (char *args, int from_tty)
printf_filtered (" `%s' -> `%s'.\n", rule->from, rule->to);
rule = rule->next;
}
+
+ do_cleanups (cleanup);
}
/* Implement the "unset substitute-path" command. */
@@ -1877,10 +1880,11 @@ unset_substitute_path_command (char *args, int from_tty)
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"));
@@ -1918,6 +1922,8 @@ unset_substitute_path_command (char *args, int from_tty)
error (_("No substitution rule defined for `%s'"), from);
forget_cached_source_info ();
+
+ do_cleanups (cleanup);
}
/* Add a new source path substitution rule. */
@@ -1927,9 +1933,10 @@ set_substitute_path_command (char *args, int from_tty)
{
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"));
@@ -1956,6 +1963,8 @@ set_substitute_path_command (char *args, int from_tty)
add_substitute_path_rule (argv[0], argv[1]);
forget_cached_source_info ();
+
+ do_cleanups (cleanup);
}