summaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-30 16:24:35 +0000
committerTom Tromey <tromey@redhat.com>2013-05-30 16:24:35 +0000
commitfcf3be2b715c1defb0e199ac01be903d301372a8 (patch)
treedb6dc7106bda5c0dce6b8c278012b821f4fcc4c2 /gdb/source.c
parent0a35c53f8ae0814dddc3a45fc48564945c314a2c (diff)
downloadgdb-fcf3be2b715c1defb0e199ac01be903d301372a8.tar.gz
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 710b90c9eb9..161a6c43d02 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);
}