aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-02 11:46:15 -0700
committerTom Tromey <tom@tromey.com>2022-03-29 12:46:24 -0600
commit6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a (patch)
tree641a6a86240919fe4ba9219fbbbe15bc6331c22d /gdb/ada-valprint.c
parenta11ac3b3e8ff6769badcf0041894f6c5acc1b94f (diff)
downloadgdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.zip
gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.gz
gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.bz2
Unify gdb printf functions
Now that filtered and unfiltered output can be treated identically, we can unify the printf family of functions. This is done under the name "gdb_printf". Most of this patch was written by script.
Diffstat (limited to 'gdb/ada-valprint.c')
-rw-r--r--gdb/ada-valprint.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index f125a38..2db3111 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -106,7 +106,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type,
}
ada_print_scalar (index_type, low_bound, stream);
- fprintf_filtered (stream, " => ");
+ gdb_printf (stream, " => ");
return 1;
}
@@ -165,17 +165,17 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
{
if (options->prettyformat_arrays)
{
- fprintf_filtered (stream, ",\n");
+ gdb_printf (stream, ",\n");
print_spaces_filtered (2 + 2 * recurse, stream);
}
else
{
- fprintf_filtered (stream, ", ");
+ gdb_printf (stream, ", ");
}
}
else if (options->prettyformat_arrays)
{
- fprintf_filtered (stream, "\n");
+ gdb_printf (stream, "\n");
print_spaces_filtered (2 + 2 * recurse, stream);
}
stream->wrap_here (2 + 2 * recurse);
@@ -211,8 +211,8 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
opts.deref_ref = 0;
common_val_print (v0, stream, recurse + 1, &opts, current_language);
annotate_elt_rep (i - i0);
- fprintf_filtered (stream, _(" %p[<repeats %u times>%p]"),
- metadata_style.style ().ptr (), i - i0, nullptr);
+ gdb_printf (stream, _(" %p[<repeats %u times>%p]"),
+ metadata_style.style ().ptr (), i - i0, nullptr);
annotate_elt_rep_end ();
}
@@ -228,12 +228,12 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
{
if (options->prettyformat_arrays)
{
- fprintf_filtered (stream, ",\n");
+ gdb_printf (stream, ",\n");
print_spaces_filtered (2 + 2 * recurse, stream);
}
else
{
- fprintf_filtered (stream, ", ");
+ gdb_printf (stream, ", ");
}
stream->wrap_here (2 + 2 * recurse);
maybe_print_array_index (index_type, j + low,
@@ -249,7 +249,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
annotate_array_section_end ();
if (i < len)
{
- fprintf_filtered (stream, "...");
+ gdb_printf (stream, "...");
}
value_free_to_mark (mark);
@@ -272,15 +272,15 @@ ada_emit_char (int c, struct type *type, struct ui_file *stream,
if (c <= UCHAR_MAX && isascii (c) && isprint (c))
{
if (c == quoter && c == '"')
- fprintf_filtered (stream, "\"\"");
+ gdb_printf (stream, "\"\"");
else
- fprintf_filtered (stream, "%c", c);
+ gdb_printf (stream, "%c", c);
}
else
{
/* Follow GNAT's lead here and only use 6 digits for
wide_wide_character. */
- fprintf_filtered (stream, "[\"%0*x\"]", std::min (6, type_len * 2), c);
+ gdb_printf (stream, "[\"%0*x\"]", std::min (6, type_len * 2), c);
}
}
@@ -351,12 +351,12 @@ ada_print_floating (const gdb_byte *valaddr, struct type *type,
{
pos = s.find ('e');
if (pos == std::string::npos)
- fprintf_filtered (stream, "%s.0", s.c_str ());
+ gdb_printf (stream, "%s.0", s.c_str ());
else
- fprintf_filtered (stream, "%.*s.0%s", (int) pos, s.c_str (), &s[pos]);
+ gdb_printf (stream, "%.*s.0%s", (int) pos, s.c_str (), &s[pos]);
}
else
- fprintf_filtered (stream, "%s", &s[skip_count]);
+ gdb_printf (stream, "%s", &s[skip_count]);
}
void
@@ -417,7 +417,7 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
break;
case TYPE_CODE_BOOL:
- fprintf_filtered (stream, val ? "true" : "false");
+ gdb_printf (stream, val ? "true" : "false");
break;
case TYPE_CODE_RANGE:
@@ -507,8 +507,8 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
ada_emit_char (char_at (string, i, type_len, byte_order),
elttype, stream, '\'', type_len);
gdb_puts ("'", stream);
- fprintf_filtered (stream, _(" %p[<repeats %u times>%p]"),
- metadata_style.style ().ptr (), reps, nullptr);
+ gdb_printf (stream, _(" %p[<repeats %u times>%p]"),
+ metadata_style.style ().ptr (), reps, nullptr);
i = rep1 - 1;
things_printed += options->repeat_count_threshold;
need_comma = 1;
@@ -615,12 +615,12 @@ print_field_values (struct value *value, struct value *outer_value,
}
if (comma_needed)
- fprintf_filtered (stream, ", ");
+ gdb_printf (stream, ", ");
comma_needed = 1;
if (options->prettyformat)
{
- fprintf_filtered (stream, "\n");
+ gdb_printf (stream, "\n");
print_spaces_filtered (2 + 2 * recurse, stream);
}
else
@@ -629,9 +629,9 @@ print_field_values (struct value *value, struct value *outer_value,
}
annotate_field_begin (type->field (i).type ());
- fprintf_filtered (stream, "%.*s",
- ada_name_prefix_len (type->field (i).name ()),
- type->field (i).name ());
+ gdb_printf (stream, "%.*s",
+ ada_name_prefix_len (type->field (i).name ()),
+ type->field (i).name ());
annotate_field_name_end ();
gdb_puts (" => ", stream);
annotate_field_value ();
@@ -746,7 +746,7 @@ ada_value_print_ptr (struct value *val,
gdb::unique_xmalloc_ptr<char> name = ada_tag_name (val);
if (name != NULL)
- fprintf_filtered (stream, " (%s)", name.get ());
+ gdb_printf (stream, " (%s)", name.get ());
}
}
@@ -799,9 +799,9 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
CORE_ADDR addr = extract_typed_address (valaddr, ptr_type);
- fprintf_filtered (stream, "(");
+ gdb_printf (stream, "(");
type_print (type, "", stream, -1);
- fprintf_filtered (stream, ") ");
+ gdb_printf (stream, ") ");
gdb_puts (paddress (gdbarch, addr), stream);
}
else
@@ -855,9 +855,9 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
const char *name = ada_enum_name (type->field (i).name ());
if (name[0] == '\'')
- fprintf_filtered (stream, "%ld %ps", (long) val,
- styled_string (variable_name_style.style (),
- name));
+ gdb_printf (stream, "%ld %ps", (long) val,
+ styled_string (variable_name_style.style (),
+ name));
else
fputs_styled (name, variable_name_style.style (), stream);
}
@@ -876,21 +876,21 @@ ada_val_print_struct_union (struct value *value,
{
if (ada_is_bogus_array_descriptor (value_type (value)))
{
- fprintf_filtered (stream, "(...?)");
+ gdb_printf (stream, "(...?)");
return;
}
- fprintf_filtered (stream, "(");
+ gdb_printf (stream, "(");
if (print_field_values (value, value, stream, recurse, options,
0, language_def (language_ada)) != 0
&& options->prettyformat)
{
- fprintf_filtered (stream, "\n");
+ gdb_printf (stream, "\n");
print_spaces_filtered (2 * recurse, stream);
}
- fprintf_filtered (stream, ")");
+ gdb_printf (stream, ")");
}
/* Implement Ada value_print'ing for the case where TYPE is a
@@ -914,7 +914,7 @@ ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
return;
}
- fprintf_filtered (stream, "(");
+ gdb_printf (stream, "(");
print_optional_low_bound (stream, type, options);
if (value_entirely_optimized_out (val))
@@ -928,7 +928,7 @@ ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
}
else
value_print_array_elements (val, stream, recurse, options, 0);
- fprintf_filtered (stream, ")");
+ gdb_printf (stream, ")");
}
/* Implement Ada val_print'ing for the case where TYPE is
@@ -1010,7 +1010,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
if (val == nullptr)
{
gdb_assert (type->code () == TYPE_CODE_TYPEDEF);
- fprintf_filtered (stream, "0x0");
+ gdb_printf (stream, "0x0");
return;
}
}
@@ -1102,9 +1102,9 @@ ada_value_print (struct value *val0, struct ui_file *stream,
|| TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_INT
|| TYPE_TARGET_TYPE (type)->is_unsigned ())
{
- fprintf_filtered (stream, "(");
+ gdb_printf (stream, "(");
type_print (type, "", stream, -1);
- fprintf_filtered (stream, ") ");
+ gdb_printf (stream, ") ");
}
}
else if (ada_is_array_descriptor_type (type))
@@ -1114,16 +1114,16 @@ ada_value_print (struct value *val0, struct ui_file *stream,
a fat pointer - hence the check against TYPE_CODE_TYPEDEF). */
if (type->code () == TYPE_CODE_TYPEDEF)
{
- fprintf_filtered (stream, "(");
+ gdb_printf (stream, "(");
type_print (type, "", stream, -1);
- fprintf_filtered (stream, ") ");
+ gdb_printf (stream, ") ");
}
}
else if (ada_is_bogus_array_descriptor (type))
{
- fprintf_filtered (stream, "(");
+ gdb_printf (stream, "(");
type_print (type, "", stream, -1);
- fprintf_filtered (stream, ") (...?)");
+ gdb_printf (stream, ") (...?)");
return;
}