aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/frame.h8
-rw-r--r--gdb/mi/mi-cmd-stack.c6
-rw-r--r--gdb/python/py-framefilter.c5
-rw-r--r--gdb/stack.c18
5 files changed, 22 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bacf5d7..04bb14e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+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.
diff --git a/gdb/frame.h b/gdb/frame.h
index fdb401d..09842c9 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -821,15 +821,15 @@ extern frame_print_options user_frame_print_options;
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
@@ -840,7 +840,7 @@ struct frame_arg
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,
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index e8f8d15..7a3ba47 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -533,7 +533,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
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
@@ -641,10 +641,8 @@ list_args_or_locals (const frame_print_options &fp_opts,
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;
@@ -669,8 +667,6 @@ list_args_or_locals (const frame_print_options &fp_opts,
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);
}
}
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index d805ec6..ecd633a 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -398,7 +398,7 @@ py_print_single_arg (struct ui_out *out,
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);
@@ -486,9 +486,6 @@ enumerate_args (PyObject *iter,
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. */
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;
}
}