diff options
author | Tom Tromey <tom@tromey.com> | 2022-01-02 11:46:15 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-03-29 12:46:24 -0600 |
commit | 6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a (patch) | |
tree | 641a6a86240919fe4ba9219fbbbe15bc6331c22d /gdb/dwarf2 | |
parent | a11ac3b3e8ff6769badcf0041894f6c5acc1b94f (diff) | |
download | gdb-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/dwarf2')
-rw-r--r-- | gdb/dwarf2/frame.c | 6 | ||||
-rw-r--r-- | gdb/dwarf2/index-cache.c | 16 | ||||
-rw-r--r-- | gdb/dwarf2/line-header.c | 8 | ||||
-rw-r--r-- | gdb/dwarf2/loc.c | 230 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 204 |
5 files changed, 232 insertions, 232 deletions
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 1c58cfe..5878d72 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -2192,9 +2192,9 @@ show_dwarf_unwinders_enabled_p (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, - _("The DWARF stack unwinders are currently %s.\n"), - value); + gdb_printf (file, + _("The DWARF stack unwinders are currently %s.\n"), + value); } void _initialize_dwarf2_frame (); diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c index fd76917..db9a6eb 100644 --- a/gdb/dwarf2/index-cache.c +++ b/gdb/dwarf2/index-cache.c @@ -257,8 +257,8 @@ show_index_cache_command (const char *arg, int from_tty) /* Call all "show index-cache" subcommands. */ cmd_show_list (show_index_cache_prefix_list, from_tty); - printf_filtered ("\n"); - printf_filtered + gdb_printf ("\n"); + gdb_printf (_("The index cache is currently %s.\n"), global_index_cache.enabled () ? _("enabled") : _("disabled")); } @@ -288,7 +288,7 @@ static void show_index_cache_enabled_command (ui_file *stream, int from_tty, cmd_list_element *cmd, const char *value) { - fprintf_filtered (stream, _("The index cache is %s.\n"), value); + gdb_printf (stream, _("The index cache is %s.\n"), value); } /* "set index-cache directory" handler. */ @@ -316,13 +316,13 @@ show_index_cache_stats_command (const char *arg, int from_tty) if (in_show_index_cache_command) { indent = " "; - printf_filtered ("\n"); + gdb_printf ("\n"); } - printf_filtered (_("%s Cache hits (this session): %u\n"), - indent, global_index_cache.n_hits ()); - printf_filtered (_("%sCache misses (this session): %u\n"), - indent, global_index_cache.n_misses ()); + gdb_printf (_("%s Cache hits (this session): %u\n"), + indent, global_index_cache.n_hits ()); + gdb_printf (_("%sCache misses (this session): %u\n"), + indent, global_index_cache.n_misses ()); } void _initialize_index_cache (); diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c index 938e9fd..4807fca 100644 --- a/gdb/dwarf2/line-header.c +++ b/gdb/dwarf2/line-header.c @@ -35,8 +35,8 @@ line_header::add_include_dir (const char *include_dir) new_size = m_include_dirs.size (); else new_size = m_include_dirs.size () + 1; - fprintf_unfiltered (gdb_stdlog, "Adding dir %zu: %s\n", - new_size, include_dir); + gdb_printf (gdb_stdlog, "Adding dir %zu: %s\n", + new_size, include_dir); } m_include_dirs.push_back (include_dir); } @@ -54,8 +54,8 @@ line_header::add_file_name (const char *name, new_size = file_names_size (); else new_size = file_names_size () + 1; - fprintf_unfiltered (gdb_stdlog, "Adding file %zu: %s\n", - new_size, name); + gdb_printf (gdb_stdlog, "Adding file %zu: %s\n", + new_size, name); } m_file_names.emplace_back (name, d_index, mod_time, length); } diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 9cd2157..73de311 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -627,9 +627,9 @@ static void show_entry_values_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, - _("Entry values and tail call frames debugging is %s.\n"), - value); + gdb_printf (file, + _("Entry values and tail call frames debugging is %s.\n"), + value); } /* See gdbtypes.h. */ @@ -836,9 +836,9 @@ tailcall_dump (struct gdbarch *gdbarch, const struct call_site *call_site) CORE_ADDR addr = call_site->pc (); struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (addr - 1); - fprintf_unfiltered (gdb_stdlog, " %s(%s)", paddress (gdbarch, addr), - (msym.minsym == NULL ? "???" - : msym.minsym->print_name ())); + gdb_printf (gdb_stdlog, " %s(%s)", paddress (gdbarch, addr), + (msym.minsym == NULL ? "???" + : msym.minsym->print_name ())); } @@ -874,7 +874,7 @@ chain_candidate (struct gdbarch *gdbarch, if (entry_values_debug) { - fprintf_unfiltered (gdb_stdlog, "tailcall: initial:"); + gdb_printf (gdb_stdlog, "tailcall: initial:"); for (idx = 0; idx < length; idx++) tailcall_dump (gdbarch, result->call_site[idx]); gdb_putc ('\n', gdb_stdlog); @@ -885,7 +885,7 @@ chain_candidate (struct gdbarch *gdbarch, if (entry_values_debug) { - fprintf_unfiltered (gdb_stdlog, "tailcall: compare:"); + gdb_printf (gdb_stdlog, "tailcall: compare:"); for (idx = 0; idx < length; idx++) tailcall_dump (gdbarch, chain[idx]); gdb_putc ('\n', gdb_stdlog); @@ -914,7 +914,7 @@ chain_candidate (struct gdbarch *gdbarch, if (entry_values_debug) { - fprintf_unfiltered (gdb_stdlog, "tailcall: reduced:"); + gdb_printf (gdb_stdlog, "tailcall: reduced:"); for (idx = 0; idx < (*resultp)->callers; idx++) tailcall_dump (gdbarch, (*resultp)->call_site[idx]); gdb_puts (" |", gdb_stdlog); @@ -3144,8 +3144,8 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, if (data[0] >= DW_OP_reg0 && data[0] <= DW_OP_reg31) { - fprintf_filtered (stream, _("a variable in $%s"), - locexpr_regname (gdbarch, data[0] - DW_OP_reg0)); + gdb_printf (stream, _("a variable in $%s"), + locexpr_regname (gdbarch, data[0] - DW_OP_reg0)); data += 1; } else if (data[0] == DW_OP_regx) @@ -3153,8 +3153,8 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, uint64_t reg; data = safe_read_uleb128 (data + 1, end, ®); - fprintf_filtered (stream, _("a variable in $%s"), - locexpr_regname (gdbarch, reg)); + gdb_printf (stream, _("a variable in $%s"), + locexpr_regname (gdbarch, reg)); } else if (data[0] == DW_OP_fbreg) { @@ -3210,10 +3210,10 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, return save_data; } - fprintf_filtered (stream, - _("a variable at frame base reg $%s offset %s+%s"), - locexpr_regname (gdbarch, frame_reg), - plongest (base_offset), plongest (frame_offset)); + gdb_printf (stream, + _("a variable at frame base reg $%s offset %s+%s"), + locexpr_regname (gdbarch, frame_reg), + plongest (base_offset), plongest (frame_offset)); } else if (data[0] >= DW_OP_breg0 && data[0] <= DW_OP_breg31 && piece_end_p (data, end)) @@ -3222,10 +3222,10 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, data = safe_read_sleb128 (data + 1, end, &offset); - fprintf_filtered (stream, - _("a variable at offset %s from base reg $%s"), - plongest (offset), - locexpr_regname (gdbarch, data[0] - DW_OP_breg0)); + gdb_printf (stream, + _("a variable at offset %s from base reg $%s"), + plongest (offset), + locexpr_regname (gdbarch, data[0] - DW_OP_breg0)); } /* The location expression for a TLS variable looks like this (on a @@ -3254,10 +3254,10 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, offset = extract_unsigned_integer (data + 1, addr_size, gdbarch_byte_order (gdbarch)); - fprintf_filtered (stream, - _("a thread-local variable at offset 0x%s " - "in the thread-local storage for `%s'"), - phex_nz (offset, addr_size), objfile_name (objfile)); + gdb_printf (stream, + _("a thread-local variable at offset 0x%s " + "in the thread-local storage for `%s'"), + phex_nz (offset, addr_size), objfile_name (objfile)); data += 1 + addr_size + 1; } @@ -3278,10 +3278,10 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, data = safe_read_uleb128 (data + 1, end, &offset); offset = dwarf2_read_addr_index (per_cu, per_objfile, offset); - fprintf_filtered (stream, - _("a thread-local variable at offset 0x%s " - "in the thread-local storage for `%s'"), - phex_nz (offset, addr_size), objfile_name (objfile)); + gdb_printf (stream, + _("a thread-local variable at offset 0x%s " + "in the thread-local storage for `%s'"), + phex_nz (offset, addr_size), objfile_name (objfile)); ++data; } @@ -3290,7 +3290,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, && data + 1 < end && data[1] == DW_OP_stack_value) { - fprintf_filtered (stream, _("the constant %d"), data[0] - DW_OP_lit0); + gdb_printf (stream, _("the constant %d"), data[0] - DW_OP_lit0); data += 2; } @@ -3327,8 +3327,8 @@ disassemble_dwarf_expression (struct ui_file *stream, if (!name) error (_("Unrecognized DWARF opcode 0x%02x at %ld"), op, (long) (data - 1 - start)); - fprintf_filtered (stream, " %*ld: %s", indent + 4, - (long) (data - 1 - start), name); + gdb_printf (stream, " %*ld: %s", indent + 4, + (long) (data - 1 - start), name); switch (op) { @@ -3336,65 +3336,65 @@ disassemble_dwarf_expression (struct ui_file *stream, ul = extract_unsigned_integer (data, addr_size, gdbarch_byte_order (arch)); data += addr_size; - fprintf_filtered (stream, " 0x%s", phex_nz (ul, addr_size)); + gdb_printf (stream, " 0x%s", phex_nz (ul, addr_size)); break; case DW_OP_const1u: ul = extract_unsigned_integer (data, 1, gdbarch_byte_order (arch)); data += 1; - fprintf_filtered (stream, " %s", pulongest (ul)); + gdb_printf (stream, " %s", pulongest (ul)); break; case DW_OP_const1s: l = extract_signed_integer (data, 1, gdbarch_byte_order (arch)); data += 1; - fprintf_filtered (stream, " %s", plongest (l)); + gdb_printf (stream, " %s", plongest (l)); break; case DW_OP_const2u: ul = extract_unsigned_integer (data, 2, gdbarch_byte_order (arch)); data += 2; - fprintf_filtered (stream, " %s", pulongest (ul)); + gdb_printf (stream, " %s", pulongest (ul)); break; case DW_OP_const2s: l = extract_signed_integer (data, 2, gdbarch_byte_order (arch)); data += 2; - fprintf_filtered (stream, " %s", plongest (l)); + gdb_printf (stream, " %s", plongest (l)); break; case DW_OP_const4u: ul = extract_unsigned_integer (data, 4, gdbarch_byte_order (arch)); data += 4; - fprintf_filtered (stream, " %s", pulongest (ul)); + gdb_printf (stream, " %s", pulongest (ul)); break; case DW_OP_const4s: l = extract_signed_integer (data, 4, gdbarch_byte_order (arch)); data += 4; - fprintf_filtered (stream, " %s", plongest (l)); + gdb_printf (stream, " %s", plongest (l)); break; case DW_OP_const8u: ul = extract_unsigned_integer (data, 8, gdbarch_byte_order (arch)); data += 8; - fprintf_filtered (stream, " %s", pulongest (ul)); + gdb_printf (stream, " %s", pulongest (ul)); break; case DW_OP_const8s: l = extract_signed_integer (data, 8, gdbarch_byte_order (arch)); data += 8; - fprintf_filtered (stream, " %s", plongest (l)); + gdb_printf (stream, " %s", plongest (l)); break; case DW_OP_constu: data = safe_read_uleb128 (data, end, &ul); - fprintf_filtered (stream, " %s", pulongest (ul)); + gdb_printf (stream, " %s", pulongest (ul)); break; case DW_OP_consts: data = safe_read_sleb128 (data, end, &l); - fprintf_filtered (stream, " %s", plongest (l)); + gdb_printf (stream, " %s", plongest (l)); break; case DW_OP_reg0: @@ -3429,20 +3429,20 @@ disassemble_dwarf_expression (struct ui_file *stream, case DW_OP_reg29: case DW_OP_reg30: case DW_OP_reg31: - fprintf_filtered (stream, " [$%s]", - locexpr_regname (arch, op - DW_OP_reg0)); + gdb_printf (stream, " [$%s]", + locexpr_regname (arch, op - DW_OP_reg0)); break; case DW_OP_regx: data = safe_read_uleb128 (data, end, &ul); - fprintf_filtered (stream, " %s [$%s]", pulongest (ul), - locexpr_regname (arch, (int) ul)); + gdb_printf (stream, " %s [$%s]", pulongest (ul), + locexpr_regname (arch, (int) ul)); break; case DW_OP_implicit_value: data = safe_read_uleb128 (data, end, &ul); data += ul; - fprintf_filtered (stream, " %s", pulongest (ul)); + gdb_printf (stream, " %s", pulongest (ul)); break; case DW_OP_breg0: @@ -3478,72 +3478,72 @@ disassemble_dwarf_expression (struct ui_file *stream, case DW_OP_breg30: case DW_OP_breg31: data = safe_read_sleb128 (data, end, &l); - fprintf_filtered (stream, " %s [$%s]", plongest (l), - locexpr_regname (arch, op - DW_OP_breg0)); + gdb_printf (stream, " %s [$%s]", plongest (l), + locexpr_regname (arch, op - DW_OP_breg0)); break; case DW_OP_bregx: data = safe_read_uleb128 (data, end, &ul); data = safe_read_sleb128 (data, end, &l); - fprintf_filtered (stream, " register %s [$%s] offset %s", - pulongest (ul), - locexpr_regname (arch, (int) ul), - plongest (l)); + gdb_printf (stream, " register %s [$%s] offset %s", + pulongest (ul), + locexpr_regname (arch, (int) ul), + plongest (l)); break; case DW_OP_fbreg: data = safe_read_sleb128 (data, end, &l); - fprintf_filtered (stream, " %s", plongest (l)); + gdb_printf (stream, " %s", plongest (l)); break; case DW_OP_xderef_size: case DW_OP_deref_size: case DW_OP_pick: - fprintf_filtered (stream, " %d", *data); + gdb_printf (stream, " %d", *data); ++data; break; case DW_OP_plus_uconst: data = safe_read_uleb128 (data, end, &ul); - fprintf_filtered (stream, " %s", pulongest (ul)); + gdb_printf (stream, " %s", pulongest (ul)); break; case DW_OP_skip: l = extract_signed_integer (data, 2, gdbarch_byte_order (arch)); data += 2; - fprintf_filtered (stream, " to %ld", - (long) (data + l - start)); + gdb_printf (stream, " to %ld", + (long) (data + l - start)); break; case DW_OP_bra: l = extract_signed_integer (data, 2, gdbarch_byte_order (arch)); data += 2; - fprintf_filtered (stream, " %ld", - (long) (data + l - start)); + gdb_printf (stream, " %ld", + (long) (data + l - start)); break; case DW_OP_call2: ul = extract_unsigned_integer (data, 2, gdbarch_byte_order (arch)); data += 2; - fprintf_filtered (stream, " offset %s", phex_nz (ul, 2)); + gdb_printf (stream, " offset %s", phex_nz (ul, 2)); break; case DW_OP_call4: ul = extract_unsigned_integer (data, 4, gdbarch_byte_order (arch)); data += 4; - fprintf_filtered (stream, " offset %s", phex_nz (ul, 4)); + gdb_printf (stream, " offset %s", phex_nz (ul, 4)); break; case DW_OP_call_ref: ul = extract_unsigned_integer (data, offset_size, gdbarch_byte_order (arch)); data += offset_size; - fprintf_filtered (stream, " offset %s", phex_nz (ul, offset_size)); + gdb_printf (stream, " offset %s", phex_nz (ul, offset_size)); break; case DW_OP_piece: data = safe_read_uleb128 (data, end, &ul); - fprintf_filtered (stream, " %s (bytes)", pulongest (ul)); + gdb_printf (stream, " %s (bytes)", pulongest (ul)); break; case DW_OP_bit_piece: @@ -3552,8 +3552,8 @@ disassemble_dwarf_expression (struct ui_file *stream, data = safe_read_uleb128 (data, end, &ul); data = safe_read_uleb128 (data, end, &offset); - fprintf_filtered (stream, " size %s offset %s (bits)", - pulongest (ul), pulongest (offset)); + gdb_printf (stream, " size %s offset %s (bits)", + pulongest (ul), pulongest (offset)); } break; @@ -3566,9 +3566,9 @@ disassemble_dwarf_expression (struct ui_file *stream, data = safe_read_sleb128 (data, end, &l); - fprintf_filtered (stream, " DIE %s offset %s", - phex_nz (ul, offset_size), - plongest (l)); + gdb_printf (stream, " DIE %s offset %s", + phex_nz (ul, offset_size), + plongest (l)); } break; @@ -3581,11 +3581,11 @@ disassemble_dwarf_expression (struct ui_file *stream, data = safe_read_uleb128 (data, end, &ul); cu_offset offset = (cu_offset) ul; type = dwarf2_get_die_type (offset, per_cu, per_objfile); - fprintf_filtered (stream, "<"); + gdb_printf (stream, "<"); type_print (type, "", stream, -1); - fprintf_filtered (stream, " [0x%s]> %d", - phex_nz (to_underlying (offset), 0), - deref_addr_size); + gdb_printf (stream, " [0x%s]> %d", + phex_nz (to_underlying (offset), 0), + deref_addr_size); } break; @@ -3597,15 +3597,15 @@ disassemble_dwarf_expression (struct ui_file *stream, data = safe_read_uleb128 (data, end, &ul); cu_offset type_die = (cu_offset) ul; type = dwarf2_get_die_type (type_die, per_cu, per_objfile); - fprintf_filtered (stream, "<"); + gdb_printf (stream, "<"); type_print (type, "", stream, -1); - fprintf_filtered (stream, " [0x%s]>", - phex_nz (to_underlying (type_die), 0)); + gdb_printf (stream, " [0x%s]>", + phex_nz (to_underlying (type_die), 0)); int n = *data++; - fprintf_filtered (stream, " %d byte block:", n); + gdb_printf (stream, " %d byte block:", n); for (int i = 0; i < n; ++i) - fprintf_filtered (stream, " %02x", data[i]); + gdb_printf (stream, " %02x", data[i]); data += n; } break; @@ -3621,11 +3621,11 @@ disassemble_dwarf_expression (struct ui_file *stream, cu_offset type_die = (cu_offset) ul; type = dwarf2_get_die_type (type_die, per_cu, per_objfile); - fprintf_filtered (stream, "<"); + gdb_printf (stream, "<"); type_print (type, "", stream, -1); - fprintf_filtered (stream, " [0x%s]> [$%s]", - phex_nz (to_underlying (type_die), 0), - locexpr_regname (arch, reg)); + gdb_printf (stream, " [0x%s]> [$%s]", + phex_nz (to_underlying (type_die), 0), + locexpr_regname (arch, reg)); } break; @@ -3638,16 +3638,16 @@ disassemble_dwarf_expression (struct ui_file *stream, cu_offset type_die = (cu_offset) ul; if (to_underlying (type_die) == 0) - fprintf_filtered (stream, "<0>"); + gdb_printf (stream, "<0>"); else { struct type *type; type = dwarf2_get_die_type (type_die, per_cu, per_objfile); - fprintf_filtered (stream, "<"); + gdb_printf (stream, "<"); type_print (type, "", stream, -1); - fprintf_filtered (stream, " [0x%s]>", - phex_nz (to_underlying (type_die), 0)); + gdb_printf (stream, " [0x%s]>", + phex_nz (to_underlying (type_die), 0)); } } break; @@ -3665,31 +3665,31 @@ disassemble_dwarf_expression (struct ui_file *stream, case DW_OP_GNU_parameter_ref: ul = extract_unsigned_integer (data, 4, gdbarch_byte_order (arch)); data += 4; - fprintf_filtered (stream, " offset %s", phex_nz (ul, 4)); + gdb_printf (stream, " offset %s", phex_nz (ul, 4)); break; case DW_OP_addrx: case DW_OP_GNU_addr_index: data = safe_read_uleb128 (data, end, &ul); ul = dwarf2_read_addr_index (per_cu, per_objfile, ul); - fprintf_filtered (stream, " 0x%s", phex_nz (ul, addr_size)); + gdb_printf (stream, " 0x%s", phex_nz (ul, addr_size)); break; case DW_OP_GNU_const_index: data = safe_read_uleb128 (data, end, &ul); ul = dwarf2_read_addr_index (per_cu, per_objfile, ul); - fprintf_filtered (stream, " %s", pulongest (ul)); + gdb_printf (stream, " %s", pulongest (ul)); break; case DW_OP_GNU_variable_value: ul = extract_unsigned_integer (data, offset_size, gdbarch_byte_order (arch)); data += offset_size; - fprintf_filtered (stream, " offset %s", phex_nz (ul, offset_size)); + gdb_printf (stream, " offset %s", phex_nz (ul, offset_size)); break; } - fprintf_filtered (stream, "\n"); + gdb_printf (stream, "\n"); } return data; @@ -3701,10 +3701,10 @@ static void show_dwarf_always_disassemble (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, - _("Whether to always disassemble " - "DWARF expressions is %s.\n"), - value); + gdb_printf (file, + _("Whether to always disassemble " + "DWARF expressions is %s.\n"), + value); } /* Describe a single location, which may in turn consist of multiple @@ -3730,7 +3730,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, if (first_piece) first_piece = 0; else - fprintf_filtered (stream, _(", and ")); + gdb_printf (stream, _(", and ")); if (!dwarf_always_disassemble) { @@ -3746,7 +3746,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, } if (disassemble) { - fprintf_filtered (stream, _("a complex DWARF expression:\n")); + gdb_printf (stream, _("a complex DWARF expression:\n")); data = disassemble_dwarf_expression (stream, objfile->arch (), addr_size, offset_size, data, @@ -3760,7 +3760,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, int empty = data == here; if (disassemble) - fprintf_filtered (stream, " "); + gdb_printf (stream, " "); if (data[0] == DW_OP_piece) { uint64_t bytes; @@ -3768,11 +3768,11 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, data = safe_read_uleb128 (data + 1, end, &bytes); if (empty) - fprintf_filtered (stream, _("an empty %s-byte piece"), - pulongest (bytes)); + gdb_printf (stream, _("an empty %s-byte piece"), + pulongest (bytes)); else - fprintf_filtered (stream, _(" [%s-byte piece]"), - pulongest (bytes)); + gdb_printf (stream, _(" [%s-byte piece]"), + pulongest (bytes)); } else if (data[0] == DW_OP_bit_piece) { @@ -3782,13 +3782,13 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, data = safe_read_uleb128 (data, end, &offset); if (empty) - fprintf_filtered (stream, - _("an empty %s-bit piece"), - pulongest (bits)); + gdb_printf (stream, + _("an empty %s-bit piece"), + pulongest (bits)); else - fprintf_filtered (stream, - _(" [%s-bit piece, offset %s bits]"), - pulongest (bits), pulongest (offset)); + gdb_printf (stream, + _(" [%s-bit piece, offset %s bits]"), + pulongest (bits), pulongest (offset)); } else { @@ -3964,7 +3964,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, loc_ptr = dlbaton->data; buf_end = dlbaton->data + dlbaton->size; - fprintf_filtered (stream, _("multi-location:\n")); + gdb_printf (stream, _("multi-location:\n")); /* Iterate through locations until we run out. */ while (!done) @@ -3999,8 +3999,8 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, case DEBUG_LOC_BASE_ADDRESS: base_address = high; - fprintf_filtered (stream, _(" Base address %s"), - paddress (gdbarch, base_address)); + gdb_printf (stream, _(" Base address %s"), + paddress (gdbarch, base_address)); continue; case DEBUG_LOC_START_END: @@ -4043,15 +4043,15 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr, /* (It would improve readability to print only the minimum necessary digits of the second number of the range.) */ - fprintf_filtered (stream, _(" Range %s-%s: "), - paddress (gdbarch, low), paddress (gdbarch, high)); + gdb_printf (stream, _(" Range %s-%s: "), + paddress (gdbarch, low), paddress (gdbarch, high)); /* Now describe this particular location. */ locexpr_describe_location_1 (symbol, low, stream, loc_ptr, length, addr_size, offset_size, dlbaton->per_cu, dlbaton->per_objfile); - fprintf_filtered (stream, "\n"); + gdb_printf (stream, "\n"); loc_ptr += length; } diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 6fc9e37..5c02d56 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1090,9 +1090,9 @@ static void show_dwarf_max_cache_age (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, _("The upper bound on the age of cached " - "DWARF compilation units is %s.\n"), - value); + gdb_printf (file, _("The upper bound on the age of cached " + "DWARF compilation units is %s.\n"), + value); } /* local function prototypes */ @@ -3311,8 +3311,8 @@ dwarf2_base_index_functions::print_stats (struct objfile *objfile, if (!per_objfile->symtab_set_p (per_cu)) ++count; } - printf_filtered (_(" Number of read CUs: %d\n"), total - count); - printf_filtered (_(" Number of unread CUs: %d\n"), count); + gdb_printf (_(" Number of read CUs: %d\n"), total - count); + gdb_printf (_(" Number of unread CUs: %d\n"), count); } /* This dumps minimal information about the index. @@ -3326,15 +3326,15 @@ dwarf2_gdb_index::dump (struct objfile *objfile) dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); gdb_assert (per_objfile->per_bfd->using_index); - printf_filtered (".gdb_index:"); + gdb_printf (".gdb_index:"); if (per_objfile->per_bfd->index_table != NULL) { - printf_filtered (" version %d\n", - per_objfile->per_bfd->index_table->version); + gdb_printf (" version %d\n", + per_objfile->per_bfd->index_table->version); } else - printf_filtered (" faked for \"readnow\"\n"); - printf_filtered ("\n"); + gdb_printf (" faked for \"readnow\"\n"); + gdb_printf ("\n"); } void @@ -5334,12 +5334,12 @@ dwarf2_debug_names_index::dump (struct objfile *objfile) dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); gdb_assert (per_objfile->per_bfd->using_index); - printf_filtered (".debug_names:"); + gdb_printf (".debug_names:"); if (per_objfile->per_bfd->debug_names_table) - printf_filtered (" exists\n"); + gdb_printf (" exists\n"); else - printf_filtered (" faked for \"readnow\"\n"); - printf_filtered ("\n"); + gdb_printf (" faked for \"readnow\"\n"); + gdb_printf ("\n"); } void @@ -6390,11 +6390,11 @@ read_cutu_die_from_dwo (dwarf2_cu *cu, if (dwarf_die_debug) { - fprintf_unfiltered (gdb_stdlog, - "Read die from %s@0x%x of %s:\n", - section->get_name (), - (unsigned) (begin_info_ptr - section->buffer), - bfd_get_filename (abfd)); + gdb_printf (gdb_stdlog, + "Read die from %s@0x%x of %s:\n", + section->get_name (), + (unsigned) (begin_info_ptr - section->buffer), + bfd_get_filename (abfd)); dump_die (comp_unit_die, dwarf_die_debug); } @@ -6537,9 +6537,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu, int rereading_dwo_cu = 0; if (dwarf_die_debug) - fprintf_unfiltered (gdb_stdlog, "Reading %s unit at offset %s\n", - this_cu->is_debug_types ? "type" : "comp", - sect_offset_str (this_cu->sect_off)); + gdb_printf (gdb_stdlog, "Reading %s unit at offset %s\n", + this_cu->is_debug_types ? "type" : "comp", + sect_offset_str (this_cu->sect_off)); /* If we're reading a TU directly from a DWO file, including a virtual DWO file (instead of going through the stub), short-circuit all of this. */ @@ -6752,9 +6752,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu, const gdb_byte *begin_info_ptr, *info_ptr; if (dwarf_die_debug) - fprintf_unfiltered (gdb_stdlog, "Reading %s unit at offset %s\n", - this_cu->is_debug_types ? "type" : "comp", - sect_offset_str (this_cu->sect_off)); + gdb_printf (gdb_stdlog, "Reading %s unit at offset %s\n", + this_cu->is_debug_types ? "type" : "comp", + sect_offset_str (this_cu->sect_off)); gdb_assert (per_objfile->get_cu (this_cu) == nullptr); @@ -18860,11 +18860,11 @@ read_die_and_siblings (const struct die_reader_specs *reader, if (dwarf_die_debug) { - fprintf_unfiltered (gdb_stdlog, - "Read die from %s@0x%x of %s:\n", - reader->die_section->get_name (), - (unsigned) (info_ptr - reader->die_section->buffer), - bfd_get_filename (reader->abfd)); + gdb_printf (gdb_stdlog, + "Read die from %s@0x%x of %s:\n", + reader->die_section->get_name (), + (unsigned) (info_ptr - reader->die_section->buffer), + bfd_get_filename (reader->abfd)); dump_die (die, dwarf_die_debug); } @@ -18966,11 +18966,11 @@ read_full_die (const struct die_reader_specs *reader, if (dwarf_die_debug) { - fprintf_unfiltered (gdb_stdlog, - "Read die from %s@0x%x of %s:\n", - reader->die_section->get_name (), - (unsigned) (info_ptr - reader->die_section->buffer), - bfd_get_filename (reader->abfd)); + gdb_printf (gdb_stdlog, + "Read die from %s@0x%x of %s:\n", + reader->die_section->get_name (), + (unsigned) (info_ptr - reader->die_section->buffer), + bfd_get_filename (reader->abfd)); dump_die (*diep, dwarf_die_debug); } @@ -21131,10 +21131,10 @@ dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile, if (dwarf_line_debug) { - fprintf_unfiltered (gdb_stdlog, - "Recording line %u, file %s, address %s\n", - line, lbasename (subfile->name), - paddress (gdbarch, address)); + gdb_printf (gdb_stdlog, + "Recording line %u, file %s, address %s\n", + line, lbasename (subfile->name), + paddress (gdbarch, address)); } if (cu != nullptr) @@ -21155,10 +21155,10 @@ dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile, if (dwarf_line_debug) { - fprintf_unfiltered (gdb_stdlog, - "Finishing current line, file %s, address %s\n", - lbasename (subfile->name), - paddress (gdbarch, address)); + gdb_printf (gdb_stdlog, + "Finishing current line, file %s, address %s\n", + lbasename (subfile->name), + paddress (gdbarch, address)); } dwarf_record_line_1 (gdbarch, subfile, 0, address, true, cu); @@ -21169,13 +21169,13 @@ lnp_state_machine::record_line (bool end_sequence) { if (dwarf_line_debug) { - fprintf_unfiltered (gdb_stdlog, - "Processing actual line %u: file %u," - " address %s, is_stmt %u, discrim %u%s\n", - m_line, m_file, - paddress (m_gdbarch, m_address), - m_is_stmt, m_discriminator, - (end_sequence ? "\t(end sequence)" : "")); + gdb_printf (gdb_stdlog, + "Processing actual line %u: file %u," + " address %s, is_stmt %u, discrim %u%s\n", + m_line, m_file, + paddress (m_gdbarch, m_address), + m_is_stmt, m_discriminator, + (end_sequence ? "\t(end sequence)" : "")); } file_entry *fe = current_file (); @@ -23065,57 +23065,57 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) { unsigned int i; - fprintf_unfiltered (f, "%*sDie: %s (abbrev %d, offset %s)\n", - indent, "", - dwarf_tag_name (die->tag), die->abbrev, - sect_offset_str (die->sect_off)); + gdb_printf (f, "%*sDie: %s (abbrev %d, offset %s)\n", + indent, "", + dwarf_tag_name (die->tag), die->abbrev, + sect_offset_str (die->sect_off)); if (die->parent != NULL) - fprintf_unfiltered (f, "%*s parent at offset: %s\n", - indent, "", - sect_offset_str (die->parent->sect_off)); + gdb_printf (f, "%*s parent at offset: %s\n", + indent, "", + sect_offset_str (die->parent->sect_off)); - fprintf_unfiltered (f, "%*s has children: %s\n", - indent, "", - dwarf_bool_name (die->child != NULL)); + gdb_printf (f, "%*s has children: %s\n", + indent, "", + dwarf_bool_name (die->child != NULL)); - fprintf_unfiltered (f, "%*s attributes:\n", indent, ""); + gdb_printf (f, "%*s attributes:\n", indent, ""); for (i = 0; i < die->num_attrs; ++i) { - fprintf_unfiltered (f, "%*s %s (%s) ", - indent, "", - dwarf_attr_name (die->attrs[i].name), - dwarf_form_name (die->attrs[i].form)); + gdb_printf (f, "%*s %s (%s) ", + indent, "", + dwarf_attr_name (die->attrs[i].name), + dwarf_form_name (die->attrs[i].form)); switch (die->attrs[i].form) { case DW_FORM_addr: case DW_FORM_addrx: case DW_FORM_GNU_addr_index: - fprintf_unfiltered (f, "address: "); + gdb_printf (f, "address: "); gdb_puts (hex_string (die->attrs[i].as_address ()), f); break; case DW_FORM_block2: case DW_FORM_block4: case DW_FORM_block: case DW_FORM_block1: - fprintf_unfiltered (f, "block: size %s", - pulongest (die->attrs[i].as_block ()->size)); + gdb_printf (f, "block: size %s", + pulongest (die->attrs[i].as_block ()->size)); break; case DW_FORM_exprloc: - fprintf_unfiltered (f, "expression: size %s", - pulongest (die->attrs[i].as_block ()->size)); + gdb_printf (f, "expression: size %s", + pulongest (die->attrs[i].as_block ()->size)); break; case DW_FORM_data16: - fprintf_unfiltered (f, "constant of 16 bytes"); + gdb_printf (f, "constant of 16 bytes"); break; case DW_FORM_ref_addr: - fprintf_unfiltered (f, "ref address: "); + gdb_printf (f, "ref address: "); gdb_puts (hex_string (die->attrs[i].as_unsigned ()), f); break; case DW_FORM_GNU_ref_alt: - fprintf_unfiltered (f, "alt ref address: "); + gdb_printf (f, "alt ref address: "); gdb_puts (hex_string (die->attrs[i].as_unsigned ()), f); break; case DW_FORM_ref1: @@ -23123,24 +23123,24 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) case DW_FORM_ref4: case DW_FORM_ref8: case DW_FORM_ref_udata: - fprintf_unfiltered (f, "constant ref: 0x%lx (adjusted)", - (long) (die->attrs[i].as_unsigned ())); + gdb_printf (f, "constant ref: 0x%lx (adjusted)", + (long) (die->attrs[i].as_unsigned ())); break; case DW_FORM_data1: case DW_FORM_data2: case DW_FORM_data4: case DW_FORM_data8: case DW_FORM_udata: - fprintf_unfiltered (f, "constant: %s", - pulongest (die->attrs[i].as_unsigned ())); + gdb_printf (f, "constant: %s", + pulongest (die->attrs[i].as_unsigned ())); break; case DW_FORM_sec_offset: - fprintf_unfiltered (f, "section offset: %s", - pulongest (die->attrs[i].as_unsigned ())); + gdb_printf (f, "section offset: %s", + pulongest (die->attrs[i].as_unsigned ())); break; case DW_FORM_ref_sig8: - fprintf_unfiltered (f, "signature: %s", - hex_string (die->attrs[i].as_signature ())); + gdb_printf (f, "signature: %s", + hex_string (die->attrs[i].as_signature ())); break; case DW_FORM_string: case DW_FORM_strp: @@ -23148,37 +23148,37 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) case DW_FORM_strx: case DW_FORM_GNU_str_index: case DW_FORM_GNU_strp_alt: - fprintf_unfiltered (f, "string: \"%s\" (%s canonicalized)", - die->attrs[i].as_string () - ? die->attrs[i].as_string () : "", - die->attrs[i].canonical_string_p () ? "is" : "not"); + gdb_printf (f, "string: \"%s\" (%s canonicalized)", + die->attrs[i].as_string () + ? die->attrs[i].as_string () : "", + die->attrs[i].canonical_string_p () ? "is" : "not"); break; case DW_FORM_flag: if (die->attrs[i].as_boolean ()) - fprintf_unfiltered (f, "flag: TRUE"); + gdb_printf (f, "flag: TRUE"); else - fprintf_unfiltered (f, "flag: FALSE"); + gdb_printf (f, "flag: FALSE"); break; case DW_FORM_flag_present: - fprintf_unfiltered (f, "flag: TRUE"); + gdb_printf (f, "flag: TRUE"); break; case DW_FORM_indirect: /* The reader will have reduced the indirect form to the "base form" so this form should not occur. */ - fprintf_unfiltered (f, - "unexpected attribute form: DW_FORM_indirect"); + gdb_printf (f, + "unexpected attribute form: DW_FORM_indirect"); break; case DW_FORM_sdata: case DW_FORM_implicit_const: - fprintf_unfiltered (f, "constant: %s", - plongest (die->attrs[i].as_signed ())); + gdb_printf (f, "constant: %s", + plongest (die->attrs[i].as_signed ())); break; default: - fprintf_unfiltered (f, "unsupported attribute form: %d.", - die->attrs[i].form); + gdb_printf (f, "unsupported attribute form: %d.", + die->attrs[i].form); break; } - fprintf_unfiltered (f, "\n"); + gdb_printf (f, "\n"); } } @@ -23202,16 +23202,16 @@ dump_die_1 (struct ui_file *f, int level, int max_level, struct die_info *die) if (die->child != NULL) { - fprintf_unfiltered (f, "%*s Children:", indent, ""); + gdb_printf (f, "%*s Children:", indent, ""); if (level + 1 < max_level) { - fprintf_unfiltered (f, "\n"); + gdb_printf (f, "\n"); dump_die_1 (f, level + 1, max_level, die->child); } else { - fprintf_unfiltered (f, - " [not printed, max nesting level reached]\n"); + gdb_printf (f, + " [not printed, max nesting level reached]\n"); } } @@ -24942,9 +24942,9 @@ static void show_check_physname (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, - _("Whether to check \"physname\" is %s.\n"), - value); + gdb_printf (file, + _("Whether to check \"physname\" is %s.\n"), + value); } void _initialize_dwarf2_read (); |