aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-08-06 13:50:03 -0600
committerTom Tromey <tromey@adacore.com>2019-08-07 06:37:21 -0600
commit123cd851480c728845a4c3f85da772dd8331cf19 (patch)
tree1ecc475ebe4da5ade1fd9e0219bcaafd567f11ad /gdb/stack.c
parent3d31bc39e655ea39721754fa0ea539a8a0c9b26c (diff)
downloadgdb-123cd851480c728845a4c3f85da772dd8331cf19.zip
gdb-123cd851480c728845a4c3f85da772dd8331cf19.tar.gz
gdb-123cd851480c728845a4c3f85da772dd8331cf19.tar.bz2
Make struct frame_arg self-managing
This changes struct frame_arg to be self-managing and then fixes the various users. Tested by the buildbot. gdb/ChangeLog 2019-08-07 Tom Tromey <tromey@adacore.com> * stack.c (print_frame_arg, read_frame_local, read_frame_arg) (print_frame_args): Update. * python/py-framefilter.c (py_print_single_arg, enumerate_args): Update. * mi/mi-cmd-stack.c (list_arg_or_local): Update. * frame.h (struct frame_arg): Add initializers. <error>: Now a unique_xmalloc_ptr.
Diffstat (limited to 'gdb/stack.c')
-rw-r--r--gdb/stack.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index 0859815..49b9100 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -390,7 +390,7 @@ print_frame_arg (const frame_print_options &fp_opts,
else
{
if (arg->error)
- stb.printf (_("<error reading variable: %s>"), arg->error);
+ stb.printf (_("<error reading variable: %s>"), arg->error.get ());
else
{
try
@@ -452,13 +452,12 @@ read_frame_local (struct symbol *sym, struct frame_info *frame,
}
catch (const gdb_exception_error &except)
{
- argp->error = xstrdup (except.what ());
+ argp->error.reset (xstrdup (except.what ()));
}
}
-/* Read in inferior function parameter SYM at FRAME into ARGP. Caller is
- responsible for xfree of ARGP->ERROR. This function never throws an
- exception. */
+/* Read in inferior function parameter SYM at FRAME into ARGP. This
+ function never throws an exception. */
void
read_frame_arg (const frame_print_options &fp_opts,
@@ -626,7 +625,7 @@ read_frame_arg (const frame_print_options &fp_opts,
argp->sym = sym;
argp->val = val;
- argp->error = val_error ? xstrdup (val_error) : NULL;
+ argp->error.reset (val_error ? xstrdup (val_error) : NULL);
if (!val && !val_error)
argp->entry_kind = print_entry_values_only;
else if ((fp_opts.print_entry_values == print_entry_values_compact
@@ -641,7 +640,7 @@ read_frame_arg (const frame_print_options &fp_opts,
entryargp->sym = sym;
entryargp->val = entryval;
- entryargp->error = entryval_error ? xstrdup (entryval_error) : NULL;
+ entryargp->error.reset (entryval_error ? xstrdup (entryval_error) : NULL);
if (!entryval && !entryval_error)
entryargp->entry_kind = print_entry_values_no;
else
@@ -810,10 +809,8 @@ print_frame_args (const frame_print_options &fp_opts,
if (!print_args)
{
- memset (&arg, 0, sizeof (arg));
arg.sym = sym;
arg.entry_kind = print_entry_values_no;
- memset (&entryarg, 0, sizeof (entryarg));
entryarg.sym = sym;
entryarg.entry_kind = print_entry_values_no;
}
@@ -834,9 +831,6 @@ print_frame_args (const frame_print_options &fp_opts,
print_frame_arg (fp_opts, &entryarg);
}
- xfree (arg.error);
- xfree (entryarg.error);
-
first = 0;
}
}