+ Errors are printed as if they would be the parameter value. Use
+ zeroed ARG iff it should not be printed according to VALUES. If
+ SKIP_UNAVAILABLE is true, only print ARG if it is available. */
+
+static void
+list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
+ enum print_values values, int skip_unavailable)
+{
+ struct ui_out *uiout = current_uiout;
+
+ gdb_assert (!arg->val || !arg->error);
+ gdb_assert ((values == PRINT_NO_VALUES && arg->val == NULL
+ && arg->error == NULL)
+ || values == PRINT_SIMPLE_VALUES
+ || (values == PRINT_ALL_VALUES
+ && (arg->val != NULL || arg->error != NULL)));
+ gdb_assert (arg->entry_kind == print_entry_values_no
+ || (arg->entry_kind == print_entry_values_only
+ && (arg->val || arg->error)));
+
+ if (skip_unavailable && arg->val != NULL
+ && (value_entirely_unavailable (arg->val)
+ /* A scalar object that does not have all bits available is
+ also considered unavailable, because all bits contribute
+ to its representation. */
+ || (val_print_scalar_type_p (value_type (arg->val))
+ && !value_bytes_available (arg->val,
+ value_embedded_offset (arg->val),
+ TYPE_LENGTH (value_type (arg->val))))))
+ return;
+
+ gdb::optional<ui_out_emit_tuple> tuple_emitter;
+ if (values != PRINT_NO_VALUES || what == all)
+ tuple_emitter.emplace (uiout, nullptr);
+
+ string_file stb;
+
+ stb.puts (arg->sym->print_name ());
+ if (arg->entry_kind == print_entry_values_only)
+ stb.puts ("@entry");
+ uiout->field_stream ("name", stb);
+
+ if (what == all && SYMBOL_IS_ARGUMENT (arg->sym))
+ uiout->field_signed ("arg", 1);
+
+ if (values == PRINT_SIMPLE_VALUES)
+ {
+ check_typedef (arg->sym->type);
+ type_print (arg->sym->type, "", &stb, -1);
+ uiout->field_stream ("type", stb);
+ }
+
+ if (arg->val || arg->error)
+ {
+ if (arg->error)
+ stb.printf (_("<error reading variable: %s>"), arg->error.get ());
+ else
+ {
+ try
+ {
+ struct value_print_options opts;
+
+ get_no_prettyformat_print_options (&opts);
+ opts.deref_ref = 1;
+ common_val_print (arg->val, &stb, 0, &opts,
+ language_def (arg->sym->language ()));
+ }
+ catch (const gdb_exception_error &except)
+ {
+ stb.printf (_("<error reading variable: %s>"),
+ except.what ());
+ }
+ }
+ uiout->field_stream ("value", stb);
+ }