diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5e23132069..34cf536e14 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2018-10-04 Tom Tromey + + * symfile.c (syms_from_objfile_1, finish_new_objfile) + (reread_symbols): Update. + * complaints.h (clear_complaints): Remove argument. + * complaints.c (enum complaint_series): Remove. + (series): Remove global. + (complaint_internal): Update. + (clear_complaints): Remove argument. + 2018-10-04 Tom Tromey * symfile.c (symbol_file_add_with_addrs): Do not print "no diff --git a/gdb/complaints.c b/gdb/complaints.c index ab61980b62..3184c25c9c 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -23,26 +23,10 @@ #include "gdbcmd.h" #include -/* Should each complaint message be self explanatory, or should we - assume that a series of complaints is being produced? */ - -enum complaint_series { - /* Isolated self explanatory message. */ - ISOLATED_MESSAGE, - - /* First message of a series, but does not need to include any sort - of explanation. */ - SHORT_FIRST_MESSAGE, -}; - /* Map format strings to counters. */ static std::unordered_map counters; -/* How to print the next complaint. */ - -static complaint_series series; - /* How many complaints about a particular thing should be printed before we stop whining about it? Default is no whining at all, since so many systems have ill-constructed symbol files. */ @@ -65,39 +49,20 @@ complaint_internal (const char *fmt, ...) (*deprecated_warning_hook) (fmt, args); else { - std::string msg = string_vprintf (fmt, args); - wrap_here (""); - begin_line (); - if (series == ISOLATED_MESSAGE) - fprintf_filtered (gdb_stderr, "During symbol reading, %s.\n", - msg.c_str ()); - else - fprintf_filtered (gdb_stderr, "%s\n", msg.c_str ()); + fputs_filtered (_("During symbol reading: "), gdb_stderr); + vfprintf_filtered (gdb_stderr, fmt, args); + fputs_filtered ("\n", gdb_stderr); } - /* If GDB dumps core, we'd like to see the complaints first. - Presumably GDB will not be sending so many complaints that this - becomes a performance hog. */ - - gdb_flush (gdb_stderr); va_end (args); } -/* Clear out / initialize all complaint counters that have ever been - incremented. If LESS_VERBOSE is 1, be less verbose about - successive complaints, since the messages are appearing all - together during a command that is reporting a contiguous block of - complaints (rather than being interleaved with other messages). */ +/* See complaints.h. */ void -clear_complaints (int less_verbose) +clear_complaints () { counters.clear (); - - if (!less_verbose) - series = ISOLATED_MESSAGE; - else - series = SHORT_FIRST_MESSAGE; } static void diff --git a/gdb/complaints.h b/gdb/complaints.h index 243eaed93c..edb007fb97 100644 --- a/gdb/complaints.h +++ b/gdb/complaints.h @@ -40,14 +40,9 @@ extern void complaint_internal (const char *fmt, ...) while (0) /* Clear out / initialize all complaint counters that have ever been - incremented. If LESS_VERBOSE is 1, be less verbose about - successive complaints, since the messages are appearing all - together during a command that is reporting a contiguous block of - complaints (rather than being interleaved with other messages). If - noisy is 1, we are in a noisy command, and our caller will print - enough context for the user to figure it out. */ + incremented. */ -extern void clear_complaints (int less_verbose); +extern void clear_complaints (); #endif /* !defined (COMPLAINTS_H) */ diff --git a/gdb/symfile.c b/gdb/symfile.c index 981bf336ce..6a1140edbc 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -989,7 +989,7 @@ syms_from_objfile_1 (struct objfile *objfile, initial symbol reading for this file. */ (*objfile->sf->sym_init) (objfile); - clear_complaints (1); + clear_complaints (); (*objfile->sf->sym_offsets) (objfile, *addrs); @@ -1036,7 +1036,7 @@ finish_new_objfile (struct objfile *objfile, symfile_add_flags add_flags) } /* We're done reading the symbol file; finish off complaints. */ - clear_complaints (0); + clear_complaints (); } /* Process a symbol file, as either the main file or as a dynamically @@ -2540,7 +2540,7 @@ reread_symbols (void) } (*objfile->sf->sym_init) (objfile); - clear_complaints (1); + clear_complaints (); objfile->flags &= ~OBJF_PSYMTABS_READ; @@ -2570,7 +2570,7 @@ reread_symbols (void) } /* We're done reading the symbol file; finish off complaints. */ - clear_complaints (0); + clear_complaints (); /* Getting new symbols may change our opinion about what is frameless. */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b26a24267b..e088cb6041 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-10-04 Tom Tromey + + * gdb.cp/maint.exp (test_invalid_name): Update expected output. + * gdb.gdb/complaints.exp (test_short_complaints): Remove. + (test_initial_complaints, test_empty_complaints): Update. + * gdb.dwarf2/dw2-stack-boundary.exp: Update. + 2018-10-04 Tom Tromey PR cli/19551: diff --git a/gdb/testsuite/gdb.cp/maint.exp b/gdb/testsuite/gdb.cp/maint.exp index 72a752487f..af5b5be938 100644 --- a/gdb/testsuite/gdb.cp/maint.exp +++ b/gdb/testsuite/gdb.cp/maint.exp @@ -51,7 +51,7 @@ proc test_single_component {name} { proc test_invalid_name {name} { set matchname [string_to_regexp "$name"] gdb_test "maint cp first_component $name" \ - "During symbol reading, unexpected demangled name '$matchname'.\r\n$matchname" + "During symbol reading: unexpected demangled name '$matchname'\r\n$matchname" } proc test_first_component {} { diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp index cce8b4dd11..e63f9c1e8c 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp @@ -38,7 +38,7 @@ if [is_remote host] { } } gdb_test_no_output "set complaints 100" -gdb_test "file $binfile" {Reading symbols from .*\.\.\.\r\nlocation description stack underflow\r\nlocation description stack overflow} "check partial symtab errors" +gdb_test "file $binfile" {Reading symbols from .*\.\.\.\r\nDuring symbol reading: location description stack underflow\r\nDuring symbol reading: location description stack overflow} "check partial symtab errors" gdb_test "p underflow" {Asked for position 0 of stack, stack only has 0 elements on it\.} gdb_test "p overflow" " = 2" diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp index 33ec268949..8f573bed3e 100644 --- a/gdb/testsuite/gdb.gdb/complaints.exp +++ b/gdb/testsuite/gdb.gdb/complaints.exp @@ -62,37 +62,17 @@ proc test_initial_complaints { } { # Prime the system gdb_test_stdio \ "call complaint_internal (\$cstr)" \ - "During symbol reading, Register a complaint." + "During symbol reading: Register a complaint" # Re-issue the first message #1 gdb_test_stdio \ "call complaint_internal (\$cstr)" \ - "During symbol reading, Register a complaint." + "During symbol reading: Register a complaint" # Add a second complaint, expect it gdb_test_stdio \ "call complaint_internal (\"Testing! Testing! Testing!\")" \ - "During symbol reading, Testing. Testing. Testing.." - - return 0 -} - -# For short complaints, all are the same - -proc test_short_complaints { } { - gdb_test_exact "call clear_complaints (1)" "" "short start" - - # Prime the system - test_complaint \ - "call complaint_internal (\"short line 1\")" \ - "short line 1" \ - "short line 1" - - # Add a second complaint, expect it - test_complaint \ - "call complaint_internal (\"short line 2\")" \ - "short line 2" \ - "short line 2" + "During symbol reading: Testing. Testing. Testing." return 0 } @@ -123,16 +103,13 @@ proc test_empty_complaint { cmd msg } { proc test_empty_complaints { } { - test_empty_complaint "call clear_complaints(0)" \ - "empty non-verbose clear" - test_empty_complaint "call clear_complaints(1)" \ - "empty verbose clear" + test_empty_complaint "call clear_complaints()" \ + "clear complaints" return 0 } do_self_tests captured_command_loop { test_initial_complaints - test_short_complaints test_empty_complaints }