aboutsummaryrefslogtreecommitdiff
path: root/gdb/symmisc.c
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2017-08-17 13:58:01 -0700
committerKeith Seitz <keiths@redhat.com>2017-08-17 13:58:01 -0700
commitb5f28d7abc02ca509e389fa932d725cf111e4b40 (patch)
tree57a0dc0feaff890630a6ba2c9fab811d56b1f9cf /gdb/symmisc.c
parent2a95a158fae932f758d75a1178a40d4cc4804ff0 (diff)
parent1a457753cfad05989574c671a221ffce2d5df703 (diff)
downloadbinutils-users/pmuldoon/c++compile.zip
binutils-users/pmuldoon/c++compile.tar.gz
binutils-users/pmuldoon/c++compile.tar.bz2
Problems: gdb/compile/compile.c gdb/cp-support.c gdb/cp-support.h gdb/gdbtypes.h gdb/language.c gdb/linespec.c
Diffstat (limited to 'gdb/symmisc.c')
-rw-r--r--gdb/symmisc.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 32a5331..c85f0b7 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -407,16 +407,13 @@ dump_symtab (struct symtab *symtab, struct ui_file *outfile)
static void
maintenance_print_symbols (char *args, int from_tty)
{
- char **argv;
struct ui_file *outfile = gdb_stdout;
- struct cleanup *cleanups;
char *address_arg = NULL, *source_arg = NULL, *objfile_arg = NULL;
int i, outfile_idx;
dont_repeat ();
- argv = gdb_buildargv (args);
- cleanups = make_cleanup_freeargv (argv);
+ gdb_argv argv (args);
for (i = 0; argv != NULL && argv[i] != NULL; ++i)
{
@@ -461,14 +458,12 @@ maintenance_print_symbols (char *args, int from_tty)
if (argv != NULL && argv[outfile_idx] != NULL)
{
- char *outfile_name;
-
if (argv[outfile_idx + 1] != NULL)
error (_("Junk at end of command"));
- outfile_name = tilde_expand (argv[outfile_idx]);
- make_cleanup (xfree, outfile_name);
- if (!arg_outfile.open (outfile_name, FOPEN_WT))
- perror_with_name (outfile_name);
+ gdb::unique_xmalloc_ptr<char> outfile_name
+ (tilde_expand (argv[outfile_idx]));
+ if (!arg_outfile.open (outfile_name.get (), FOPEN_WT))
+ perror_with_name (outfile_name.get ());
outfile = &arg_outfile;
}
@@ -520,8 +515,6 @@ maintenance_print_symbols (char *args, int from_tty)
if (source_arg != NULL && !found)
error (_("No symtab for source file: %s"), source_arg);
}
-
- do_cleanups (cleanups);
}
/* Print symbol ARGS->SYMBOL on ARGS->OUTFILE. ARGS->DEPTH says how
@@ -709,17 +702,14 @@ print_symbol (void *args)
static void
maintenance_print_msymbols (char *args, int from_tty)
{
- char **argv;
struct ui_file *outfile = gdb_stdout;
- struct cleanup *cleanups;
char *objfile_arg = NULL;
struct objfile *objfile;
int i, outfile_idx;
dont_repeat ();
- argv = gdb_buildargv (args);
- cleanups = make_cleanup_freeargv (argv);
+ gdb_argv argv (args);
for (i = 0; argv != NULL && argv[i] != NULL; ++i)
{
@@ -749,14 +739,12 @@ maintenance_print_msymbols (char *args, int from_tty)
if (argv != NULL && argv[outfile_idx] != NULL)
{
- char *outfile_name;
-
if (argv[outfile_idx + 1] != NULL)
error (_("Junk at end of command"));
- outfile_name = tilde_expand (argv[outfile_idx]);
- make_cleanup (xfree, outfile_name);
- if (!arg_outfile.open (outfile_name, FOPEN_WT))
- perror_with_name (outfile_name);
+ gdb::unique_xmalloc_ptr<char> outfile_name
+ (tilde_expand (argv[outfile_idx]));
+ if (!arg_outfile.open (outfile_name.get (), FOPEN_WT))
+ perror_with_name (outfile_name.get ());
outfile = &arg_outfile;
}
@@ -767,8 +755,6 @@ maintenance_print_msymbols (char *args, int from_tty)
|| compare_filenames_for_search (objfile_name (objfile), objfile_arg))
dump_msymbols (objfile, outfile);
}
-
- do_cleanups (cleanups);
}
static void
@@ -944,14 +930,11 @@ maintenance_expand_symtabs (char *args, int from_tty)
{
struct program_space *pspace;
struct objfile *objfile;
- struct cleanup *cleanups;
- char **argv;
char *regexp = NULL;
/* We use buildargv here so that we handle spaces in the regexp
in a way that allows adding more arguments later. */
- argv = gdb_buildargv (args);
- cleanups = make_cleanup_freeargv (argv);
+ gdb_argv argv (args);
if (argv != NULL)
{
@@ -988,8 +971,6 @@ maintenance_expand_symtabs (char *args, int from_tty)
ALL_DOMAIN);
}
}
-
- do_cleanups (cleanups);
}