From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 28FED385781E; Wed, 26 Jan 2022 22:25:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28FED385781E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Convert wrap_here to use integer parameter X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: bbea68079781ac4c2fc941867ee9888585cafb77 X-Git-Newrev: 6c92c339539ec87dc12783e9c8f1688a4a370c03 Message-Id: <20220126222559.28FED385781E@sourceware.org> Date: Wed, 26 Jan 2022 22:25:59 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2022 22:25:59 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6c92c339539e= c87dc12783e9c8f1688a4a370c03 commit 6c92c339539ec87dc12783e9c8f1688a4a370c03 Author: Tom Tromey Date: Thu Dec 30 09:46:02 2021 -0700 Convert wrap_here to use integer parameter =20 I think it only really makes sense to call wrap_here with an argument consisting solely of spaces. Given this, it seemed better to me that the argument be an int, rather than a string. This patch is the result. Much of it was written by a script. Diff: --- gdb/ada-typeprint.c | 8 +++---- gdb/ada-valprint.c | 6 ++--- gdb/breakpoint.c | 15 ++++--------- gdb/c-typeprint.c | 16 +++++++------- gdb/cli-out.c | 4 ++-- gdb/cli-out.h | 2 +- gdb/cli/cli-cmds.c | 2 +- gdb/cli/cli-decode.c | 12 +++++----- gdb/cp-valprint.c | 2 +- gdb/disasm.c | 4 ++-- gdb/exceptions.c | 2 +- gdb/exec.c | 2 +- gdb/f-typeprint.c | 4 ++-- gdb/guile/scm-pretty-print.c | 2 +- gdb/m2-typeprint.c | 8 +++---- gdb/main.c | 8 +++---- gdb/maint.c | 4 ++-- gdb/mi/mi-out.c | 4 ++-- gdb/mi/mi-out.h | 2 +- gdb/p-typeprint.c | 10 ++++----- gdb/p-valprint.c | 2 +- gdb/printcmd.c | 8 +++---- gdb/psymtab.c | 10 ++++----- gdb/python/py-framefilter.c | 6 ++--- gdb/python/py-prettyprint.c | 2 +- gdb/source.c | 10 ++++----- gdb/stack.c | 20 ++++++++--------- gdb/symfile.c | 4 ++-- gdb/symmisc.c | 6 ++--- gdb/symtab.c | 2 +- gdb/top.c | 2 +- gdb/tracepoint.c | 15 +++++-------- gdb/ui-out.c | 4 ++-- gdb/ui-out.h | 4 ++-- gdb/utils.c | 52 ++++++++++++++++------------------------= ---- gdb/utils.h | 2 +- gdb/valprint.c | 2 +- 37 files changed, 122 insertions(+), 146 deletions(-) diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index 30fe1072cf7..c6a3867d53f 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -317,7 +317,7 @@ print_enum_type (struct type *type, struct ui_file *str= eam) LONGEST lastval; =20 fprintf_filtered (stream, "("); - wrap_here (" "); + wrap_here (1); =20 lastval =3D 0; for (i =3D 0; i < len; i++) @@ -325,7 +325,7 @@ print_enum_type (struct type *type, struct ui_file *str= eam) QUIT; if (i) fprintf_filtered (stream, ", "); - wrap_here (" "); + wrap_here (4); fputs_styled (ada_enum_name (type->field (i).name ()), variable_name_style.style (), stream); if (lastval !=3D type->field (i).loc_enumval ()) @@ -416,7 +416,7 @@ print_array_type (struct type *type, struct ui_file *st= ream, int show, =20 elt_type =3D ada_array_element_type (type, n_indices); fprintf_filtered (stream, ") of "); - wrap_here (""); + wrap_here (0); ada_print_type (elt_type, "", stream, show =3D=3D 0 ? 0 : show - 1, leve= l + 1, flags); /* Arrays with variable-length elements are never bit-packed in practice= but @@ -892,7 +892,7 @@ print_func_type (struct type *type, struct ui_file *str= eam, const char *name, if (i > 0) { fputs_filtered ("; ", stream); - wrap_here (" "); + wrap_here (4); } fprintf_filtered (stream, "a%d: ", i + 1); ada_print_type (type->field (i).type (), "", stream, -1, 0, diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 70e46965c17..352568d8045 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -178,7 +178,7 @@ val_print_packed_array_elements (struct type *type, con= st gdb_byte *valaddr, fprintf_filtered (stream, "\n"); print_spaces_filtered (2 + 2 * recurse, stream); } - wrap_here (n_spaces (2 + 2 * recurse)); + wrap_here (2 + 2 * recurse); maybe_print_array_index (index_type, i + low, stream, options); =20 i0 =3D i; @@ -235,7 +235,7 @@ val_print_packed_array_elements (struct type *type, con= st gdb_byte *valaddr, { fprintf_filtered (stream, ", "); } - wrap_here (n_spaces (2 + 2 * recurse)); + wrap_here (2 + 2 * recurse); maybe_print_array_index (index_type, j + low, stream, options); } @@ -614,7 +614,7 @@ print_field_values (struct value *value, struct value *= outer_value, } else { - wrap_here (n_spaces (2 + 2 * recurse)); + wrap_here (2 + 2 * recurse); } =20 annotate_field_begin (type->field (i).type ()); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 914f945714e..9567c737cab 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5788,14 +5788,13 @@ bpstat_causes_stop (bpstat *bs) =20 =0C =20 -/* Compute a string of spaces suitable to indent the next line +/* Compute a number of spaces suitable to indent the next line so it starts at the position corresponding to the table column named COL_NAME in the currently active table of UIOUT. */ =20 -static char * +static int wrap_indent_at_field (struct ui_out *uiout, const char *col_name) { - static char wrap_indent[80]; int i, total_width, width, align; const char *text; =20 @@ -5803,18 +5802,12 @@ wrap_indent_at_field (struct ui_out *uiout, const c= har *col_name) for (i =3D 1; uiout->query_table_field (i, &width, &align, &text); i++) { if (strcmp (text, col_name) =3D=3D 0) - { - gdb_assert (total_width < sizeof wrap_indent); - memset (wrap_indent, ' ', total_width); - wrap_indent[total_width] =3D 0; - - return wrap_indent; - } + return total_width; =20 total_width +=3D width + 1; } =20 - return NULL; + return 0; } =20 /* Determine if the locations of this breakpoint will have their conditions diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 81fc82ec263..d20b71124ae 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -250,7 +250,7 @@ cp_type_print_derivation_info (struct ui_file *stream, =20 for (i =3D 0; i < TYPE_N_BASECLASSES (type); i++) { - wrap_here (" "); + wrap_here (8); fputs_filtered (i =3D=3D 0 ? ": " : ", ", stream); fprintf_filtered (stream, "%s%s ", BASETYPE_VIA_PUBLIC (type, i) @@ -310,7 +310,7 @@ cp_type_print_method_args (struct type *mtype, const ch= ar *prefix, else if (i < nargs) { fprintf_filtered (stream, ", "); - wrap_here (" "); + wrap_here (8); } } } @@ -573,7 +573,7 @@ c_type_print_args (struct type *type, struct ui_file *s= tream, if (printed_any) { fprintf_filtered (stream, ", "); - wrap_here (" "); + wrap_here (4); } =20 param_type =3D type->field (i).type (); @@ -602,7 +602,7 @@ c_type_print_args (struct type *type, struct ui_file *s= tream, if (printed_any && type->has_varargs ()) { fprintf_filtered (stream, ", "); - wrap_here (" "); + wrap_here (4); fprintf_filtered (stream, "..."); } } @@ -888,14 +888,14 @@ c_type_print_template_args (const struct type_print_o= ptions *flags, =20 if (first) { - wrap_here (" "); + wrap_here (4); fprintf_filtered (stream, _("[with %s =3D "), sym->linkage_name ()); first =3D 0; } else { fputs_filtered (", ", stream); - wrap_here (" "); + wrap_here (9); fprintf_filtered (stream, "%s =3D ", sym->linkage_name ()); } =20 @@ -1559,7 +1559,7 @@ c_type_print_base_1 (struct type *type, struct ui_fil= e *stream, fputs_filtered (" ", stream); } =20 - wrap_here (" "); + wrap_here (4); if (show < 0) { /* If we just printed a tag name, no need to print anything @@ -1594,7 +1594,7 @@ c_type_print_base_1 (struct type *type, struct ui_fil= e *stream, QUIT; if (i) fprintf_filtered (stream, ", "); - wrap_here (" "); + wrap_here (4); fputs_styled (type->field (i).name (), variable_name_style.style (), stream); if (lastval !=3D type->field (i).loc_enumval ()) diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 5ff645b4a83..925ba8a7369 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -238,12 +238,12 @@ cli_ui_out::do_message (const ui_file_style &style, } =20 void -cli_ui_out::do_wrap_hint (const char *identstring) +cli_ui_out::do_wrap_hint (int indent) { if (m_suppress_output) return; =20 - wrap_here (identstring); + wrap_here (indent); } =20 void diff --git a/gdb/cli-out.h b/gdb/cli-out.h index 4af5524495a..3fc794b61a4 100644 --- a/gdb/cli-out.h +++ b/gdb/cli-out.h @@ -67,7 +67,7 @@ protected: virtual void do_message (const ui_file_style &style, const char *format, va_list args) override ATTRIBUTE_PRINTF (3,0); - virtual void do_wrap_hint (const char *identstring) override; + virtual void do_wrap_hint (int indent) override; virtual void do_flush () override; virtual void do_redirect (struct ui_file *outstream) override; =20 diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 563f29067c3..943d4db94de 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -841,7 +841,7 @@ echo_command (const char *text, int from_tty) reset_terminal_style (gdb_stdout); =20 /* Force this output to appear now. */ - wrap_here (""); + wrap_here (0); gdb_flush (gdb_stdout); } =20 diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index a71350ba68b..24c80dc7bd5 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -1414,7 +1414,7 @@ fput_command_names_styled (const cmd_list_element &c, continue; =20 fputs_filtered (", ", stream); - wrap_here (" "); + wrap_here (3); fput_command_name_styled (alias, stream); } =20 @@ -1651,7 +1651,7 @@ help_list (struct cmd_list_element *list, const char = *cmdtype, fprintf_filtered (stream, "\n\ Type \"help%s\" followed by a class name for a list of commands in ", cmdtype1); - wrap_here (""); + wrap_here (0); fprintf_filtered (stream, "that class."); =20 fprintf_filtered (stream, "\n\ @@ -1660,16 +1660,16 @@ Type \"help all\" for the list of all commands."); =20 fprintf_filtered (stream, "\nType \"help%s\" followed by %scommand name = ", cmdtype1, cmdtype2); - wrap_here (""); + wrap_here (0); fputs_filtered ("for ", stream); - wrap_here (""); + wrap_here (0); fputs_filtered ("full ", stream); - wrap_here (""); + wrap_here (0); fputs_filtered ("documentation.\n", stream); fputs_filtered ("Type \"apropos word\" to search " "for commands related to \"word\".\n", stream); fputs_filtered ("Type \"apropos -v word\" for full documentation", strea= m); - wrap_here (""); + wrap_here (0); fputs_filtered (" of commands related to \"word\".\n", stream); fputs_filtered ("Command name abbreviations are allowed if unambiguous.\= n", stream); diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 1d98eb58214..3b0e1df7a1f 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -222,7 +222,7 @@ cp_print_value_fields (struct value *val, struct ui_fil= e *stream, } else { - wrap_here (n_spaces (2 + 2 * recurse)); + wrap_here (2 + 2 * recurse); } =20 annotate_field_begin (type->field (i).type ()); diff --git a/gdb/disasm.c b/gdb/disasm.c index 724040faa92..46aa995a9d5 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -1118,7 +1118,7 @@ The following disassembler options are supported for = use with the\n\ fprintf_filtered (file, "%s", valid_options->arg[i]->name); if (valid_options->name[i + 1] !=3D NULL) fprintf_filtered (file, ", "); - wrap_here (" "); + wrap_here (2); } fprintf_filtered (file, "\n"); } @@ -1136,7 +1136,7 @@ The following disassembler options are supported for = use with the\n\ for (j =3D 0; valid_args[i].values[j] !=3D NULL; j++) { fprintf_filtered (file, " %s", valid_args[i].values[j]); - wrap_here (" "); + wrap_here (3); } fprintf_filtered (file, "\n"); } diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 87a8dc26a51..404cd4c4038 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -52,7 +52,7 @@ print_flush (void) =20 /* 1. The _filtered buffer. */ if (filtered_printing_initialized ()) - wrap_here (""); + wrap_here (0); =20 /* 2. The stdio buffer. */ gdb_flush (gdb_stdout); diff --git a/gdb/exec.c b/gdb/exec.c index d9854d50f78..c4161b58e73 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -909,7 +909,7 @@ print_section_info (const target_section_table *t, bfd = *abfd) printf_filtered ("\t`%ps', ", styled_string (file_name_style.style (), bfd_get_filename (abfd))); - wrap_here (" "); + wrap_here (8); printf_filtered (_("file type %s.\n"), bfd_get_target (abfd)); if (abfd =3D=3D current_program_space->exec_bfd ()) { diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 0a338c11cbc..3e419a74a9f 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -250,7 +250,7 @@ f_language::f_type_print_varspec_suffix (struct type *t= ype, if (i > 0) { fputs_filtered (", ", stream); - wrap_here (" "); + wrap_here (4); } print_type (type->field (i).type (), "", stream, -1, 0, 0); } @@ -290,7 +290,7 @@ f_language::f_type_print_base (struct type *type, struc= t ui_file *stream, =20 QUIT; =20 - wrap_here (" "); + wrap_here (4); if (type =3D=3D NULL) { fputs_styled ("", metadata_style.style (), stream); diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index 77f9b0ab7f8..814a7e7a4bc 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -861,7 +861,7 @@ ppscm_print_children (SCM printer, enum display_hint hi= nt, print_spaces_filtered (2 + 2 * recurse, stream); } else - wrap_here (n_spaces (2 + 2 *recurse)); + wrap_here (2 + 2 *recurse); } =20 if (is_map && i % 2 =3D=3D 0) diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index f929ab4df3c..cbb6b545d4f 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -79,7 +79,7 @@ m2_print_type (struct type *type, const char *varstring, =20 QUIT; =20 - wrap_here (" "); + wrap_here (4); if (type =3D=3D NULL) { fputs_styled (_(""), metadata_style.style (), stream); @@ -292,7 +292,7 @@ m2_procedure (struct type *type, struct ui_file *stream, if (i > 0) { fputs_filtered (", ", stream); - wrap_here (" "); + wrap_here (4); } m2_print_type (type->field (i).type (), "", stream, -1, 0, flags); } @@ -539,7 +539,7 @@ m2_record_fields (struct type *type, struct ui_file *st= ream, int show, fprintf_filtered (stream, " =3D "); } } - wrap_here (" "); + wrap_here (4); if (show < 0) { if (type->code () =3D=3D TYPE_CODE_STRUCT) @@ -608,7 +608,7 @@ m2_enum (struct type *type, struct ui_file *stream, int= show, int level) QUIT; if (i > 0) fprintf_filtered (stream, ", "); - wrap_here (" "); + wrap_here (4); fputs_styled (type->field (i).name (), variable_name_style.style (), stream); if (lastval !=3D type->field (i).loc_enumval ()) diff --git a/gdb/main.c b/gdb/main.c index 278b901c768..6b312f85f2b 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1121,7 +1121,7 @@ captured_main_1 (struct captured_main_args *context) if (print_version) { print_gdb_version (gdb_stdout, false); - wrap_here (""); + wrap_here (0); printf_filtered ("\n"); exit (0); } @@ -1135,7 +1135,7 @@ captured_main_1 (struct captured_main_args *context) if (print_configuration) { print_gdb_configuration (gdb_stdout); - wrap_here (""); + wrap_here (0); printf_filtered ("\n"); exit (0); } @@ -1151,7 +1151,7 @@ captured_main_1 (struct captured_main_args *context) print_gdb_version (gdb_stdout, true); if (symarg) printf_filtered (".."); - wrap_here (""); + wrap_here (0); printf_filtered ("\n"); gdb_flush (gdb_stdout); /* Force to screen during slow operations. */ @@ -1172,7 +1172,7 @@ captured_main_1 (struct captured_main_args *context) print_gdb_version (gdb_stdout, true); if (symarg) printf_filtered (".."); - wrap_here (""); + wrap_here (0); printf_filtered ("\n"); gdb_flush (gdb_stdout); /* Force to screen during slow operations. */ diff --git a/gdb/maint.c b/gdb/maint.c index 7e84b60fea0..49e62292324 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -364,9 +364,9 @@ maint_print_all_sections (const char *header, bfd *abfd= , objfile *objfile, const char *arg) { puts_filtered (header); - wrap_here (" "); + wrap_here (8); printf_filtered ("`%s', ", bfd_get_filename (abfd)); - wrap_here (" "); + wrap_here (8); printf_filtered (_("file type %s.\n"), bfd_get_target (abfd)); =20 int section_count =3D gdb_bfd_count_sections (abfd); diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 20c6f0f9194..72ae36dd418 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -172,9 +172,9 @@ mi_ui_out::do_message (const ui_file_style &style, } =20 void -mi_ui_out::do_wrap_hint (const char *identstring) +mi_ui_out::do_wrap_hint (int indent) { - wrap_here (identstring); + wrap_here (indent); } =20 void diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h index 1b7fa96a182..8f2f2d82ec0 100644 --- a/gdb/mi/mi-out.h +++ b/gdb/mi/mi-out.h @@ -76,7 +76,7 @@ protected: virtual void do_message (const ui_file_style &style, const char *format, va_list args) override ATTRIBUTE_PRINTF (3,0); - virtual void do_wrap_hint (const char *identstring) override; + virtual void do_wrap_hint (int indent) override; virtual void do_flush () override; virtual void do_redirect (struct ui_file *outstream) override; =20 diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 3450836996d..a105d297bc4 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -287,7 +287,7 @@ pascal_language::print_func_args (struct type *type, st= ruct ui_file *stream, if (i > 0) { fputs_filtered (", ", stream); - wrap_here (" "); + wrap_here (4); } /* Can we find if it is a var parameter ?? if ( TYPE_FIELD(type, i) =3D=3D ) @@ -419,7 +419,7 @@ pascal_language::type_print_base (struct type *type, st= ruct ui_file *stream, int section_type; =20 QUIT; - wrap_here (" "); + wrap_here (4); if (type =3D=3D NULL) { fputs_styled ("", metadata_style.style (), stream); @@ -487,7 +487,7 @@ pascal_language::type_print_base (struct type *type, st= ruct ui_file *stream, int fprintf_filtered (stream, "case of "); =20 struct_union: - wrap_here (" "); + wrap_here (4); if (show < 0) { /* If we just printed a tag name, no need to print anything else. */ @@ -692,7 +692,7 @@ pascal_language::type_print_base (struct type *type, st= ruct ui_file *stream, int /* enum is just defined by type enume_name =3D (enum_member1,enum_member2,...) */ fprintf_filtered (stream, " =3D "); - wrap_here (" "); + wrap_here (4); if (show < 0) { /* If we just printed a tag name, no need to print anything else. */ @@ -709,7 +709,7 @@ pascal_language::type_print_base (struct type *type, st= ruct ui_file *stream, int QUIT; if (i) fprintf_filtered (stream, ", "); - wrap_here (" "); + wrap_here (4); fputs_filtered (type->field (i).name (), stream); if (lastval !=3D type->field (i).loc_enumval ()) { diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index e0c3868991b..2019a1d40df 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -574,7 +574,7 @@ pascal_object_print_value_fields (struct value *val, st= ruct ui_file *stream, } else { - wrap_here (n_spaces (2 + 2 * recurse)); + wrap_here (2 + 2 * recurse); } =20 annotate_field_begin (type->field (i).type ()); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index fdbe72be83c..e1444ac1c83 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -317,7 +317,7 @@ print_formatted (struct value *val, int size, =20 case 'i': /* We often wrap here if there are long symbolic names. */ - wrap_here (" "); + wrap_here (4); next_address =3D (value_address (val) + gdb_print_insn (type->arch (), value_address (val), stream, @@ -826,7 +826,7 @@ find_instruction_backward (struct gdbarch *gdbarch, COR= E_ADDR addr, is calculated after the loop. */ printf_filtered (_("No line number information available " "for address ")); - wrap_here (" "); + wrap_here (2); print_address (gdbarch, loop_start - 1, gdb_stdout); printf_filtered ("\n"); break; @@ -1498,7 +1498,7 @@ output_command (const char *exp, int from_tty) =20 annotate_value_end (); =20 - wrap_here (""); + wrap_here (0); gdb_flush (gdb_stdout); } =20 @@ -2895,7 +2895,7 @@ printf_command (const char *arg, int from_tty) { ui_printf (arg, gdb_stdout); reset_terminal_style (gdb_stdout); - wrap_here (""); + wrap_here (0); gdb_stdout->flush (); } =20 diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 0e9e822996c..11063bd5975 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1422,11 +1422,11 @@ partial_symtab::expand_dependencies (struct objfile= *objfile) if (info_verbose) { puts_filtered (" "); - wrap_here (""); + wrap_here (0); puts_filtered ("and "); - wrap_here (""); + wrap_here (0); printf_filtered ("%s...", dependencies[i]->filename); - wrap_here (""); /* Flush output */ + wrap_here (0); /* Flush output */ gdb_flush (gdb_stdout); } dependencies[i]->expand_psymtab (objfile); @@ -1679,14 +1679,14 @@ maintenance_info_psymtabs (const char *regexp, int = from_tty) if (! printed_objfile_start) { printf_filtered ("{ objfile %s ", objfile_name (objfile)); - wrap_here (" "); + wrap_here (2); printf_filtered ("((struct objfile *) %s)\n", host_address_to_string (objfile)); printed_objfile_start =3D 1; } =20 printf_filtered (" { psymtab %s ", psymtab->filename); - wrap_here (" "); + wrap_here (4); printf_filtered ("((struct partial_symtab *) %s)\n", host_address_to_string (psymtab)); =20 diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 7870374b3ec..708fcc535e2 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -501,7 +501,7 @@ enumerate_args (PyObject *iter, if (arg.entry_kind !=3D print_entry_values_only) { out->text (", "); - out->wrap_hint (" "); + out->wrap_hint (4); } =20 py_print_single_arg (out, NULL, &entryarg, NULL, &opts, @@ -705,7 +705,7 @@ py_print_args (PyObject *filter, =20 ui_out_emit_list list_emitter (out, "args"); =20 - out->wrap_hint (" "); + out->wrap_hint (3); annotate_frame_args (); out->text (" ("); =20 @@ -984,7 +984,7 @@ py_print_frame (PyObject *filter, frame_filter_flags fl= ags, if (filename =3D=3D NULL) return EXT_LANG_BT_ERROR; =20 - out->wrap_hint (" "); + out->wrap_hint (3); out->text (" at "); annotate_frame_source_file (); out->field_string ("file", filename.get (), diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index df4857fef11..59c311c9b66 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -474,7 +474,7 @@ print_children (PyObject *printer, const char *hint, print_spaces_filtered (2 + 2 * recurse, stream); } else - wrap_here (n_spaces (2 + 2 *recurse)); + wrap_here (2 + 2 *recurse); } =20 if (is_map && i % 2 =3D=3D 0) diff --git a/gdb/source.c b/gdb/source.c index 9cfc18b8115..2b0a5c9b407 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1548,7 +1548,7 @@ info_line_command (const char *arg, int from_tty) user about a source line, at least let them have the symbolic address. */ printf_filtered (" for address "); - wrap_here (" "); + wrap_here (2); print_address (gdbarch, sal.pc, gdb_stdout); } else @@ -1565,10 +1565,10 @@ info_line_command (const char *arg, int from_tty) printf_filtered ("Line %d of \"%s\"", sal.line, symtab_to_filename_for_display (sal.symtab)); - wrap_here (" "); + wrap_here (2); printf_filtered (" is at address "); print_address (gdbarch, start_pc, gdb_stdout); - wrap_here (" "); + wrap_here (2); printf_filtered (" but contains no code.\n"); } else @@ -1576,10 +1576,10 @@ info_line_command (const char *arg, int from_tty) printf_filtered ("Line %d of \"%s\"", sal.line, symtab_to_filename_for_display (sal.symtab)); - wrap_here (" "); + wrap_here (2); printf_filtered (" starts at address "); print_address (gdbarch, start_pc, gdb_stdout); - wrap_here (" "); + wrap_here (2); printf_filtered (" and ends at "); print_address (gdbarch, end_pc, gdb_stdout); printf_filtered (".\n"); diff --git a/gdb/stack.c b/gdb/stack.c index 7a2d7da2c89..6c3707f1b87 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -875,7 +875,7 @@ print_frame_args (const frame_print_options &fp_opts, /* Print the current arg. */ if (!first) uiout->text (", "); - uiout->wrap_hint (" "); + uiout->wrap_hint (4); =20 if (!print_args) { @@ -895,7 +895,7 @@ print_frame_args (const frame_print_options &fp_opts, if (arg.entry_kind !=3D print_entry_values_only) { uiout->text (", "); - uiout->wrap_hint (" "); + uiout->wrap_hint (4); } =20 print_frame_arg (fp_opts, &entryarg); @@ -1368,7 +1368,7 @@ print_frame (const frame_print_options &fp_opts, string_file stb; fputs_filtered (funname ? funname.get () : "??", &stb); uiout->field_stream ("func", stb, function_name_style.style ()); - uiout->wrap_hint (" "); + uiout->wrap_hint (3); annotate_frame_args (); =20 uiout->text (" ("); @@ -1406,7 +1406,7 @@ print_frame (const frame_print_options &fp_opts, =20 filename_display =3D symtab_to_filename_for_display (sal.symtab); annotate_frame_source_begin (); - uiout->wrap_hint (" "); + uiout->wrap_hint (3); uiout->text (" at "); annotate_frame_source_file (); uiout->field_string ("file", filename_display, @@ -1433,7 +1433,7 @@ print_frame (const frame_print_options &fp_opts, if (lib) { annotate_frame_where (); - uiout->wrap_hint (" "); + uiout->wrap_hint (2); uiout->text (" from "); uiout->field_string ("from", lib, file_name_style.style ()); } @@ -1557,13 +1557,13 @@ info_frame_command_core (struct frame_info *fi, boo= l selected_frame_p) else fputs_styled ("", metadata_style.style (), gdb_stdout); =20 - wrap_here (" "); + wrap_here (3); if (funname) { printf_filtered (" in "); puts_filtered (funname); } - wrap_here (" "); + wrap_here (3); if (sal.symtab) printf_filtered (" (%ps:%d)", @@ -1571,7 +1571,7 @@ info_frame_command_core (struct frame_info *fi, bool = selected_frame_p) symtab_to_filename_for_display (sal.symtab)), sal.line); puts_filtered ("; "); - wrap_here (" "); + wrap_here (4); printf_filtered ("saved %s =3D ", pc_regname); =20 if (!frame_id_p (frame_unwind_caller_id (fi))) @@ -1627,7 +1627,7 @@ info_frame_command_core (struct frame_info *fi, bool = selected_frame_p) } if (get_next_frame (fi) && calling_frame_info) puts_filtered (","); - wrap_here (" "); + wrap_here (3); if (get_next_frame (fi)) { printf_filtered (" caller of frame at "); @@ -1765,7 +1765,7 @@ info_frame_command_core (struct frame_info *fi, bool = selected_frame_p) puts_filtered (" Saved registers:\n "); else puts_filtered (","); - wrap_here (" "); + wrap_here (1); printf_filtered (" %s at ", gdbarch_register_name (gdbarch, i)); puts_filtered (paddress (gdbarch, addr)); diff --git a/gdb/symfile.c b/gdb/symfile.c index 315ee8ecec7..f0a7c7f7c5a 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2607,9 +2607,9 @@ reread_symbols (int from_tty) =20 if (!objfile_has_symbols (objfile)) { - wrap_here (""); + wrap_here (0); printf_filtered (_("(no debugging symbols found)\n")); - wrap_here (""); + wrap_here (0); } =20 /* We're done reading the symbol file; finish off complaints. */ diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 2f4a076c352..65b06c4030f 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -766,7 +766,7 @@ maintenance_info_symtabs (const char *regexp, int from_= tty) if (! printed_objfile_start) { printf_filtered ("{ objfile %s ", objfile_name (objfile)); - wrap_here (" "); + wrap_here (2); printf_filtered ("((struct objfile *) %s)\n", host_address_to_string (objfile)); printed_objfile_start =3D 1; @@ -816,7 +816,7 @@ maintenance_info_symtabs (const char *regexp, int from_= tty) =20 printf_filtered ("\t{ symtab %s ", symtab_to_filename_for_display (symtab)); - wrap_here (" "); + wrap_here (4); printf_filtered ("((struct symtab *) %s)\n", host_address_to_string (symtab)); printf_filtered ("\t fullname %s\n", @@ -873,7 +873,7 @@ maintenance_check_symtabs (const char *ignore, int from= _tty) if (! printed_objfile_start) { printf_filtered ("{ objfile %s ", objfile_name (objfile)); - wrap_here (" "); + wrap_here (2); printf_filtered ("((struct objfile *) %s)\n", host_address_to_string (objfile)); printed_objfile_start =3D 1; diff --git a/gdb/symtab.c b/gdb/symtab.c index 9fc96d7baa1..d0cda253bf2 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4380,7 +4380,7 @@ output_source_filename_data::output (const char *disp= _name, m_uiout->text (", "); m_first =3D false; =20 - wrap_here (""); + wrap_here (0); if (m_uiout->is_mi_like_p ()) { m_uiout->field_string ("file", disp_name, file_name_style.style ()); diff --git a/gdb/top.c b/gdb/top.c index 9164cad0a6a..46983d1fb6f 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1364,7 +1364,7 @@ command_line_input (const char *prompt_arg, const cha= r *annotation_suffix) /* Make sure that all output has been output. Some machines may let you get away with leaving out some of the gdb_flush, but not all. */ - wrap_here (""); + wrap_here (0); gdb_flush (gdb_stdout); gdb_flush (gdb_stderr); =20 diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index c015a8c58be..016bce0bf9b 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2395,10 +2395,10 @@ tfind_line_command (const char *args, int from_tty) printf_filtered ("Line %d of \"%s\"", sal.line, symtab_to_filename_for_display (sal.symtab)); - wrap_here (" "); + wrap_here (2); printf_filtered (" is at address "); print_address (get_current_arch (), start_pc, gdb_stdout); - wrap_here (" "); + wrap_here (2); printf_filtered (" but contains no code.\n"); sal =3D find_pc_line (start_pc, 0); if (sal.line > 0 @@ -3660,8 +3660,6 @@ print_one_static_tracepoint_marker (int count, { struct symbol *sym; =20 - char wrap_indent[80]; - char extra_field_indent[80]; struct ui_out *uiout =3D current_uiout; =20 symtab_and_line sal; @@ -3682,14 +3680,13 @@ print_one_static_tracepoint_marker (int count, !tracepoints.empty () ? 'y' : 'n'); uiout->spaces (2); =20 - strcpy (wrap_indent, " "); - + int wrap_indent =3D 35; if (gdbarch_addr_bit (marker.gdbarch) <=3D 32) - strcat (wrap_indent, " "); + wrap_indent +=3D 11; else - strcat (wrap_indent, " "); + wrap_indent +=3D 19; =20 - strcpy (extra_field_indent, " "); + const char *extra_field_indent =3D " "; =20 uiout->field_core_addr ("addr", marker.gdbarch, marker.address); =20 diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 05d3515aa9a..e34e40fae76 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -790,9 +790,9 @@ ui_out::message (const char *format, ...) } =20 void -ui_out::wrap_hint (const char *identstring) +ui_out::wrap_hint (int indent) { - do_wrap_hint (identstring); + do_wrap_hint (indent); } =20 void diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 05312150c21..60dd6fc2d37 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -257,7 +257,7 @@ class ui_out void vmessage (const ui_file_style &in_style, const char *format, va_list args) ATTRIBUTE_PRINTF (3, 0); =20 - void wrap_hint (const char *identstring); + void wrap_hint (int indent); =20 void flush (); =20 @@ -343,7 +343,7 @@ class ui_out virtual void do_message (const ui_file_style &style, const char *format, va_list args) ATTRIBUTE_PRINTF (3,0) =3D 0; - virtual void do_wrap_hint (const char *identstring) =3D 0; + virtual void do_wrap_hint (int indent) =3D 0; virtual void do_flush () =3D 0; virtual void do_redirect (struct ui_file *outstream) =3D 0; =20 diff --git a/gdb/utils.c b/gdb/utils.c index 92266890de4..3a019d7d1d4 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -154,7 +154,7 @@ vwarning (const char *string, va_list args) target_terminal::ours_for_output (); } if (filtered_printing_initialized ()) - wrap_here (""); /* Force out any buffered output. */ + wrap_here (0); /* Force out any buffered output. */ gdb_flush (gdb_stdout); if (warning_pre_print) fputs_unfiltered (warning_pre_print, gdb_stderr); @@ -881,7 +881,7 @@ defaulted_query (const char *ctlstr, const char defchar= , va_list args) { target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - wrap_here (""); + wrap_here (0); vfprintf_filtered (gdb_stdout, ctlstr, args); =20 printf_filtered (_("(%s or %s) [answered %c; " @@ -1175,9 +1175,8 @@ static bool filter_initialized =3D false; already been counted in chars_printed). */ static std::string wrap_buffer; =20 -/* String to indent by if the wrap occurs. Must not be NULL if wrap_column - is non-zero. */ -static const char *wrap_indent; +/* String to indent by if the wrap occurs. */ +static int wrap_indent; =20 /* Column number on the screen where wrap_buffer begins, or 0 if wrapping is not in effect. */ @@ -1520,12 +1519,10 @@ get_chars_per_line () return chars_per_line; } =20 -/* Indicate that if the next sequence of characters overflows the line, - a newline should be inserted here rather than when it hits the end. - If INDENT is non-null, it is a string to be printed to indent the - wrapped part on the next line. INDENT must remain accessible until - the next call to wrap_here() or until a newline is printed through - fputs_filtered(). +/* Indicate that if the next sequence of characters overflows the + line, a newline should be inserted here rather than when it hits + the end. If INDENT is non-zero, it is a number of spaces to be + printed to indent the wrapped part on the next line. =20 If the line is already overfull, we immediately print a newline and the indentation, and disable further wrapping. @@ -1534,15 +1531,12 @@ get_chars_per_line () we must not wrap words, but should still keep track of newlines that were explicitly printed. =20 - INDENT should not contain tabs, as that will mess up the char count - on the next line. FIXME. - This routine is guaranteed to force out any output which has been - squirreled away in the wrap_buffer, so wrap_here ((char *)0) can be + squirreled away in the wrap_buffer, so wrap_here (0) can be used to force out output from the wrap_buffer. */ =20 void -wrap_here (const char *indent) +wrap_here (int indent) { /* This should have been allocated, but be paranoid anyway. */ gdb_assert (filter_initialized); @@ -1555,17 +1549,14 @@ wrap_here (const char *indent) else if (chars_printed >=3D chars_per_line) { puts_filtered ("\n"); - if (indent !=3D NULL) - puts_filtered (indent); + if (indent !=3D 0) + puts_filtered (n_spaces (indent)); wrap_column =3D 0; } else { wrap_column =3D chars_printed; - if (indent =3D=3D NULL) - wrap_indent =3D ""; - else - wrap_indent =3D indent; + wrap_indent =3D indent; wrap_style =3D applied_style; } } @@ -1672,7 +1663,7 @@ fputs_maybe_filtered (const char *linebuffer, struct = ui_file *stream, { wrap_buffer.clear (); wrap_column =3D 0; - wrap_indent =3D ""; + wrap_indent =3D 0; }); =20 /* Go through and output each character. Show line extension @@ -1777,7 +1768,7 @@ fputs_maybe_filtered (const char *linebuffer, struct = ui_file *stream, /* Now output indentation and wrapped string. */ if (wrap_column) { - stream->puts (wrap_indent); + stream->puts (n_spaces (wrap_indent)); =20 /* Having finished inserting the wrapping we should restore the style as it was at the WRAP_COLUMN. */ @@ -1791,14 +1782,9 @@ fputs_maybe_filtered (const char *linebuffer, struct= ui_file *stream, in WRAP_BUFFER. */ applied_style =3D save_style; =20 - /* FIXME, this strlen is what prevents wrap_indent from - containing tabs. However, if we recurse to print it - and count its chars, we risk trouble if wrap_indent is - longer than (the user settable) chars_per_line. - Note also that this can set chars_printed > chars_per_line + /* Note that this can set chars_printed > chars_per_line if we are printing a long string. */ - chars_printed =3D strlen (wrap_indent) - + (save_chars - wrap_column); + chars_printed =3D wrap_indent + (save_chars - wrap_column); wrap_column =3D 0; /* And disable fancy wrap */ } else if (did_paginate && stream->can_emit_style_escape ()) @@ -1809,8 +1795,8 @@ fputs_maybe_filtered (const char *linebuffer, struct = ui_file *stream, if (*lineptr =3D=3D '\n') { chars_printed =3D 0; - wrap_here ((char *) 0); /* Spit out chars, cancel - further wraps. */ + wrap_here (0); /* Spit out chars, cancel + further wraps. */ lines_printed++; /* XXX: The ideal thing would be to call 'stream->putc' here, but we can't because it diff --git a/gdb/utils.h b/gdb/utils.h index 8e9c2049915..027f433f691 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -172,7 +172,7 @@ extern int yquery (const char *, ...) ATTRIBUTE_PRINTF = (1, 2); =20 extern void begin_line (void); =20 -extern void wrap_here (const char *); +extern void wrap_here (int); =20 extern void reinitialize_more_filter (void); =20 diff --git a/gdb/valprint.c b/gdb/valprint.c index f80c1698ad6..1fc007f6147 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1946,7 +1946,7 @@ value_print_array_elements (struct value *val, struct= ui_file *stream, fprintf_filtered (stream, "\n"); print_spaces_filtered (2 + 2 * recurse, stream); } - wrap_here (n_spaces (2 + 2 * recurse)); + wrap_here (2 + 2 * recurse); maybe_print_array_index (index_type, i + low_bound, stream, options);