diff options
author | Tom Tromey <tromey@adacore.com> | 2020-12-17 13:29:38 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-12-17 13:29:38 -0700 |
commit | 32f47895b5859c1f34abec75478ef55f2d92b023 (patch) | |
tree | cf6b98937829b3a3d5801feea8797c3d591aedef /gdb | |
parent | 85be4f5a8c8bec8d3163585a82e288a4dec08b07 (diff) | |
download | gdb-32f47895b5859c1f34abec75478ef55f2d92b023.zip gdb-32f47895b5859c1f34abec75478ef55f2d92b023.tar.gz gdb-32f47895b5859c1f34abec75478ef55f2d92b023.tar.bz2 |
Remove printfi_filtered and fprintfi_filtered
After seeing Simon's patch, I thought maybe it was finally time to
remove printfi_filtered and fprintfi_filtered, in favor of using the
"%*s" approach to indenting.
In this patch I took the straightforward approach of always adding a
leading "%*s", even when the format already started with "%s", to
avoid the trickier form of:
printf ("%*s", -indent, string)
Regression tested on x86-64 Fedora 32.
Let me know what you think.
gdb/ChangeLog
2020-12-17 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (print_args, dump_fn_fieldlists, print_cplus_stuff)
(print_gnat_stuff, print_fixed_point_type_info)
(recursive_dump_type): Update.
* go32-nat.c (go32_sysinfo, display_descriptor): Update.
* c-typeprint.c (c_type_print_base_struct_union)
(c_type_print_base_1): Update.
* rust-lang.c (rust_internal_print_type): Update.
* f-typeprint.c (f_language::f_type_print_base): Update.
* utils.h (fprintfi_filtered, printfi_filtered): Remove.
* m2-typeprint.c (m2_record_fields): Update.
* p-typeprint.c (pascal_type_print_base): Update.
* compile/compile-loc2c.c (push, pushf, unary, binary)
(do_compile_dwarf_expr_to_c): Update.
* utils.c (fprintfi_filtered, printfi_filtered): Remove.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 17 | ||||
-rw-r--r-- | gdb/c-typeprint.c | 30 | ||||
-rw-r--r-- | gdb/compile/compile-loc2c.c | 106 | ||||
-rw-r--r-- | gdb/f-typeprint.c | 28 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 160 | ||||
-rw-r--r-- | gdb/go32-nat.c | 14 | ||||
-rw-r--r-- | gdb/m2-typeprint.c | 2 | ||||
-rw-r--r-- | gdb/p-typeprint.c | 28 | ||||
-rw-r--r-- | gdb/rust-lang.c | 7 | ||||
-rw-r--r-- | gdb/utils.c | 30 | ||||
-rw-r--r-- | gdb/utils.h | 5 |
11 files changed, 212 insertions, 215 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8066c76..d1b9b38 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2020-12-17 Tom Tromey <tromey@adacore.com> + + * gdbtypes.c (print_args, dump_fn_fieldlists, print_cplus_stuff) + (print_gnat_stuff, print_fixed_point_type_info) + (recursive_dump_type): Update. + * go32-nat.c (go32_sysinfo, display_descriptor): Update. + * c-typeprint.c (c_type_print_base_struct_union) + (c_type_print_base_1): Update. + * rust-lang.c (rust_internal_print_type): Update. + * f-typeprint.c (f_language::f_type_print_base): Update. + * utils.h (fprintfi_filtered, printfi_filtered): Remove. + * m2-typeprint.c (m2_record_fields): Update. + * p-typeprint.c (pascal_type_print_base): Update. + * compile/compile-loc2c.c (push, pushf, unary, binary) + (do_compile_dwarf_expr_to_c): Update. + * utils.c (fprintfi_filtered, printfi_filtered): Remove. + 2020-12-16 Tom Tromey <tom@tromey.com> * rust-exp.y (rust_lex_tests): Update. diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 10631ff..b6f1eee 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1122,13 +1122,13 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, && TYPE_TYPEDEF_FIELD_COUNT (type) == 0) { if (type->is_stub ()) - fprintfi_filtered (level + 4, stream, - _("%p[<incomplete type>%p]\n"), - metadata_style.style ().ptr (), nullptr); + fprintf_filtered (stream, _("%*s%p[<incomplete type>%p]\n"), + level + 4, "", + metadata_style.style ().ptr (), nullptr); else - fprintfi_filtered (level + 4, stream, - _("%p[<no data fields>%p]\n"), - metadata_style.style ().ptr (), nullptr); + fprintf_filtered (stream, _("%*s%p[<no data fields>%p]\n"), + level + 4, "", + metadata_style.style ().ptr (), nullptr); } /* Start off with no specific section type, so we can print @@ -1439,7 +1439,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, print_spaces_filtered (2, stream); } - fprintfi_filtered (level, stream, "}"); + fprintf_filtered (stream, "%*s}", level, ""); } } @@ -1633,13 +1633,15 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, if (type->num_fields () == 0) { if (type->is_stub ()) - fprintfi_filtered (level + 4, stream, - _("%p[<incomplete type>%p]\n"), - metadata_style.style ().ptr (), nullptr); + fprintf_filtered (stream, + _("%*s%p[<incomplete type>%p]\n"), + level + 4, "", + metadata_style.style ().ptr (), nullptr); else - fprintfi_filtered (level + 4, stream, - _("%p[<no data fields>%p]\n"), - metadata_style.style ().ptr (), nullptr); + fprintf_filtered (stream, + _("%*s%p[<no data fields>%p]\n"), + level + 4, "", + metadata_style.style ().ptr (), nullptr); } len = type->num_fields (); for (i = 0; i < len; i++) @@ -1663,7 +1665,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream, } fprintf_filtered (stream, ";\n"); } - fprintfi_filtered (level, stream, "}"); + fprintf_filtered (stream, "%*s}", level, ""); } } break; diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c index 2fd1810..e88e733 100644 --- a/gdb/compile/compile-loc2c.c +++ b/gdb/compile/compile-loc2c.c @@ -434,9 +434,9 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size, static void push (int indent, string_file *stream, ULONGEST l) { - fprintfi_filtered (indent, stream, - "__gdb_stack[++__gdb_tos] = (" GCC_UINTPTR ") %s;\n", - hex_string (l)); + fprintf_filtered (stream, + "%*s__gdb_stack[++__gdb_tos] = (" GCC_UINTPTR ") %s;\n", + indent, "", hex_string (l)); } /* Emit code to push an arbitrary expression. This works like @@ -450,13 +450,13 @@ pushf (int indent, string_file *stream, const char *format, ...) { va_list args; - fprintfi_filtered (indent, stream, "__gdb_stack[__gdb_tos + 1] = "); + fprintf_filtered (stream, "%*s__gdb_stack[__gdb_tos + 1] = ", indent, ""); va_start (args, format); stream->vprintf (format, args); va_end (args); stream->puts (";\n"); - fprintfi_filtered (indent, stream, "++__gdb_tos;\n"); + fprintf_filtered (stream, "%*s++__gdb_tos;\n", indent, ""); } /* Emit code for a unary expression -- one which operates in-place on @@ -470,7 +470,7 @@ unary (int indent, string_file *stream, const char *format, ...) { va_list args; - fprintfi_filtered (indent, stream, "__gdb_stack[__gdb_tos] = "); + fprintf_filtered (stream, "%*s__gdb_stack[__gdb_tos] = ", indent, ""); va_start (args, format); stream->vprintf (format, args); va_end (args); @@ -487,12 +487,12 @@ binary (int indent, string_file *stream, const char *format, ...) { va_list args; - fprintfi_filtered (indent, stream, "__gdb_stack[__gdb_tos - 1] = "); + fprintf_filtered (stream, "%*s__gdb_stack[__gdb_tos - 1] = ", indent, ""); va_start (args, format); stream->vprintf (format, args); va_end (args); stream->puts (";\n"); - fprintfi_filtered (indent, stream, "--__gdb_tos;\n"); + fprintf_filtered (stream, "%*s--__gdb_tos;\n", indent, ""); } /* Print the name of a label given its "SCOPE", an arbitrary integer @@ -599,9 +599,9 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, ++scope; - fprintfi_filtered (indent, stream, "__attribute__ ((unused)) %s %s;\n", - type_name, result_name); - fprintfi_filtered (indent, stream, "{\n"); + fprintf_filtered (stream, "%*s__attribute__ ((unused)) %s %s;\n", + indent, "", type_name, result_name); + fprintf_filtered (stream, "%*s{\n", indent, ""); indent += 2; stack_depth = compute_stack_depth (byte_order, addr_size, @@ -637,19 +637,19 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, "compiled code."), sym->print_name ()); - fprintfi_filtered (indent, stream, "%s = %s;\n", - result_name, - core_addr_to_string (value_address (val))); - fprintfi_filtered (indent - 2, stream, "}\n"); + fprintf_filtered (stream, "%*s%s = %s;\n", + indent, "", result_name, + core_addr_to_string (value_address (val))); + fprintf_filtered (stream, "%*s}\n", indent - 2, ""); return; } - fprintfi_filtered (indent, stream, GCC_UINTPTR " __gdb_stack[%d];\n", - stack_depth); + fprintf_filtered (stream, "%*s" GCC_UINTPTR " __gdb_stack[%d];\n", + indent, "", stack_depth); if (need_tempvar) - fprintfi_filtered (indent, stream, GCC_UINTPTR " __gdb_tmp;\n"); - fprintfi_filtered (indent, stream, "int __gdb_tos = -1;\n"); + fprintf_filtered (stream, "%*s" GCC_UINTPTR " __gdb_tmp;\n", indent, ""); + fprintf_filtered (stream, "%*sint __gdb_tos = -1;\n", indent, ""); if (initial != NULL) pushf (indent, stream, "%s", core_addr_to_string (*initial)); @@ -908,7 +908,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, break; case DW_OP_drop: - fprintfi_filtered (indent, stream, "--__gdb_tos;\n"); + fprintf_filtered (stream, "%*s--__gdb_tos;\n", indent, ""); break; case DW_OP_pick: @@ -918,13 +918,16 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, break; case DW_OP_swap: - fprintfi_filtered (indent, stream, - "__gdb_tmp = __gdb_stack[__gdb_tos - 1];\n"); - fprintfi_filtered (indent, stream, - "__gdb_stack[__gdb_tos - 1] = " - "__gdb_stack[__gdb_tos];\n"); - fprintfi_filtered (indent, stream, ("__gdb_stack[__gdb_tos] = " - "__gdb_tmp;\n")); + fprintf_filtered (stream, + "%*s__gdb_tmp = __gdb_stack[__gdb_tos - 1];\n", + indent, ""); + fprintf_filtered (stream, + "%*s__gdb_stack[__gdb_tos - 1] = " + "__gdb_stack[__gdb_tos];\n", + indent, ""); + fprintf_filtered (stream, ("%*s__gdb_stack[__gdb_tos] = " + "__gdb_tmp;\n"), + indent, ""); break; case DW_OP_over: @@ -932,16 +935,20 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, break; case DW_OP_rot: - fprintfi_filtered (indent, stream, ("__gdb_tmp = " - "__gdb_stack[__gdb_tos];\n")); - fprintfi_filtered (indent, stream, - "__gdb_stack[__gdb_tos] = " - "__gdb_stack[__gdb_tos - 1];\n"); - fprintfi_filtered (indent, stream, - "__gdb_stack[__gdb_tos - 1] = " - "__gdb_stack[__gdb_tos -2];\n"); - fprintfi_filtered (indent, stream, "__gdb_stack[__gdb_tos - 2] = " - "__gdb_tmp;\n"); + fprintf_filtered (stream, ("%*s__gdb_tmp = " + "__gdb_stack[__gdb_tos];\n"), + indent, ""); + fprintf_filtered (stream, + "%*s__gdb_stack[__gdb_tos] = " + "__gdb_stack[__gdb_tos - 1];\n", + indent, ""); + fprintf_filtered (stream, + "%*s__gdb_stack[__gdb_tos - 1] = " + "__gdb_stack[__gdb_tos -2];\n", + indent, ""); + fprintf_filtered (stream, "%*s__gdb_stack[__gdb_tos - 2] = " + "__gdb_tmp;\n", + indent, ""); break; case DW_OP_deref: @@ -962,11 +969,11 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, /* Cast to a pointer of the desired type, then dereference. */ - fprintfi_filtered (indent, stream, - "__gdb_stack[__gdb_tos] = " - "*((__gdb_int_%s *) " - "__gdb_stack[__gdb_tos]);\n", - mode); + fprintf_filtered (stream, + "%*s__gdb_stack[__gdb_tos] = " + "*((__gdb_int_%s *) " + "__gdb_stack[__gdb_tos]);\n", + indent, "", mode); } break; @@ -1088,7 +1095,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, case DW_OP_skip: offset = extract_signed_integer (op_ptr, 2, byte_order); op_ptr += 2; - fprintfi_filtered (indent, stream, "goto "); + fprintf_filtered (stream, "%*sgoto ", indent, ""); print_label (stream, scope, op_ptr + offset - base); stream->puts (";\n"); break; @@ -1096,9 +1103,10 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, case DW_OP_bra: offset = extract_signed_integer (op_ptr, 2, byte_order); op_ptr += 2; - fprintfi_filtered (indent, stream, - "if ((( " GCC_INTPTR - ") __gdb_stack[__gdb_tos--]) != 0) goto "); + fprintf_filtered (stream, + "%*sif ((( " GCC_INTPTR + ") __gdb_stack[__gdb_tos--]) != 0) goto ", + indent, ""); print_label (stream, scope, op_ptr + offset - base); stream->puts (";\n"); break; @@ -1111,9 +1119,9 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, } } - fprintfi_filtered (indent, stream, "%s = __gdb_stack[__gdb_tos];\n", - result_name); - fprintfi_filtered (indent - 2, stream, "}\n"); + fprintf_filtered (stream, "%*s%s = __gdb_stack[__gdb_tos];\n", + indent, "", result_name); + fprintf_filtered (stream, "%*s}\n", indent - 2, ""); } /* See compile.h. */ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 28f5c88..048d3f7 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -307,7 +307,7 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, prefix = "Type, C_Union :: "; else if (type->code () == TYPE_CODE_STRUCT) prefix = "Type "; - fprintfi_filtered (level, stream, "%s%s", prefix, type->name ()); + fprintf_filtered (stream, "%*s%s%s", level, "", prefix, type->name ()); return; } @@ -331,12 +331,12 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, break; case TYPE_CODE_PTR: - fprintfi_filtered (level, stream, "PTR TO -> ( "); + fprintf_filtered (stream, "%*sPTR TO -> ( ", level, ""); f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0); break; case TYPE_CODE_REF: - fprintfi_filtered (level, stream, "REF TO -> ( "); + fprintf_filtered (stream, "%*sREF TO -> ( ", level, ""); f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0); break; @@ -344,21 +344,21 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, { gdbarch *gdbarch = get_type_arch (type); struct type *void_type = builtin_f_type (gdbarch)->builtin_void; - fprintfi_filtered (level, stream, "%s", void_type->name ()); + fprintf_filtered (stream, "%*s%s", level, "", void_type->name ()); } break; case TYPE_CODE_UNDEF: - fprintfi_filtered (level, stream, "struct <unknown>"); + fprintf_filtered (stream, "%*sstruct <unknown>", level, ""); break; case TYPE_CODE_ERROR: - fprintfi_filtered (level, stream, "%s", TYPE_ERROR_NAME (type)); + fprintf_filtered (stream, "%*s%s", level, "", TYPE_ERROR_NAME (type)); break; case TYPE_CODE_RANGE: /* This should not occur. */ - fprintfi_filtered (level, stream, "<range type>"); + fprintf_filtered (stream, "%*s<range type>", level, ""); break; case TYPE_CODE_CHAR: @@ -368,7 +368,7 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, C-oriented, we must change these to "character" from "char". */ if (strcmp (type->name (), "char") == 0) - fprintfi_filtered (level, stream, "character"); + fprintf_filtered (stream, "%*scharacter", level, ""); else goto default_case; break; @@ -387,15 +387,15 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, fprintf_filtered (stream, "character*%s", pulongest (upper_bound)); } else - fprintfi_filtered (level, stream, "character*(*)"); + fprintf_filtered (stream, "%*scharacter*(*)", level, ""); break; case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: if (type->code () == TYPE_CODE_UNION) - fprintfi_filtered (level, stream, "Type, C_Union :: "); + fprintf_filtered (stream, "%*sType, C_Union :: ", level, ""); else - fprintfi_filtered (level, stream, "Type "); + fprintf_filtered (stream, "%*sType ", level, ""); fputs_filtered (type->name (), stream); /* According to the definition, we only print structure elements in case show > 0. */ @@ -413,13 +413,13 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, stream, show - 1, 0, 0, 0, false); fputs_filtered ("\n", stream); } - fprintfi_filtered (level, stream, "End Type "); + fprintf_filtered (stream, "%*sEnd Type ", level, ""); fputs_filtered (type->name (), stream); } break; case TYPE_CODE_MODULE: - fprintfi_filtered (level, stream, "module %s", type->name ()); + fprintf_filtered (stream, "%*smodule %s", level, "", type->name ()); break; default_case: @@ -429,7 +429,7 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream, the type name is, as recorded in the type itself. If there is no type name, then complain. */ if (type->name () != NULL) - fprintfi_filtered (level, stream, "%s", type->name ()); + fprintf_filtered (stream, "%*s%s", level, "", type->name ()); else error (_("Invalid type code (%d) in symbol table."), type->code ()); break; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 5de5bd5..4305832 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -4829,8 +4829,8 @@ print_args (struct field *args, int nargs, int spaces) for (i = 0; i < nargs; i++) { - printfi_filtered (spaces, "[%d] name '%s'\n", i, - args[i].name != NULL ? args[i].name : "<NULL>"); + printf_filtered ("%*s[%d] name '%s'\n", spaces, "", i, + args[i].name != NULL ? args[i].name : "<NULL>"); recursive_dump_type (args[i].type (), spaces + 2); } } @@ -4855,15 +4855,15 @@ dump_fn_fieldlists (struct type *type, int spaces) int overload_idx; struct fn_field *f; - printfi_filtered (spaces, "fn_fieldlists "); + printf_filtered ("%*sfn_fieldlists ", spaces, ""); gdb_print_host_address (TYPE_FN_FIELDLISTS (type), gdb_stdout); printf_filtered ("\n"); for (method_idx = 0; method_idx < TYPE_NFN_FIELDS (type); method_idx++) { f = TYPE_FN_FIELDLIST1 (type, method_idx); - printfi_filtered (spaces + 2, "[%d] name '%s' (", - method_idx, - TYPE_FN_FIELDLIST_NAME (type, method_idx)); + printf_filtered ("%*s[%d] name '%s' (", spaces + 2, "", + method_idx, + TYPE_FN_FIELDLIST_NAME (type, method_idx)); gdb_print_host_address (TYPE_FN_FIELDLIST_NAME (type, method_idx), gdb_stdout); printf_filtered (_(") length %d\n"), @@ -4872,13 +4872,13 @@ dump_fn_fieldlists (struct type *type, int spaces) overload_idx < TYPE_FN_FIELDLIST_LENGTH (type, method_idx); overload_idx++) { - printfi_filtered (spaces + 4, "[%d] physname '%s' (", - overload_idx, - TYPE_FN_FIELD_PHYSNAME (f, overload_idx)); + printf_filtered ("%*s[%d] physname '%s' (", + spaces + 4, "", overload_idx, + TYPE_FN_FIELD_PHYSNAME (f, overload_idx)); gdb_print_host_address (TYPE_FN_FIELD_PHYSNAME (f, overload_idx), gdb_stdout); printf_filtered (")\n"); - printfi_filtered (spaces + 8, "type "); + printf_filtered ("%*stype ", spaces + 8, ""); gdb_print_host_address (TYPE_FN_FIELD_TYPE (f, overload_idx), gdb_stdout); printf_filtered ("\n"); @@ -4886,34 +4886,34 @@ dump_fn_fieldlists (struct type *type, int spaces) recursive_dump_type (TYPE_FN_FIELD_TYPE (f, overload_idx), spaces + 8 + 2); - printfi_filtered (spaces + 8, "args "); + printf_filtered ("%*sargs ", spaces + 8, ""); gdb_print_host_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout); printf_filtered ("\n"); print_args (TYPE_FN_FIELD_ARGS (f, overload_idx), TYPE_FN_FIELD_TYPE (f, overload_idx)->num_fields (), spaces + 8 + 2); - printfi_filtered (spaces + 8, "fcontext "); + printf_filtered ("%*sfcontext ", spaces + 8, ""); gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx), gdb_stdout); printf_filtered ("\n"); - printfi_filtered (spaces + 8, "is_const %d\n", - TYPE_FN_FIELD_CONST (f, overload_idx)); - printfi_filtered (spaces + 8, "is_volatile %d\n", - TYPE_FN_FIELD_VOLATILE (f, overload_idx)); - printfi_filtered (spaces + 8, "is_private %d\n", - TYPE_FN_FIELD_PRIVATE (f, overload_idx)); - printfi_filtered (spaces + 8, "is_protected %d\n", - TYPE_FN_FIELD_PROTECTED (f, overload_idx)); - printfi_filtered (spaces + 8, "is_stub %d\n", - TYPE_FN_FIELD_STUB (f, overload_idx)); - printfi_filtered (spaces + 8, "defaulted %d\n", - TYPE_FN_FIELD_DEFAULTED (f, overload_idx)); - printfi_filtered (spaces + 8, "is_deleted %d\n", - TYPE_FN_FIELD_DELETED (f, overload_idx)); - printfi_filtered (spaces + 8, "voffset %u\n", - TYPE_FN_FIELD_VOFFSET (f, overload_idx)); + printf_filtered ("%*sis_const %d\n", spaces + 8, "", + TYPE_FN_FIELD_CONST (f, overload_idx)); + printf_filtered ("%*sis_volatile %d\n", spaces + 8, "", + TYPE_FN_FIELD_VOLATILE (f, overload_idx)); + printf_filtered ("%*sis_private %d\n", spaces + 8, "", + TYPE_FN_FIELD_PRIVATE (f, overload_idx)); + printf_filtered ("%*sis_protected %d\n", spaces + 8, "", + TYPE_FN_FIELD_PROTECTED (f, overload_idx)); + printf_filtered ("%*sis_stub %d\n", spaces + 8, "", + TYPE_FN_FIELD_STUB (f, overload_idx)); + printf_filtered ("%*sdefaulted %d\n", spaces + 8, "", + TYPE_FN_FIELD_DEFAULTED (f, overload_idx)); + printf_filtered ("%*sis_deleted %d\n", spaces + 8, "", + TYPE_FN_FIELD_DELETED (f, overload_idx)); + printf_filtered ("%*svoffset %u\n", spaces + 8, "", + TYPE_FN_FIELD_VOFFSET (f, overload_idx)); } } } @@ -4921,21 +4921,22 @@ dump_fn_fieldlists (struct type *type, int spaces) static void print_cplus_stuff (struct type *type, int spaces) { - printfi_filtered (spaces, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type)); - printfi_filtered (spaces, "vptr_basetype "); + printf_filtered ("%*svptr_fieldno %d\n", spaces, "", + TYPE_VPTR_FIELDNO (type)); + printf_filtered ("%*svptr_basetype ", spaces, ""); gdb_print_host_address (TYPE_VPTR_BASETYPE (type), gdb_stdout); puts_filtered ("\n"); if (TYPE_VPTR_BASETYPE (type) != NULL) recursive_dump_type (TYPE_VPTR_BASETYPE (type), spaces + 2); - printfi_filtered (spaces, "n_baseclasses %d\n", - TYPE_N_BASECLASSES (type)); - printfi_filtered (spaces, "nfn_fields %d\n", - TYPE_NFN_FIELDS (type)); + printf_filtered ("%*sn_baseclasses %d\n", spaces, "", + TYPE_N_BASECLASSES (type)); + printf_filtered ("%*snfn_fields %d\n", spaces, "", + TYPE_NFN_FIELDS (type)); if (TYPE_N_BASECLASSES (type) > 0) { - printfi_filtered (spaces, "virtual_field_bits (%d bits at *", - TYPE_N_BASECLASSES (type)); + printf_filtered ("%*svirtual_field_bits (%d bits at *", + spaces, "", TYPE_N_BASECLASSES (type)); gdb_print_host_address (TYPE_FIELD_VIRTUAL_BITS (type), gdb_stdout); printf_filtered (")"); @@ -4948,9 +4949,8 @@ print_cplus_stuff (struct type *type, int spaces) { if (TYPE_FIELD_PRIVATE_BITS (type) != NULL) { - printfi_filtered (spaces, - "private_field_bits (%d bits at *", - type->num_fields ()); + printf_filtered ("%*sprivate_field_bits (%d bits at *", + spaces, "", type->num_fields ()); gdb_print_host_address (TYPE_FIELD_PRIVATE_BITS (type), gdb_stdout); printf_filtered (")"); @@ -4960,9 +4960,8 @@ print_cplus_stuff (struct type *type, int spaces) } if (TYPE_FIELD_PROTECTED_BITS (type) != NULL) { - printfi_filtered (spaces, - "protected_field_bits (%d bits at *", - type->num_fields ()); + printf_filtered ("%*sprotected_field_bits (%d bits at *", + spaces, "", type->num_fields ()); gdb_print_host_address (TYPE_FIELD_PROTECTED_BITS (type), gdb_stdout); printf_filtered (")"); @@ -4976,8 +4975,8 @@ print_cplus_stuff (struct type *type, int spaces) dump_fn_fieldlists (type, spaces); } - printfi_filtered (spaces, "calling_convention %d\n", - TYPE_CPLUS_CALLING_CONVENTION (type)); + printf_filtered ("%*scalling_convention %d\n", spaces, "", + TYPE_CPLUS_CALLING_CONVENTION (type)); } /* Print the contents of the TYPE's type_specific union, assuming that @@ -4989,10 +4988,10 @@ print_gnat_stuff (struct type *type, int spaces) struct type *descriptive_type = TYPE_DESCRIPTIVE_TYPE (type); if (descriptive_type == NULL) - printfi_filtered (spaces + 2, "no descriptive type\n"); + printf_filtered ("%*sno descriptive type\n", spaces + 2, ""); else { - printfi_filtered (spaces + 2, "descriptive type\n"); + printf_filtered ("%*sdescriptive type\n", spaces + 2, ""); recursive_dump_type (descriptive_type, spaces + 4); } } @@ -5003,8 +5002,8 @@ print_gnat_stuff (struct type *type, int spaces) static void print_fixed_point_type_info (struct type *type, int spaces) { - printfi_filtered (spaces + 2, "scaling factor: %s\n", - type->fixed_point_scaling_factor ().str ().c_str ()); + printf_filtered ("%*sscaling factor: %s\n", spaces + 2, "", + type->fixed_point_scaling_factor ().str ().c_str ()); } static struct obstack dont_print_type_obstack; @@ -5053,7 +5052,7 @@ recursive_dump_type (struct type *type, int spaces) { if (type == first_dont_print[i]) { - printfi_filtered (spaces, "type node "); + printf_filtered ("%*stype node ", spaces, ""); gdb_print_host_address (type, gdb_stdout); printf_filtered (_(" <same as already seen type>\n")); return; @@ -5063,14 +5062,14 @@ recursive_dump_type (struct type *type, int spaces) obstack_ptr_grow (&dont_print_type_obstack, type); } - printfi_filtered (spaces, "type node "); + printf_filtered ("%*stype node ", spaces, ""); gdb_print_host_address (type, gdb_stdout); printf_filtered ("\n"); - printfi_filtered (spaces, "name '%s' (", - type->name () ? type->name () : "<NULL>"); + printf_filtered ("%*sname '%s' (", spaces, "", + type->name () ? type->name () : "<NULL>"); gdb_print_host_address (type->name (), gdb_stdout); printf_filtered (")\n"); - printfi_filtered (spaces, "code 0x%x ", type->code ()); + printf_filtered ("%*scode 0x%x ", spaces, "", type->code ()); switch (type->code ()) { case TYPE_CODE_UNDEF: @@ -5153,36 +5152,37 @@ recursive_dump_type (struct type *type, int spaces) break; } puts_filtered ("\n"); - printfi_filtered (spaces, "length %s\n", pulongest (TYPE_LENGTH (type))); + printf_filtered ("%*slength %s\n", spaces, "", + pulongest (TYPE_LENGTH (type))); if (TYPE_OBJFILE_OWNED (type)) { - printfi_filtered (spaces, "objfile "); + printf_filtered ("%*sobjfile ", spaces, ""); gdb_print_host_address (TYPE_OWNER (type).objfile, gdb_stdout); } else { - printfi_filtered (spaces, "gdbarch "); + printf_filtered ("%*sgdbarch ", spaces, ""); gdb_print_host_address (TYPE_OWNER (type).gdbarch, gdb_stdout); } printf_filtered ("\n"); - printfi_filtered (spaces, "target_type "); + printf_filtered ("%*starget_type ", spaces, ""); gdb_print_host_address (TYPE_TARGET_TYPE (type), gdb_stdout); printf_filtered ("\n"); if (TYPE_TARGET_TYPE (type) != NULL) { recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2); } - printfi_filtered (spaces, "pointer_type "); + printf_filtered ("%*spointer_type ", spaces, ""); gdb_print_host_address (TYPE_POINTER_TYPE (type), gdb_stdout); printf_filtered ("\n"); - printfi_filtered (spaces, "reference_type "); + printf_filtered ("%*sreference_type ", spaces, ""); gdb_print_host_address (TYPE_REFERENCE_TYPE (type), gdb_stdout); printf_filtered ("\n"); - printfi_filtered (spaces, "type_chain "); + printf_filtered ("%*stype_chain ", spaces, ""); gdb_print_host_address (TYPE_CHAIN (type), gdb_stdout); printf_filtered ("\n"); - printfi_filtered (spaces, "instance_flags 0x%x", - (unsigned) type->instance_flags ()); + printf_filtered ("%*sinstance_flags 0x%x", spaces, "", + (unsigned) type->instance_flags ()); if (TYPE_CONST (type)) { puts_filtered (" TYPE_CONST"); @@ -5217,7 +5217,7 @@ recursive_dump_type (struct type *type, int spaces) } puts_filtered ("\n"); - printfi_filtered (spaces, "flags"); + printf_filtered ("%*sflags", spaces, ""); if (type->is_unsigned ()) { puts_filtered (" TYPE_UNSIGNED"); @@ -5266,20 +5266,18 @@ recursive_dump_type (struct type *type, int spaces) puts_filtered (" TYPE_NOTTEXT"); } puts_filtered ("\n"); - printfi_filtered (spaces, "nfields %d ", type->num_fields ()); + printf_filtered ("%*snfields %d ", spaces, "", type->num_fields ()); gdb_print_host_address (type->fields (), gdb_stdout); puts_filtered ("\n"); for (idx = 0; idx < type->num_fields (); idx++) { if (type->code () == TYPE_CODE_ENUM) - printfi_filtered (spaces + 2, - "[%d] enumval %s type ", - idx, plongest (TYPE_FIELD_ENUMVAL (type, idx))); + printf_filtered ("%*s[%d] enumval %s type ", spaces + 2, "", + idx, plongest (TYPE_FIELD_ENUMVAL (type, idx))); else - printfi_filtered (spaces + 2, - "[%d] bitpos %s bitsize %d type ", - idx, plongest (TYPE_FIELD_BITPOS (type, idx)), - TYPE_FIELD_BITSIZE (type, idx)); + printf_filtered ("%*s[%d] bitpos %s bitsize %d type ", spaces + 2, "", + idx, plongest (TYPE_FIELD_BITPOS (type, idx)), + TYPE_FIELD_BITSIZE (type, idx)); gdb_print_host_address (type->field (idx).type (), gdb_stdout); printf_filtered (" name '%s' (", TYPE_FIELD_NAME (type, idx) != NULL @@ -5294,7 +5292,7 @@ recursive_dump_type (struct type *type, int spaces) } if (type->code () == TYPE_CODE_RANGE) { - printfi_filtered (spaces, "low "); + printf_filtered ("%*slow ", spaces, ""); dump_dynamic_prop (type->bounds ()->low); printf_filtered (" high "); dump_dynamic_prop (type->bounds ()->high); @@ -5304,7 +5302,7 @@ recursive_dump_type (struct type *type, int spaces) switch (TYPE_SPECIFIC_FIELD (type)) { case TYPE_SPECIFIC_CPLUS_STUFF: - printfi_filtered (spaces, "cplus_stuff "); + printf_filtered ("%*scplus_stuff ", spaces, ""); gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout); puts_filtered ("\n"); @@ -5312,14 +5310,14 @@ recursive_dump_type (struct type *type, int spaces) break; case TYPE_SPECIFIC_GNAT_STUFF: - printfi_filtered (spaces, "gnat_stuff "); + printf_filtered ("%*sgnat_stuff ", spaces, ""); gdb_print_host_address (TYPE_GNAT_SPECIFIC (type), gdb_stdout); puts_filtered ("\n"); print_gnat_stuff (type, spaces); break; case TYPE_SPECIFIC_FLOATFORMAT: - printfi_filtered (spaces, "floatformat "); + printf_filtered ("%*sfloatformat ", spaces, ""); if (TYPE_FLOATFORMAT (type) == NULL || TYPE_FLOATFORMAT (type)->name == NULL) puts_filtered ("(null)"); @@ -5329,19 +5327,19 @@ recursive_dump_type (struct type *type, int spaces) break; case TYPE_SPECIFIC_FUNC: - printfi_filtered (spaces, "calling_convention %d\n", - TYPE_CALLING_CONVENTION (type)); + printf_filtered ("%*scalling_convention %d\n", spaces, "", + TYPE_CALLING_CONVENTION (type)); /* tail_call_list is not printed. */ break; case TYPE_SPECIFIC_SELF_TYPE: - printfi_filtered (spaces, "self_type "); + printf_filtered ("%*sself_type ", spaces, ""); gdb_print_host_address (TYPE_SELF_TYPE (type), gdb_stdout); puts_filtered ("\n"); break; case TYPE_SPECIFIC_FIXED_POINT: - printfi_filtered (spaces, "fixed_point_info "); + printf_filtered ("%*sfixed_point_info ", spaces, ""); print_fixed_point_type_info (type, spaces); puts_filtered ("\n"); break; @@ -5351,8 +5349,8 @@ recursive_dump_type (struct type *type, int spaces) { unsigned bit_size = type->bit_size (); unsigned bit_off = type->bit_offset (); - printfi_filtered (spaces, " bit size = %u, bit offset = %u\n", - bit_size, bit_off); + printf_filtered ("%*s bit size = %u, bit offset = %u\n", spaces, "", + bit_size, bit_off); } break; } diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 24d0c00..3765d53 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -1261,7 +1261,7 @@ go32_sysinfo (const char *arg, int from_tty) xsnprintf (cpu_string, sizeof (cpu_string), "%s%s Model %d Stepping %d", intel_p ? "Pentium" : (amd_p ? "AMD" : (hygon_p ? "Hygon" : "ix86")), cpu_brand, cpu_model, cpuid_eax & 0xf); - printfi_filtered (31, "%s\n", cpu_string); + printf_filtered ("%*s%s\n", 31, "", cpu_string); if (((cpuid_edx & (6 | (0x0d << 23))) != 0) || ((cpuid_edx & 1) == 0) || ((amd_p || hygon_p) && (cpuid_edx & (3 << 30)) != 0)) @@ -1372,11 +1372,11 @@ go32_sysinfo (const char *arg, int from_tty) "%s-bit DPMI, with%s Virtual Memory support\n", (dpmi_version_data.flags & 1) ? "32" : "16", (dpmi_version_data.flags & 4) ? "" : "out"); - printfi_filtered (31, "Interrupts reflected to %s mode\n", + printf_filtered ("%*sInterrupts reflected to %s mode\n", 31, "", (dpmi_version_data.flags & 2) ? "V86" : "Real"); - printfi_filtered (31, "Processor type: i%d86\n", + printf_filtered ("%*sProcessor type: i%d86\n", 31, "", dpmi_version_data.cpu); - printfi_filtered (31, "PIC base interrupt: Master: %#x Slave: %#x\n", + printf_filtered ("%*sPIC base interrupt: Master: %#x Slave: %#x\n", 31, "", dpmi_version_data.master_pic, dpmi_version_data.slave_pic); /* a_tss is only initialized when the debuggee is first run. */ @@ -1430,8 +1430,8 @@ go32_sysinfo (const char *arg, int from_tty) __dpmi_int (0x21, ®s); if ((regs.x.flags & 1) != 0) regs.h.al = 0; - printfi_filtered (31, "UMBs %sin DOS memory chain\n", - regs.h.al == 0 ? "not " : ""); + printf_filtered ("%*sUMBs %sin DOS memory chain\n", 31, "", + regs.h.al == 0 ? "not " : ""); } } @@ -1595,7 +1595,7 @@ display_descriptor (unsigned type, unsigned long base_addr, int idx, int force) break; case 5: printf_filtered ("TSS selector=0x%04x", descr.base0); - printfi_filtered (16, "Task Gate"); + printf_filtered ("%*sTask Gate", 16, ""); break; case 6: case 7: diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index 20a3d13..8b05bf3 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -582,7 +582,7 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show, fprintf_filtered (stream, ";\n"); } - fprintfi_filtered (level, stream, "END "); + fprintf_filtered (stream, "%*sEND ", level, ""); } } diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index c2c182a..b53a0de 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -564,9 +564,11 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, if ((type->num_fields () == 0) && (TYPE_NFN_FIELDS (type) == 0)) { if (type->is_stub ()) - fprintfi_filtered (level + 4, stream, "<incomplete type>\n"); + fprintf_filtered (stream, "%*s<incomplete type>\n", + level + 4, ""); else - fprintfi_filtered (level + 4, stream, "<no data fields>\n"); + fprintf_filtered (stream, "%*s<no data fields>\n", + level + 4, ""); } /* Start off with no specific section type, so we can print @@ -597,8 +599,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, if (section_type != s_protected) { section_type = s_protected; - fprintfi_filtered (level + 2, stream, - "protected\n"); + fprintf_filtered (stream, "%*sprotected\n", + level + 2, ""); } } else if (TYPE_FIELD_PRIVATE (type, i)) @@ -606,7 +608,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, if (section_type != s_private) { section_type = s_private; - fprintfi_filtered (level + 2, stream, "private\n"); + fprintf_filtered (stream, "%*sprivate\n", + level + 2, ""); } } else @@ -614,7 +617,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, if (section_type != s_public) { section_type = s_public; - fprintfi_filtered (level + 2, stream, "public\n"); + fprintf_filtered (stream, "%*spublic\n", + level + 2, ""); } } } @@ -668,8 +672,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, if (section_type != s_protected) { section_type = s_protected; - fprintfi_filtered (level + 2, stream, - "protected\n"); + fprintf_filtered (stream, "%*sprotected\n", + level + 2, ""); } } else if (TYPE_FN_FIELD_PRIVATE (f, j)) @@ -677,7 +681,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, if (section_type != s_private) { section_type = s_private; - fprintfi_filtered (level + 2, stream, "private\n"); + fprintf_filtered (stream, "%*sprivate\n", + level + 2, ""); } } else @@ -685,7 +690,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, if (section_type != s_public) { section_type = s_public; - fprintfi_filtered (level + 2, stream, "public\n"); + fprintf_filtered (stream, "%*spublic\n", + level + 2, ""); } } @@ -736,7 +742,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, fprintf_filtered (stream, ";\n"); } } - fprintfi_filtered (level, stream, "end"); + fprintf_filtered (stream, "%*send", level, ""); } break; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index b89fd30..3a9a4e7 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -849,9 +849,10 @@ rust_internal_print_type (struct type *type, const char *varstring, && name[len] == ':' && name[len + 1] == ':') name += len + 2; - fprintfi_filtered (level + 2, stream, "%ps,\n", - styled_string (variable_name_style.style (), - name)); + fprintf_filtered (stream, "%*s%ps,\n", + level + 2, "", + styled_string (variable_name_style.style (), + name)); } fputs_filtered ("}", stream); diff --git a/gdb/utils.c b/gdb/utils.c index abcf6e2..a0b36b4 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2183,22 +2183,6 @@ fprintf_unfiltered (struct ui_file *stream, const char *format, ...) va_end (args); } -/* Like fprintf_filtered, but prints its result indented. - Called as fprintfi_filtered (spaces, stream, format, ...); */ - -void -fprintfi_filtered (int spaces, struct ui_file *stream, const char *format, - ...) -{ - va_list args; - - va_start (args, format); - print_spaces_filtered (spaces, stream); - - vfprintf_filtered (stream, format, args); - va_end (args); -} - /* See utils.h. */ void @@ -2263,20 +2247,6 @@ printf_unfiltered (const char *format, ...) va_end (args); } -/* Like printf_filtered, but prints it's result indented. - Called as printfi_filtered (spaces, format, ...); */ - -void -printfi_filtered (int spaces, const char *format, ...) -{ - va_list args; - - va_start (args, format); - print_spaces_filtered (spaces, gdb_stdout); - vfprintf_filtered (gdb_stdout, format, args); - va_end (args); -} - /* Easy -- but watch out! This routine is *not* a replacement for puts()! puts() appends a newline. diff --git a/gdb/utils.h b/gdb/utils.h index e87ce11..51483b8 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -443,13 +443,8 @@ extern void vfprintf_filtered (struct ui_file *, const char *, va_list) extern void fprintf_filtered (struct ui_file *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); -extern void fprintfi_filtered (int, struct ui_file *, const char *, ...) - ATTRIBUTE_PRINTF (3, 4); - extern void printf_filtered (const char *, ...) ATTRIBUTE_PRINTF (1, 2); -extern void printfi_filtered (int, const char *, ...) ATTRIBUTE_PRINTF (2, 3); - extern void vprintf_unfiltered (const char *, va_list) ATTRIBUTE_PRINTF (1, 0); extern void vfprintf_unfiltered (struct ui_file *, const char *, va_list) |