+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.
+
2019-08-07 Alan Hayward <alan.hayward@arm.com>
* NEWS: Expand the Pointer Authentication entry.
struct frame_arg
{
/* Symbol for this parameter used for example for its name. */
- struct symbol *sym;
+ struct symbol *sym = nullptr;
/* Value of the parameter. It is NULL if ERROR is not NULL; if both VAL and
ERROR are NULL this parameter's value should not be printed. */
- struct value *val;
+ struct value *val = nullptr;
/* String containing the error message, it is more usually NULL indicating no
error occured reading this parameter. */
- char *error;
+ gdb::unique_xmalloc_ptr<char> error;
/* One of the print_entry_values_* entries as appropriate specifically for
this frame_arg. It will be different from print_entry_values. With
value - print_entry_values_compact is not permitted fi ui_out_is_mi_like_p
(in such case print_entry_values_no and print_entry_values_only is used
for each parameter kind specifically. */
- const char *entry_kind;
+ const char *entry_kind = nullptr;
};
extern void read_frame_arg (const frame_print_options &fp_opts,
if (arg->val || arg->error)
{
if (arg->error)
- stb.printf (_("<error reading variable: %s>"), arg->error);
+ stb.printf (_("<error reading variable: %s>"), arg->error.get ());
else
{
try
sym2 = sym;
gdb_assert (sym2 != NULL);
- memset (&arg, 0, sizeof (arg));
arg.sym = sym2;
arg.entry_kind = print_entry_values_no;
- memset (&entryarg, 0, sizeof (entryarg));
entryarg.sym = sym2;
entryarg.entry_kind = print_entry_values_no;
list_arg_or_local (&arg, what, values, skip_unavailable);
if (entryarg.entry_kind != print_entry_values_no)
list_arg_or_local (&entryarg, what, values, skip_unavailable);
- xfree (arg.error);
- xfree (entryarg.error);
}
}
gdb_assert (fa != NULL && fa->error != NULL);
out->field_fmt ("value",
_("<error reading variable: %s>"),
- fa->error);
+ fa->error.get ());
}
else
py_print_value (out, val, opts, 0, args_type, language);
read_frame_arg (user_frame_print_options,
sym, frame, &arg, &entryarg);
- gdb::unique_xmalloc_ptr<char> arg_holder (arg.error);
- gdb::unique_xmalloc_ptr<char> entry_holder (entryarg.error);
-
/* The object has not provided a value, so this is a frame
argument to be read by GDB. In this case we have to
account for entry-values. */
else
{
if (arg->error)
- stb.printf (_("<error reading variable: %s>"), arg->error);
+ stb.printf (_("<error reading variable: %s>"), arg->error.get ());
else
{
try
}
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,
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
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
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;
}
print_frame_arg (fp_opts, &entryarg);
}
- xfree (arg.error);
- xfree (entryarg.error);
-
first = 0;
}
}