public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA 9/9] Remove struct complaints
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
@ 2018-05-22  5:07 ` Tom Tromey
  2018-05-22  5:07 ` [RFA 2/9] Remove elements from complaint_series Tom Tromey
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

struct complaints now just holds a single enum value, so remove it and
symfile_complaint_book and replace it with a global variable.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (struct complaints): Remove.
	(symfile_complaint_book): Remove.
	(series): New global.
	(complaint_internal): Update.
	(clear_complaints): Update.
---
 gdb/ChangeLog    |  8 ++++++++
 gdb/complaints.c | 15 ++++-----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index 2c69b8ca2c..1bf99d40f0 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -39,14 +39,9 @@ enum complaint_series {
 
 static std::unordered_map<const char *, int> counters;
 
-struct complaints
-{
-  enum complaint_series series;
-};
+/* How to print the next complaint.  */
 
-static struct complaints symfile_complaint_book = {
-  ISOLATED_MESSAGE
-};
+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,
@@ -60,13 +55,11 @@ void
 complaint_internal (const char *fmt, ...)
 {
   va_list args;
-  enum complaint_series series;
 
   if (counters[fmt]++ > stop_whining)
     return;
 
   va_start (args, fmt);
-  series = symfile_complaint_book.series;
 
   if (deprecated_warning_hook)
     (*deprecated_warning_hook) (fmt, args);
@@ -104,9 +97,9 @@ clear_complaints (int less_verbose)
   counters.clear ();
 
   if (!less_verbose)
-    symfile_complaint_book.series = ISOLATED_MESSAGE;
+    series = ISOLATED_MESSAGE;
   else
-    symfile_complaint_book.series = SHORT_FIRST_MESSAGE;
+    series = SHORT_FIRST_MESSAGE;
 }
 
 static void
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 2/9] Remove elements from complaint_series
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
  2018-05-22  5:07 ` [RFA 9/9] Remove struct complaints Tom Tromey
@ 2018-05-22  5:07 ` Tom Tromey
  2018-05-22  5:08 ` [RFA 6/9] Remove vcomplaint Tom Tromey
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I couldn't find a way to get complaints to use a couple of cases, and
the difference between the actual printed output for these cases was
minimal anyway.  So, this patch removes a couple of constants from
complaint_series, plus the associated code.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (enum complaint_series): Remove FIRST_MESSAGE,
	SUBSEQUENT_MESSAGE.
	(vcomplaint, clear_complaints): Update.
	(symfile_explanations): Remove some messages.

gdb/testsuite/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* gdb.gdb/complaints.exp (test_serial_complaints): Remove.
	(test_short_complaints): Update.
---
 gdb/ChangeLog                        |  7 +++++
 gdb/complaints.c                     | 60 ++----------------------------------
 gdb/testsuite/ChangeLog              |  5 +++
 gdb/testsuite/gdb.gdb/complaints.exp | 29 -----------------
 4 files changed, 15 insertions(+), 86 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index 9e5df396eb..71d36e6326 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -29,17 +29,9 @@ enum complaint_series {
   /* Isolated self explanatory message.  */
   ISOLATED_MESSAGE,
 
-  /* First message of a series, includes an explanation.  */
-  FIRST_MESSAGE,
-
   /* First message of a series, but does not need to include any sort
      of explanation.  */
   SHORT_FIRST_MESSAGE,
-
-  /* Subsequent message of a series that needs no explanation (the
-     user already knows we have a problem so we can just state our
-     piece).  */
-  SUBSEQUENT_MESSAGE
 };
 
 /* Structure to manage complaints about symbol file contents.  */
@@ -82,8 +74,6 @@ static struct complain complaint_sentinel;
 
 static struct explanation symfile_explanations[] = {
   { "During symbol reading, ", "." },
-  { "During symbol reading...", "..."},
-  { "", "..."},
   { "", "..."},
   { NULL, NULL }
 };
@@ -169,10 +159,7 @@ vcomplaint (struct complaints **c, const char *file,
   if (complaint->counter > stop_whining)
     return;
 
-  if (info_verbose)
-    series = SUBSEQUENT_MESSAGE;
-  else
-    series = complaints->series;
+  series = complaints->series;
 
   /* Pass 'fmt' instead of 'complaint->fmt' to printf-like callees
      from here on, to avoid "format string is not a string literal"
@@ -194,16 +181,13 @@ vcomplaint (struct complaints **c, const char *file,
 	{
 	  std::string msg = string_vprintf (fmt, args);
 	  wrap_here ("");
-	  if (series != SUBSEQUENT_MESSAGE)
-	    begin_line ();
+	  begin_line ();
 	  /* XXX: i18n */
 	  fprintf_filtered (gdb_stderr, "%s%s%s",
 			    complaints->explanation[series].prefix,
 			    msg.c_str (),
 			    complaints->explanation[series].postfix);
-	  /* Force a line-break after any isolated message.  For the
-             other cases, clear_complaints() takes care of any missing
-             trailing newline, the wrap_here() is just a hint.  */
+	  /* Force a line-break after any isolated message.  */
 	  if (series == ISOLATED_MESSAGE)
 	    /* It would be really nice to use begin_line() here.
 	       Unfortunately that function doesn't track GDB_STDERR and
@@ -215,19 +199,6 @@ vcomplaint (struct complaints **c, const char *file,
 	}
     }
 
-  switch (series)
-    {
-    case ISOLATED_MESSAGE:
-      break;
-    case FIRST_MESSAGE:
-      complaints->series = SUBSEQUENT_MESSAGE;
-      break;
-    case SUBSEQUENT_MESSAGE:
-    case SHORT_FIRST_MESSAGE:
-      complaints->series = SUBSEQUENT_MESSAGE;
-      break;
-    }
-
   /* 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.  */
@@ -264,33 +235,8 @@ clear_complaints (struct complaints **c, int less_verbose, int noisy)
       p->counter = 0;
     }
 
-  switch (complaints->series)
-    {
-    case FIRST_MESSAGE:
-      /* Haven't yet printed anything.  */
-      break;
-    case SHORT_FIRST_MESSAGE:
-      /* Haven't yet printed anything.  */
-      break;
-    case ISOLATED_MESSAGE:
-      /* The code above, always forces a line-break.  No need to do it
-         here.  */
-      break;
-    case SUBSEQUENT_MESSAGE:
-      /* It would be really nice to use begin_line() here.
-         Unfortunately that function doesn't track GDB_STDERR and
-         consequently will sometimes supress a line when it
-         shouldn't.  */
-      fputs_unfiltered ("\n", gdb_stderr);
-      break;
-    default:
-      internal_error (__FILE__, __LINE__, _("bad switch"));
-    }
-
   if (!less_verbose)
     complaints->series = ISOLATED_MESSAGE;
-  else if (!noisy)
-    complaints->series = FIRST_MESSAGE;
   else
     complaints->series = SHORT_FIRST_MESSAGE;
 }
diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index 56c3003b53..1d532b7fd6 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -85,29 +85,6 @@ proc test_initial_complaints { } {
     return 0
 }
 
-proc test_serial_complaints { } {
-    gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 0)" "" "serial start"
-
-    # Prime the system
-    test_complaint \
-	"call complaint_internal (&symfile_complaints, \"serial line 1\")" \
-	"During symbol reading...serial line 1..." \
-	"serial line 1"
-
-    # Add a second complaint, expect it
-    test_complaint \
-	"call complaint_internal (&symfile_complaints, \"serial line 2\")" \
-	"serial line 2..." \
-	"serial line 2"
-
-    gdb_test_stdio "call clear_complaints (&symfile_complaints, 1, 0)" \
-	"\r\n" \
-	"" \
-	"serial end"
-
-    return 0
-}
-
 # For short complaints, all are the same
 
 proc test_short_complaints { } {
@@ -125,11 +102,6 @@ proc test_short_complaints { } {
 	"short line 2..." \
 	"short line 2"
 
-    gdb_test_stdio "call clear_complaints (&symfile_complaints, 1, 0)" \
-	"\r\n" \
-	"" \
-	"short end"
-
     return 0
 }
 
@@ -173,7 +145,6 @@ proc test_empty_complaints { } {
 
 do_self_tests captured_command_loop {
     test_initial_complaints
-    test_serial_complaints
     test_short_complaints
     test_empty_complaints
 }
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 5/9] Remove struct explanation
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
                   ` (2 preceding siblings ...)
  2018-05-22  5:08 ` [RFA 6/9] Remove vcomplaint Tom Tromey
@ 2018-05-22  5:08 ` Tom Tromey
  2018-05-22  5:09 ` [RFA 4/9] Remove symfile_complaints Tom Tromey
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Now that there's only a single reason for a complaint to be emitted,
this removes "struct explanation" and changes vcomplaint to emit the
desired messages directly.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (struct complaints) <explanation>: Remove.
	(symfile_explanations): Remove.
	(symfile_complaint_book): Update.
	(vcomplaint): Update.
	(struct explanation): Remove.
---
 gdb/ChangeLog    |  8 ++++++++
 gdb/complaints.c | 56 ++++++++------------------------------------------------
 2 files changed, 16 insertions(+), 48 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index 70e297a1d3..eab7607deb 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -45,43 +45,18 @@ struct complain
   struct complain *next;
 };
 
-/* The explanatory message that should accompany the complaint.  The
-   message is in two parts - pre and post - that are printed around
-   the complaint text.  */
-struct explanation
-{
-  const char *prefix;
-  const char *postfix;
-};
-
 struct complaints
 {
   struct complain *root;
 
   enum complaint_series series;
-
-  /* The explanatory messages that should accompany the complaint.
-     NOTE: cagney/2002-08-14: In a desperate attempt at being vaguely
-     i18n friendly, this is an array of two messages.  When present,
-     the PRE and POST EXPLANATION[SERIES] are used to wrap the
-     message.  */
-  const struct explanation *explanation;
 };
 
 static struct complain complaint_sentinel;
 
-/* The symbol table complaint table.  */
-
-static struct explanation symfile_explanations[] = {
-  { "During symbol reading, ", "." },
-  { "", "..."},
-  { NULL, NULL }
-};
-
 static struct complaints symfile_complaint_book = {
   &complaint_sentinel,
-  ISOLATED_MESSAGE,
-  symfile_explanations
+  ISOLATED_MESSAGE
 };
 
 static struct complain * ATTRIBUTE_PRINTF (4, 0)
@@ -156,29 +131,14 @@ vcomplaint (const char *file,
     (*deprecated_warning_hook) (fmt, args);
   else
     {
-      if (symfile_complaint_book.explanation == NULL)
-	/* A [v]warning() call always appends a newline.  */
-	vwarning (fmt, args);
+      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
-	{
-	  std::string msg = string_vprintf (fmt, args);
-	  wrap_here ("");
-	  begin_line ();
-	  /* XXX: i18n */
-	  fprintf_filtered (gdb_stderr, "%s%s%s",
-			    symfile_complaint_book.explanation[series].prefix,
-			    msg.c_str (),
-			    symfile_complaint_book.explanation[series].postfix);
-	  /* Force a line-break after any isolated message.  */
-	  if (series == ISOLATED_MESSAGE)
-	    /* It would be really nice to use begin_line() here.
-	       Unfortunately that function doesn't track GDB_STDERR and
-	       consequently will sometimes supress a line when it
-	       shouldn't.  */
-	    fputs_filtered ("\n", gdb_stderr);
-	  else
-	    wrap_here ("");
-	}
+	fprintf_filtered (gdb_stderr, "%s...", msg.c_str ());
     }
 
   /* If GDB dumps core, we'd like to see the complaints first.
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 6/9] Remove vcomplaint
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
  2018-05-22  5:07 ` [RFA 9/9] Remove struct complaints Tom Tromey
  2018-05-22  5:07 ` [RFA 2/9] Remove elements from complaint_series Tom Tromey
@ 2018-05-22  5:08 ` Tom Tromey
  2018-05-22  5:08 ` [RFA 5/9] Remove struct explanation Tom Tromey
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

vcomplaint now has a single caller, so merge it with that caller.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (vcomplaint): Remove.
	(complaint_internal) Merge in contents of vcomplaint.
---
 gdb/ChangeLog    |  5 +++++
 gdb/complaints.c | 25 ++++++++-----------------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index eab7607deb..4b7532582f 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -100,22 +100,22 @@ find_complaint (struct complaints *complaints, const char *file,
 
 int stop_whining = 0;
 
-/* Print a complaint, and link the complaint block into a chain for
-   later handling.  */
+/* See complaints.h.  */
 
-static void ATTRIBUTE_PRINTF (3, 0)
-vcomplaint (const char *file, 
-	    int line, const char *fmt,
-	    va_list args)
+void
+complaint_internal (const char *fmt, ...)
 {
-  struct complain *complaint = find_complaint (&symfile_complaint_book, file, 
-					       line, fmt);
+  va_list args;
+
+  struct complain *complaint = find_complaint (&symfile_complaint_book, NULL,
+					       0, fmt);
   enum complaint_series series;
 
   complaint->counter++;
   if (complaint->counter > stop_whining)
     return;
 
+  va_start (args, fmt);
   series = symfile_complaint_book.series;
 
   /* Pass 'fmt' instead of 'complaint->fmt' to printf-like callees
@@ -146,15 +146,6 @@ vcomplaint (const char *file,
      becomes a performance hog.  */
 
   gdb_flush (gdb_stderr);
-}
-
-void
-complaint_internal (const char *fmt, ...)
-{
-  va_list args;
-
-  va_start (args, fmt);
-  vcomplaint (NULL/*file*/, 0/*line*/, fmt, args);
   va_end (args);
 }
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 8/9] Remove struct complain
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
                   ` (4 preceding siblings ...)
  2018-05-22  5:09 ` [RFA 4/9] Remove symfile_complaints Tom Tromey
@ 2018-05-22  5:09 ` Tom Tromey
  2018-05-22  5:09 ` [RFA 1/9] Remove internal_complaint Tom Tromey
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

At this point, struct complain is just holds a key, a value, and a
"next" pointer to form a linked list.  It's simpler to replace this
with an unordered map.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (counters): New global.
	(struct complain): Remove.
	(struct complaints) <root>: Remove.
	(complaint_sentinel): Remove.
	(symfile_complaint_book): Update.
	(find_complaint) Remove.
	(complaint_internal, clear_complaints): Update.

gdb/testsuite/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* gdb.gdb/complaints.exp (test_initial_complaints): Simplify.
---
 gdb/ChangeLog                        | 10 ++++++
 gdb/complaints.c                     | 62 +++---------------------------------
 gdb/testsuite/ChangeLog              |  4 +++
 gdb/testsuite/gdb.gdb/complaints.exp | 16 +++-------
 4 files changed, 23 insertions(+), 69 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index 851d8f5d6f..2c69b8ca2c 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -21,6 +21,7 @@
 #include "complaints.h"
 #include "command.h"
 #include "gdbcmd.h"
+#include <unordered_map>
 
 /* Should each complaint message be self explanatory, or should we
    assume that a series of complaints is being produced?  */
@@ -34,59 +35,19 @@ enum complaint_series {
   SHORT_FIRST_MESSAGE,
 };
 
-/* Structure to manage complaints about symbol file contents.  */
+/* Map format strings to counters.  */
 
-struct complain
-{
-  const char *fmt;
-  int counter;
-  struct complain *next;
-};
+static std::unordered_map<const char *, int> counters;
 
 struct complaints
 {
-  struct complain *root;
-
   enum complaint_series series;
 };
 
-static struct complain complaint_sentinel;
-
 static struct complaints symfile_complaint_book = {
-  &complaint_sentinel,
   ISOLATED_MESSAGE
 };
 
-static struct complain * ATTRIBUTE_PRINTF (2, 0)
-find_complaint (struct complaints *complaints, const char *fmt)
-{
-  struct complain *complaint;
-
-  /* Find the complaint in the table.  A more efficient search
-     algorithm (based on hash table or something) could be used.  But
-     that can wait until someone shows evidence that this lookup is
-     a real bottle neck.  */
-  for (complaint = complaints->root;
-       complaint != NULL;
-       complaint = complaint->next)
-    {
-      if (complaint->fmt == fmt)
-	return complaint;
-    }
-
-  /* Oops not seen before, fill in a new complaint.  */
-  complaint = XNEW (struct complain);
-  complaint->fmt = fmt;
-  complaint->counter = 0;
-  complaint->next = NULL;
-
-  /* File it, return it.  */
-  complaint->next = complaints->root;
-  complaints->root = complaint;
-  return complaint;
-}
-
-
 /* 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.  */
@@ -99,24 +60,14 @@ void
 complaint_internal (const char *fmt, ...)
 {
   va_list args;
-
-  struct complain *complaint = find_complaint (&symfile_complaint_book, fmt);
   enum complaint_series series;
 
-  complaint->counter++;
-  if (complaint->counter > stop_whining)
+  if (counters[fmt]++ > stop_whining)
     return;
 
   va_start (args, fmt);
   series = symfile_complaint_book.series;
 
-  /* Pass 'fmt' instead of 'complaint->fmt' to printf-like callees
-     from here on, to avoid "format string is not a string literal"
-     warnings.  'fmt' is this function's printf-format parameter, so
-     the compiler can assume the passed in argument is a literal
-     string somewhere up the call chain.  */
-  gdb_assert (complaint->fmt == fmt);
-
   if (deprecated_warning_hook)
     (*deprecated_warning_hook) (fmt, args);
   else
@@ -150,10 +101,7 @@ clear_complaints (int less_verbose)
 {
   struct complain *p;
 
-  for (p = symfile_complaint_book.root; p != NULL; p = p->next)
-    {
-      p->counter = 0;
-    }
+  counters.clear ();
 
   if (!less_verbose)
     symfile_complaint_book.series = ISOLATED_MESSAGE;
diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index 886b43521d..65b6bdc281 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -57,26 +57,18 @@ proc test_initial_complaints { } {
     # Unsupress complaints
     gdb_test "set stop_whining = 2"
 
+    gdb_test_no_output "set var \$cstr = \"Register a complaint\""
+
     # Prime the system
     gdb_test_stdio \
-	"call complaint_internal (\"Register a complaint\")" \
+	"call complaint_internal (\$cstr)" \
 	"During symbol reading, Register a complaint."
 
-    # Check that the complaint was inserted and where
-    gdb_test "print symfile_complaint_book.root->fmt" \
-	    ".\[0-9\]+ =.*\"Register a complaint\""
-
     # Re-issue the first message #1
     gdb_test_stdio \
-	"call complaint_internal (symfile_complaint_book.root->fmt)" \
+	"call complaint_internal (\$cstr)" \
 	"During symbol reading, Register a complaint."
 
-    # Check that there is only one thing in the list.  How the boolean
-    # result is output depends on whether GDB is built as a C or C++
-    # program.
-    gdb_test "print symfile_complaint_book.root->next == &complaint_sentinel" \
-	    ".\[0-9\]+ = \(1|true\)" "list has one entry"
-
     # Add a second complaint, expect it
     gdb_test_stdio \
 	"call complaint_internal (\"Testing! Testing! Testing!\")" \
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 0/9] Radically simplify the complaint system
@ 2018-05-22  5:09 Tom Tromey
  2018-05-22  5:07 ` [RFA 9/9] Remove struct complaints Tom Tromey
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:09 UTC (permalink / raw)
  To: gdb-patches

I must confess, I've long disliked the complaint system.  It got in
the way a little bit, ages ago, when I tried to multi-thread the
psymtab reader.  And, it got in the way a bit more during one of my
attempts to format the "Reading symbols" output more nicely (spoiler:
I have another approach to this in the works, but I took this detour
first).  Aside from these things, the code also seemed unusually
complex for the task it performed.

This series radically simplifies the complaint system.  It removes
most of the code -- which, I think, has never really been used.

Tested by the buildbot.  I also locally tested complaints.exp with
each patch in the series.

Tom

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 4/9] Remove symfile_complaints
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
                   ` (3 preceding siblings ...)
  2018-05-22  5:08 ` [RFA 5/9] Remove struct explanation Tom Tromey
@ 2018-05-22  5:09 ` Tom Tromey
  2018-05-22  5:09 ` [RFA 8/9] Remove struct complain Tom Tromey
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

The complaint system seems to allow for multiple different complaint
topics.  However, in practice only symfile_complaints has ever been
defined.  Seeing that complaints.c dates to 1992, and that no new
complaints have been added in the intervening years, I think it is
reasonable to admit that complaints are specifically related to
debuginfo reading.

This patch removes symfile_complaints and updates all the callers.
Some of these spots should perhaps be calls to warning instead, but I
did not make that change.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (symfile_complaints): Remove.
	(complaint_internal): Remove "complaints" parameter.
	(clear_complaints, vcomplaint): Remove "c" parameter.
	(get_complaints): Remove.
	* dwarf2read.c (dwarf2_statement_list_fits_in_line_number_section_complaint)
	(dwarf2_debug_line_missing_file_complaint)
	(dwarf2_debug_line_missing_end_sequence_complaint)
	(dwarf2_complex_location_expr_complaint)
	(dwarf2_const_value_length_mismatch_complaint)
	(dwarf2_section_buffer_overflow_complaint)
	(dwarf2_macro_malformed_definition_complaint)
	(dwarf2_invalid_attrib_class_complaint)
	(create_addrmap_from_index, dw2_symtab_iter_next)
	(dw2_expand_marked_cus)
	(dw2_debug_names_iterator::find_vec_in_debug_names)
	(dw2_debug_names_iterator::next, dw2_debug_names_iterator::next)
	(create_debug_type_hash_table, init_cutu_and_read_dies)
	(partial_die_parent_scope, add_partial_enumeration)
	(skip_one_die, fixup_go_packaging, quirk_rust_enum, process_die)
	(dwarf2_compute_name, dwarf2_physname, read_namespace_alias)
	(read_import_statement, read_file_scope, create_dwo_cu_reader)
	(create_cus_hash_table, create_dwp_hash_table)
	(inherit_abstract_dies, read_func_scope, read_call_site_scope)
	(dwarf2_rnglists_process, dwarf2_ranges_process)
	(dwarf2_add_type_defn, dwarf2_attach_fields_to_type)
	(dwarf2_add_member_fn, get_alignment, maybe_set_alignment)
	(handle_struct_member_die, process_structure_scope)
	(read_array_type, read_common_block, read_module_type)
	(read_tag_pointer_type, read_typedef, read_base_type)
	(read_subrange_type, load_partial_dies, partial_die_info::read)
	(partial_die_info::read, partial_die_info::read)
	(partial_die_info::read, read_checked_initial_length_and_offset)
	(dwarf2_string_attr, read_formatted_entries)
	(dwarf_decode_line_header)
	(lnp_state_machine::check_line_address, dwarf_decode_lines_1)
	(new_symbol, dwarf2_const_value_attr, lookup_die_type)
	(read_type_die_1, determine_prefix, dwarf2_get_ref_die_offset)
	(dwarf2_get_attr_constant_value, dwarf2_fetch_constant_bytes)
	(get_signatured_type, get_DW_AT_signature_type)
	(decode_locdesc, file_file_name, consume_improper_spaces)
	(skip_form_bytes, skip_unknown_opcode, dwarf_parse_macro_header)
	(dwarf_decode_macro_bytes, dwarf_decode_macros)
	(dwarf2_symbol_mark_computed, set_die_type)
	(read_attribute_value): Update.
	* stap-probe.c (handle_stap_probe, get_stap_base_address):
	Update.
	* dbxread.c (unknown_symtype_complaint)
	(lbrac_mismatch_complaint, repeated_header_complaint)
	(set_namestring, function_outside_compilation_unit_complaint)
	(read_dbx_symtab, process_one_symbol): Update.
	* gdbtypes.c (stub_noname_complaint): Update.
	* windows-nat.c (handle_unload_dll): Update.
	* coffread.c (coff_symtab_read, enter_linenos, decode_type)
	(decode_base_type): Update.
	* xcoffread.c (bf_notfound_complaint, ef_complaint)
	(eb_complaint, record_include_begin, record_include_end)
	(enter_line_range, xcoff_next_symbol_text, read_xcoff_symtab)
	(process_xcoff_symbol, read_symbol)
	(function_outside_compilation_unit_complaint)
	(scan_xcoff_symtab): Update.
	* machoread.c (macho_symtab_read, macho_add_oso_symfile): Update.
	* buildsym.c (finish_block_internal, make_blockvector)
	(end_symtab_get_static_block, augment_type_symtab): Update.
	* dtrace-probe.c (dtrace_process_dof)
	(dtrace_static_probe_ops::get_probes): Update.
	* complaints.h (struct complaint): Don't declare.
	(symfile_complaints): Remove.
	(complaint_internal): Remove "complaints" parameter.
	(complaint): Likewise.
	(clear_complaints): Likewise.
	* symfile.c (syms_from_objfile_1, finish_new_objfile)
	(reread_symbols): Update.
	* dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program)
	(dwarf2_frame_cache, decode_frame_entry): Update.
	* dwarf2loc.c (dwarf_reg_to_regnum): Update.
	* objc-lang.c (lookup_objc_class, lookup_child_selector)
	(info_selectors_command): Update.
	* macrotab.c (macro_include, check_for_redefinition)
	(macro_undef): Update.
	* objfiles.c (filter_overlapping_sections): Update.
	* stabsread.c (invalid_cpp_abbrev_complaint)
	(reg_value_complaint, stabs_general_complaint, dbx_lookup_type)
	(define_symbol, error_type, read_type, rs6000_builtin_type)
	(stabs_method_name_from_physname, read_member_functions)
	(read_cpp_abbrev, read_baseclasses, read_tilde_fields)
	(attach_fields_to_type, complain_about_struct_wipeout)
	(read_range_type, read_args, common_block_start)
	(common_block_end, cleanup_undefined_types_1, scan_file_globals):
	Update.
	* mdebugread.c (index_complaint, unknown_ext_complaint)
	(basic_type_complaint, bad_tag_guess_complaint)
	(bad_rfd_entry_complaint, unexpected_type_code_complaint)
	(reg_value_complaint, parse_symbol, parse_type, upgrade_type)
	(parse_procedure, parse_lines)
	(function_outside_compilation_unit_complaint)
	(parse_partial_symbols, psymtab_to_symtab_1, cross_ref)
	(bad_tag_guess_complaint, reg_value_complaint): Update.
	* cp-support.c (demangled_name_complaint): Update.
	* macroscope.c (sal_macro_scope): Update.
	* dwarf-index-write.c (class debug_names): Update.

gdb/testsuite/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* gdb.gdb/complaints.exp (test_initial_complaints): Don't mention
	symfile_complaints.
	(test_short_complaints): Likewise.
	(test_empty_complaints): Likewise.
	(test_initial_complaints): Update.
---
 gdb/ChangeLog                        | 103 +++++++++
 gdb/buildsym.c                       |  27 +--
 gdb/coffread.c                       |  30 +--
 gdb/complaints.c                     |  45 ++--
 gdb/complaints.h                     |  15 +-
 gdb/cp-support.c                     |   3 +-
 gdb/dbxread.c                        |  29 +--
 gdb/dtrace-probe.c                   |   6 +-
 gdb/dwarf-index-write.c              |   3 +-
 gdb/dwarf2-frame.c                   |  13 +-
 gdb/dwarf2loc.c                      |   3 +-
 gdb/dwarf2read.c                     | 417 ++++++++++++-----------------------
 gdb/gdbtypes.c                       |   2 +-
 gdb/machoread.c                      |  26 +--
 gdb/macroscope.c                     |   3 +-
 gdb/macrotab.c                       |  12 +-
 gdb/mdebugread.c                     |  88 +++-----
 gdb/objc-lang.c                      |   9 +-
 gdb/objfiles.c                       |   3 +-
 gdb/stabsread.c                      |  73 +++---
 gdb/stap-probe.c                     |   8 +-
 gdb/symfile.c                        |   8 +-
 gdb/testsuite/ChangeLog              |   8 +
 gdb/testsuite/gdb.gdb/complaints.exp |  20 +-
 gdb/windows-nat.c                    |   2 +-
 gdb/xcoffread.c                      |  36 ++-
 26 files changed, 427 insertions(+), 565 deletions(-)

diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 5d38cb250f..a5fcf7d942 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -445,15 +445,13 @@ finish_block_internal (struct symbol *symbol,
     {
       if (symbol)
 	{
-	  complaint (&symfile_complaints,
-		     _("block end address less than block "
+	  complaint (_("block end address less than block "
 		       "start address in %s (patched it)"),
 		     SYMBOL_PRINT_NAME (symbol));
 	}
       else
 	{
-	  complaint (&symfile_complaints,
-		     _("block end address %s less than block "
+	  complaint (_("block end address %s less than block "
 		       "start address %s (patched it)"),
 		     paddress (gdbarch, BLOCK_END (block)),
 		     paddress (gdbarch, BLOCK_START (block)));
@@ -485,14 +483,12 @@ finish_block_internal (struct symbol *symbol,
 	    {
 	      if (symbol)
 		{
-		  complaint (&symfile_complaints,
-			     _("inner block not inside outer block in %s"),
+		  complaint (_("inner block not inside outer block in %s"),
 			     SYMBOL_PRINT_NAME (symbol));
 		}
 	      else
 		{
-		  complaint (&symfile_complaints,
-			     _("inner block (%s-%s) not "
+		  complaint (_("inner block (%s-%s) not "
 			       "inside outer block (%s-%s)"),
 			     paddress (gdbarch, BLOCK_START (pblock->block)),
 			     paddress (gdbarch, BLOCK_END (pblock->block)),
@@ -653,7 +649,7 @@ make_blockvector (void)
 	      CORE_ADDR start
 		= BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i));
 
-	      complaint (&symfile_complaints, _("block at %s out of order"),
+	      complaint (_("block at %s out of order"),
 			 hex_string ((LONGEST) start));
 	    }
 	}
@@ -1237,8 +1233,7 @@ end_symtab_get_static_block (CORE_ADDR end_addr, int expandable, int required)
 	     same.  FIXME: Find out why it is happening.  This is not
 	     believed to happen in most cases (even for coffread.c);
 	     it used to be an abort().  */
-	  complaint (&symfile_complaints,
-	             _("Context stack not empty in end_symtab"));
+	  complaint (_("Context stack not empty in end_symtab"));
 	  context_stack_depth = 0;
 	}
     }
@@ -1585,17 +1580,15 @@ augment_type_symtab (void)
 
   if (context_stack_depth > 0)
     {
-      complaint (&symfile_complaints,
-		 _("Context stack not empty in augment_type_symtab"));
+      complaint (_("Context stack not empty in augment_type_symtab"));
       context_stack_depth = 0;
     }
   if (pending_blocks != NULL)
-    complaint (&symfile_complaints, _("Blocks in a type symtab"));
+    complaint (_("Blocks in a type symtab"));
   if (pending_macros != NULL)
-    complaint (&symfile_complaints, _("Macro in a type symtab"));
+    complaint (_("Macro in a type symtab"));
   if (have_line_numbers)
-    complaint (&symfile_complaints,
-	       _("Line numbers recorded in a type symtab"));
+    complaint (_("Line numbers recorded in a type symtab"));
 
   if (file_symbols != NULL)
     {
diff --git a/gdb/coffread.c b/gdb/coffread.c
index f24ec0713a..5345fb7998 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -896,8 +896,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
 	case C_LINE:
 	case C_ALIAS:
 	case C_HIDDEN:
-	  complaint (&symfile_complaints,
-		     _("Bad n_sclass for symbol %s"),
+	  complaint (_("Bad n_sclass for symbol %s"),
 		     cs->c_name);
 	  break;
 
@@ -1066,8 +1065,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
 	      /* main_aux.x_sym.x_misc.x_lnsz.x_lnno
 	         contains line number of '{' }.  */
 	      if (cs->c_naux != 1)
-		complaint (&symfile_complaints,
-			   _("`.bf' symbol %d has no aux entry"),
+		complaint (_("`.bf' symbol %d has no aux entry"),
 			   cs->c_symnum);
 	      fcn_first_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
 	      fcn_first_line_addr = cs->c_value;
@@ -1093,8 +1091,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
 
 	      if (context_stack_depth <= 0)
 		{	/* We attempted to pop an empty context stack.  */
-		  complaint (&symfile_complaints,
-			     _("`.ef' symbol without matching `.bf' "
+		  complaint (_("`.ef' symbol without matching `.bf' "
 			       "symbol ignored starting at symnum %d"),
 			     cs->c_symnum);
 		  within_function = 0;
@@ -1105,8 +1102,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
 	      /* Stack must be empty now.  */
 	      if (context_stack_depth > 0 || newobj == NULL)
 		{
-		  complaint (&symfile_complaints,
-			     _("Unmatched .ef symbol(s) ignored "
+		  complaint (_("Unmatched .ef symbol(s) ignored "
 			       "starting at symnum %d"),
 			     cs->c_symnum);
 		  within_function = 0;
@@ -1114,8 +1110,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
 		}
 	      if (cs->c_naux != 1)
 		{
-		  complaint (&symfile_complaints,
-			     _("`.ef' symbol %d has no aux entry"),
+		  complaint (_("`.ef' symbol %d has no aux entry"),
 			     cs->c_symnum);
 		  fcn_last_line = 0x7FFFFFFF;
 		}
@@ -1160,8 +1155,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
 	    {
 	      if (context_stack_depth <= 0)
 		{	/* We attempted to pop an empty context stack.  */
-		  complaint (&symfile_complaints,
-			     _("`.eb' symbol without matching `.bb' "
+		  complaint (_("`.eb' symbol without matching `.bb' "
 			       "symbol ignored starting at symnum %d"),
 			     cs->c_symnum);
 		  break;
@@ -1170,8 +1164,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
 	      newobj = pop_context ();
 	      if (depth-- != newobj->depth)
 		{
-		  complaint (&symfile_complaints,
-			     _("Mismatched .eb symbol ignored "
+		  complaint (_("Mismatched .eb symbol ignored "
 			       "starting at symnum %d"),
 			     symnum);
 		  break;
@@ -1480,8 +1473,7 @@ enter_linenos (long file_offset, int first_line,
     return;
   if (file_offset < linetab_offset)
     {
-      complaint (&symfile_complaints,
-		 _("Line number pointer %ld lower than start of line numbers"),
+      complaint (_("Line number pointer %ld lower than start of line numbers"),
 		 file_offset);
       if (file_offset > linetab_size)	/* Too big to be an offset?  */
 	return;
@@ -1877,8 +1869,7 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
 	}
       else
 	{
-	  complaint (&symfile_complaints,
-		     _("Symbol table entry for %s has bad tagndx value"),
+	  complaint (_("Symbol table entry for %s has bad tagndx value"),
 		     cs->c_name);
 	  /* And fall through to decode_base_type...  */
 	}
@@ -2047,8 +2038,7 @@ decode_base_type (struct coff_symbol *cs,
       else
 	return objfile_type (objfile)->builtin_unsigned_long;
     }
-  complaint (&symfile_complaints, 
-	     _("Unexpected type for symbol %s"), cs->c_name);
+  complaint (_("Unexpected type for symbol %s"), cs->c_name);
   return objfile_type (objfile)->builtin_void;
 }
 \f
diff --git a/gdb/complaints.c b/gdb/complaints.c
index d29b3c7830..70e297a1d3 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -83,21 +83,6 @@ static struct complaints symfile_complaint_book = {
   ISOLATED_MESSAGE,
   symfile_explanations
 };
-struct complaints *symfile_complaints = &symfile_complaint_book;
-
-/* Wrapper function to, on-demand, fill in a complaints object.  */
-
-static struct complaints *
-get_complaints (struct complaints **c)
-{
-  if ((*c) != NULL)
-    return (*c);
-  (*c) = XNEW (struct complaints);
-  (*c)->root = &complaint_sentinel;
-  (*c)->series = ISOLATED_MESSAGE;
-  (*c)->explanation = NULL;
-  return (*c);
-}
 
 static struct complain * ATTRIBUTE_PRINTF (4, 0)
 find_complaint (struct complaints *complaints, const char *file,
@@ -143,23 +128,20 @@ int stop_whining = 0;
 /* Print a complaint, and link the complaint block into a chain for
    later handling.  */
 
-static void ATTRIBUTE_PRINTF (4, 0)
-vcomplaint (struct complaints **c, const char *file, 
+static void ATTRIBUTE_PRINTF (3, 0)
+vcomplaint (const char *file, 
 	    int line, const char *fmt,
 	    va_list args)
 {
-  struct complaints *complaints = get_complaints (c);
-  struct complain *complaint = find_complaint (complaints, file, 
+  struct complain *complaint = find_complaint (&symfile_complaint_book, file, 
 					       line, fmt);
   enum complaint_series series;
 
-  gdb_assert (complaints != NULL);
-
   complaint->counter++;
   if (complaint->counter > stop_whining)
     return;
 
-  series = complaints->series;
+  series = symfile_complaint_book.series;
 
   /* Pass 'fmt' instead of 'complaint->fmt' to printf-like callees
      from here on, to avoid "format string is not a string literal"
@@ -174,7 +156,7 @@ vcomplaint (struct complaints **c, const char *file,
     (*deprecated_warning_hook) (fmt, args);
   else
     {
-      if (complaints->explanation == NULL)
+      if (symfile_complaint_book.explanation == NULL)
 	/* A [v]warning() call always appends a newline.  */
 	vwarning (fmt, args);
       else
@@ -184,9 +166,9 @@ vcomplaint (struct complaints **c, const char *file,
 	  begin_line ();
 	  /* XXX: i18n */
 	  fprintf_filtered (gdb_stderr, "%s%s%s",
-			    complaints->explanation[series].prefix,
+			    symfile_complaint_book.explanation[series].prefix,
 			    msg.c_str (),
-			    complaints->explanation[series].postfix);
+			    symfile_complaint_book.explanation[series].postfix);
 	  /* Force a line-break after any isolated message.  */
 	  if (series == ISOLATED_MESSAGE)
 	    /* It would be really nice to use begin_line() here.
@@ -207,12 +189,12 @@ vcomplaint (struct complaints **c, const char *file,
 }
 
 void
-complaint_internal (struct complaints **complaints, const char *fmt, ...)
+complaint_internal (const char *fmt, ...)
 {
   va_list args;
 
   va_start (args, fmt);
-  vcomplaint (complaints, NULL/*file*/, 0/*line*/, fmt, args);
+  vcomplaint (NULL/*file*/, 0/*line*/, fmt, args);
   va_end (args);
 }
 
@@ -223,20 +205,19 @@ complaint_internal (struct complaints **complaints, const char *fmt, ...)
    complaints (rather than being interleaved with other messages).  */
 
 void
-clear_complaints (struct complaints **c, int less_verbose)
+clear_complaints (int less_verbose)
 {
-  struct complaints *complaints = get_complaints (c);
   struct complain *p;
 
-  for (p = complaints->root; p != NULL; p = p->next)
+  for (p = symfile_complaint_book.root; p != NULL; p = p->next)
     {
       p->counter = 0;
     }
 
   if (!less_verbose)
-    complaints->series = ISOLATED_MESSAGE;
+    symfile_complaint_book.series = ISOLATED_MESSAGE;
   else
-    complaints->series = SHORT_FIRST_MESSAGE;
+    symfile_complaint_book.series = SHORT_FIRST_MESSAGE;
 }
 
 static void
diff --git a/gdb/complaints.h b/gdb/complaints.h
index 652827e47b..90f58061eb 100644
--- a/gdb/complaints.h
+++ b/gdb/complaints.h
@@ -25,25 +25,21 @@
    particular category.  */
 struct complaints;
 
-/* Predefined categories.  */
-extern struct complaints *symfile_complaints;
-
 /* Helper for complaint.  */
-extern void complaint_internal (struct complaints **complaints,
-				const char *fmt, ...)
-  ATTRIBUTE_PRINTF (2, 3);
+extern void complaint_internal (const char *fmt, ...)
+  ATTRIBUTE_PRINTF (1, 2);
 
 /* Register a complaint.  This is a macro around complaint_internal to
    avoid computing complaint's arguments when complaints are disabled.
    Running FMT via gettext [i.e., _(FMT)] can be quite expensive, for
    example.  */
-#define complaint(COMPLAINTS, FMT, ...)				\
+#define complaint(FMT, ...)					\
   do								\
     {								\
       extern int stop_whining;					\
 								\
       if (stop_whining > 0)					\
-	complaint_internal (COMPLAINTS, FMT, ##__VA_ARGS__);	\
+	complaint_internal (FMT, ##__VA_ARGS__);		\
     }								\
   while (0)
 
@@ -55,8 +51,7 @@ extern void complaint_internal (struct complaints **complaints,
    noisy is 1, we are in a noisy command, and our caller will print
    enough context for the user to figure it out.  */
 
-extern void clear_complaints (struct complaints **complaints,
-			      int less_verbose);
+extern void clear_complaints (int less_verbose);
 
 
 #endif /* !defined (COMPLAINTS_H) */
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index dde417be80..cec48019e5 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1108,8 +1108,7 @@ cp_find_first_component_aux (const char *name, int permissive)
 static void
 demangled_name_complaint (const char *name)
 {
-  complaint (&symfile_complaints,
-	     "unexpected demangled name '%s'", name);
+  complaint ("unexpected demangled name '%s'", name);
 }
 
 /* If NAME is the fully-qualified name of a C++
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index d0926896e2..95b614cdae 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -164,21 +164,19 @@ static int has_line_numbers;
 static void
 unknown_symtype_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints, _("unknown symbol type %s"), arg1);
+  complaint (_("unknown symbol type %s"), arg1);
 }
 
 static void
 lbrac_mismatch_complaint (int arg1)
 {
-  complaint (&symfile_complaints,
-	     _("N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d"), arg1);
+  complaint (_("N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d"), arg1);
 }
 
 static void
 repeated_header_complaint (const char *arg1, int arg2)
 {
-  complaint (&symfile_complaints,
-	     _("\"repeated\" header file %s not "
+  complaint (_("\"repeated\" header file %s not "
 	       "previously seen, at symtab pos %d"),
 	     arg1, arg2);
 }
@@ -940,8 +938,7 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
       >= DBX_STRINGTAB_SIZE (objfile)
       || nlist->n_strx + file_string_table_offset < nlist->n_strx)
     {
-      complaint (&symfile_complaints,
-		 _("bad string table offset in symbol %d"),
+      complaint (_("bad string table offset in symbol %d"),
 		 symnum);
       namestring = "<bad string table offset>";
     } 
@@ -999,8 +996,7 @@ find_stab_function_addr (const char *namestring, const char *filename,
 static void
 function_outside_compilation_unit_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints,
-	     _("function `%s' appears to be defined "
+  complaint (_("function `%s' appears to be defined "
 	       "outside of all compilation units"),
 	     arg1);
 }
@@ -1389,8 +1385,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
 	      {
 		/* FIXME: we should not get here without a PST to work on.
 		   Attempt to recover.  */
-		complaint (&symfile_complaints,
-			   _("N_BINCL %s not in entries for "
+		complaint (_("N_BINCL %s not in entries for "
 			     "any file, at symtab pos %d"),
 			   namestring, symnum);
 		continue;
@@ -1839,8 +1834,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
 		 time searching to the end of every string looking for
 		 a backslash.  */
 
-	      complaint (&symfile_complaints,
-			 _("unknown symbol descriptor `%c'"),
+	      complaint (_("unknown symbol descriptor `%c'"),
 			 p[1]);
 
 	      /* Ignore it; perhaps it is an extension that we don't
@@ -2635,8 +2629,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
 	     2000 would output N_LSYM entries after N_LBRAC
 	     entries.  As a consequence, these symbols are simply
 	     discarded.  Complain if this is the case.  */
-	  complaint (&symfile_complaints,
-		     _("misplaced N_LBRAC entry; discarding local "
+	  complaint (_("misplaced N_LBRAC entry; discarding local "
 		       "symbols which have no enclosing block"));
 	}
       local_symbols = newobj->locals;
@@ -2656,8 +2649,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
 		 ??? Which compilers?  Is this ever harmful?.  */
 	      if (newobj->start_addr > valu)
 		{
-		  complaint (&symfile_complaints,
-			     _("block start larger than block end"));
+		  complaint (_("block start larger than block end"));
 		  newobj->start_addr = valu;
 		}
 	      /* Make a block for the local symbols within.  */
@@ -2937,8 +2929,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
 
 	      if (context_stack_depth > 1)
 		{
-		  complaint (&symfile_complaints,
-			     _("unmatched N_LBRAC before symtab pos %d"),
+		  complaint (_("unmatched N_LBRAC before symtab pos %d"),
 			     symnum);
 		  break;
 		}
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index d70a704aa4..71530aa909 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -607,8 +607,7 @@ dtrace_process_dof (asection *sect, struct objfile *objfile,
   return;
 	  
  invalid_dof_data:
-  complaint (&symfile_complaints,
-	     _("skipping section '%s' which does not contain valid DOF data."),
+  complaint (_("skipping section '%s' which does not contain valid DOF data."),
 	     sect->name);
 }
 
@@ -858,8 +857,7 @@ dtrace_static_probe_ops::get_probes (std::vector<probe *> *probesp,
 	  /* Read the contents of the DOF section and then process it to
 	     extract the information of any probe defined into it.  */
 	  if (!bfd_malloc_and_get_section (abfd, sect, &dof))
-	    complaint (&symfile_complaints,
-		       _("could not obtain the contents of"
+	    complaint (_("could not obtain the contents of"
 			 "section '%s' in objfile `%s'."),
 		       sect->name, abfd->filename);
       
diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c
index a5e196db32..d2831461ca 100644
--- a/gdb/dwarf-index-write.c
+++ b/gdb/dwarf-index-write.c
@@ -933,8 +933,7 @@ private:
 	    = m_str_table.emplace (c_str_view (s),
 				   data - dwarf2_per_objfile->str.buffer);
 	  if (!insertpair.second)
-	    complaint (&symfile_complaints,
-		       _("Duplicate string \"%s\" in "
+	    complaint (_("Duplicate string \"%s\" in "
 			 ".debug_str section [in module %s]"),
 		       s, bfd_get_filename (m_abfd));
 	  data += strlen (s) + 1;
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index aed6c7b1e6..91e16cf024 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -216,7 +216,7 @@ dwarf2_restore_rule (struct gdbarch *gdbarch, ULONGEST reg_num,
     {
       int regnum = dwarf_reg_to_regnum (gdbarch, reg);
 
-      complaint (&symfile_complaints, _("\
+      complaint (_("\
 incomplete CFI data; DW_CFA_restore unspecified\n\
 register %s (#%d) at %s"),
 		 gdbarch_register_name (gdbarch, regnum), regnum,
@@ -449,7 +449,7 @@ execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr,
 
 		if (old_rs == NULL)
 		  {
-		    complaint (&symfile_complaints, _("\
+		    complaint (_("\
 bad CFI data; mismatched DW_CFA_restore_state at %s"),
 			       paddress (gdbarch, fs->pc));
 		  }
@@ -1111,7 +1111,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
 	if (fs.regs.reg[column].how == DWARF2_FRAME_REG_UNSPECIFIED)
 	  {
 	    if (cache->reg[regnum].how == DWARF2_FRAME_REG_UNSPECIFIED)
-	      complaint (&symfile_complaints, _("\
+	      complaint (_("\
 incomplete CFI data; unspecified registers (e.g., %s) at %s"),
 			 gdbarch_register_name (gdbarch, regnum),
 			 paddress (gdbarch, fs.pc));
@@ -2144,22 +2144,21 @@ decode_frame_entry (struct comp_unit *unit, const gdb_byte *start,
       break;
 
     case ALIGN4:
-      complaint (&symfile_complaints, _("\
+      complaint (_("\
 Corrupt data in %s:%s; align 4 workaround apparently succeeded"),
 		 unit->dwarf_frame_section->owner->filename,
 		 unit->dwarf_frame_section->name);
       break;
 
     case ALIGN8:
-      complaint (&symfile_complaints, _("\
+      complaint (_("\
 Corrupt data in %s:%s; align 8 workaround apparently succeeded"),
 		 unit->dwarf_frame_section->owner->filename,
 		 unit->dwarf_frame_section->name);
       break;
 
     default:
-      complaint (&symfile_complaints,
-		 _("Corrupt data in %s:%s"),
+      complaint (_("Corrupt data in %s:%s"),
 		 unit->dwarf_frame_section->owner->filename,
 		 unit->dwarf_frame_section->name);
       break;
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 6ecc5a9be6..730934fe6e 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2892,8 +2892,7 @@ dwarf_reg_to_regnum (struct gdbarch *arch, int dwarf_reg)
 
   if (reg == -1)
     {
-      complaint (&symfile_complaints,
-		 _("bad DWARF register number %d"), dwarf_reg);
+      complaint (_("bad DWARF register number %d"), dwarf_reg);
     }
   return reg;
 }
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 49ce83ff20..834bce776a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1997,45 +1997,40 @@ static void free_line_header_voidp (void *arg);
 static void
 dwarf2_statement_list_fits_in_line_number_section_complaint (void)
 {
-  complaint (&symfile_complaints,
-	     _("statement list doesn't fit in .debug_line section"));
+  complaint (_("statement list doesn't fit in .debug_line section"));
 }
 
 static void
 dwarf2_debug_line_missing_file_complaint (void)
 {
-  complaint (&symfile_complaints,
-	     _(".debug_line section has line data without a file"));
+  complaint (_(".debug_line section has line data without a file"));
 }
 
 static void
 dwarf2_debug_line_missing_end_sequence_complaint (void)
 {
-  complaint (&symfile_complaints,
-	     _(".debug_line section has line "
+  complaint (_(".debug_line section has line "
 	       "program sequence without an end"));
 }
 
 static void
 dwarf2_complex_location_expr_complaint (void)
 {
-  complaint (&symfile_complaints, _("location expression too complex"));
+  complaint (_("location expression too complex"));
 }
 
 static void
 dwarf2_const_value_length_mismatch_complaint (const char *arg1, int arg2,
 					      int arg3)
 {
-  complaint (&symfile_complaints,
-	     _("const value length mismatch for '%s', got %d, expected %d"),
+  complaint (_("const value length mismatch for '%s', got %d, expected %d"),
 	     arg1, arg2, arg3);
 }
 
 static void
 dwarf2_section_buffer_overflow_complaint (struct dwarf2_section_info *section)
 {
-  complaint (&symfile_complaints,
-	     _("debug info runs off end of %s section"
+  complaint (_("debug info runs off end of %s section"
 	       " [in module %s]"),
 	     get_section_name (section),
 	     get_section_file_name (section));
@@ -2044,8 +2039,7 @@ dwarf2_section_buffer_overflow_complaint (struct dwarf2_section_info *section)
 static void
 dwarf2_macro_malformed_definition_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints,
-	     _("macro debug info contains a "
+  complaint (_("macro debug info contains a "
 	       "malformed macro definition:\n`%s'"),
 	     arg1);
 }
@@ -2053,8 +2047,7 @@ dwarf2_macro_malformed_definition_complaint (const char *arg1)
 static void
 dwarf2_invalid_attrib_class_complaint (const char *arg1, const char *arg2)
 {
-  complaint (&symfile_complaints,
-	     _("invalid attribute class or form for '%s' in '%s'"),
+  complaint (_("invalid attribute class or form for '%s' in '%s'"),
 	     arg1, arg2);
 }
 
@@ -3167,16 +3160,14 @@ create_addrmap_from_index (struct dwarf2_per_objfile *dwarf2_per_objfile,
 
       if (lo > hi)
 	{
-	  complaint (&symfile_complaints,
-		     _(".gdb_index address table has invalid range (%s - %s)"),
+	  complaint (_(".gdb_index address table has invalid range (%s - %s)"),
 		     hex_string (lo), hex_string (hi));
 	  continue;
 	}
 
       if (cu_index >= dwarf2_per_objfile->all_comp_units.size ())
 	{
-	  complaint (&symfile_complaints,
-		     _(".gdb_index address table has invalid CU number %u"),
+	  complaint (_(".gdb_index address table has invalid CU number %u"),
 		     (unsigned) cu_index);
 	  continue;
 	}
@@ -3959,8 +3950,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
       if (cu_index >= (dwarf2_per_objfile->all_comp_units.size ()
 		       + dwarf2_per_objfile->all_type_units.size ()))
 	{
-	  complaint (&symfile_complaints,
-		     _(".gdb_index entry has bad CU index"
+	  complaint (_(".gdb_index entry has bad CU index"
 		       " [in module %s]"),
 		     objfile_name (dwarf2_per_objfile->objfile));
 	  continue;
@@ -5081,8 +5071,7 @@ dw2_expand_marked_cus
       if (cu_index >= (dwarf2_per_objfile->all_comp_units.size ()
 		       + dwarf2_per_objfile->all_type_units.size ()))
 	{
-	  complaint (&symfile_complaints,
-		     _(".gdb_index entry has bad CU index"
+	  complaint (_(".gdb_index entry has bad CU index"
 		       " [in module %s]"),
 		       objfile_name (dwarf2_per_objfile->objfile));
 	  continue;
@@ -5769,8 +5758,7 @@ dw2_debug_names_iterator::find_vec_in_debug_names
   --namei;
   if (namei >= map.name_count)
     {
-      complaint (&symfile_complaints,
-		 _("Wrong .debug_names with name index %u but name_count=%u "
+      complaint (_("Wrong .debug_names with name index %u but name_count=%u "
 		   "[in module %s]"),
 		 namei, map.name_count,
 		 objfile_name (map.dwarf2_per_objfile->objfile));
@@ -5793,8 +5781,7 @@ dw2_debug_names_iterator::find_vec_in_debug_names
 #if 0 /* An expensive sanity check.  */
 	  if (namei_full_hash != dwarf5_djb_hash (namei_string))
 	    {
-	      complaint (&symfile_complaints,
-			 _("Wrong .debug_names hash for string at index %u "
+	      complaint (_("Wrong .debug_names hash for string at index %u "
 			   "[in module %s]"),
 			 namei, objfile_name (dwarf2_per_objfile->objfile));
 	      return NULL;
@@ -5823,8 +5810,7 @@ dw2_debug_names_iterator::find_vec_in_debug_names
 {
   if (namei >= map.name_count)
     {
-      complaint (&symfile_complaints,
-		 _("Wrong .debug_names with name index %u but name_count=%u "
+      complaint (_("Wrong .debug_names with name index %u but name_count=%u "
 		   "[in module %s]"),
 		 namei, map.name_count,
 		 objfile_name (map.dwarf2_per_objfile->objfile));
@@ -5861,8 +5847,7 @@ dw2_debug_names_iterator::next ()
   const auto indexval_it = m_map.abbrev_map.find (abbrev);
   if (indexval_it == m_map.abbrev_map.cend ())
     {
-      complaint (&symfile_complaints,
-		 _("Wrong .debug_names undefined abbrev code %s "
+      complaint (_("Wrong .debug_names undefined abbrev code %s "
 		   "[in module %s]"),
 		 pulongest (abbrev), objfile_name (objfile));
       return NULL;
@@ -5887,8 +5872,7 @@ dw2_debug_names_iterator::next ()
 	  m_addr += bytes_read;
 	  break;
 	default:
-	  complaint (&symfile_complaints,
-		     _("Unsupported .debug_names form %s [in module %s]"),
+	  complaint (_("Unsupported .debug_names form %s [in module %s]"),
 		     dwarf_form_name (attr.form),
 		     objfile_name (objfile));
 	  return NULL;
@@ -5899,8 +5883,7 @@ dw2_debug_names_iterator::next ()
 	  /* Don't crash on bad data.  */
 	  if (ull >= dwarf2_per_objfile->all_comp_units.size ())
 	    {
-	      complaint (&symfile_complaints,
-			 _(".debug_names entry has bad CU index %s"
+	      complaint (_(".debug_names entry has bad CU index %s"
 			   " [in module %s]"),
 			 pulongest (ull),
 			 objfile_name (dwarf2_per_objfile->objfile));
@@ -5912,8 +5895,7 @@ dw2_debug_names_iterator::next ()
 	  /* Don't crash on bad data.  */
 	  if (ull >= dwarf2_per_objfile->all_type_units.size ())
 	    {
-	      complaint (&symfile_complaints,
-			 _(".debug_names entry has bad TU index %s"
+	      complaint (_(".debug_names entry has bad TU index %s"
 			   " [in module %s]"),
 			 pulongest (ull),
 			 objfile_name (dwarf2_per_objfile->objfile));
@@ -6742,8 +6724,7 @@ create_debug_type_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
 	      dup_sect_off = dup_tu->per_cu.sect_off;
 	    }
 
-	  complaint (&symfile_complaints,
-		     _("debug type entry at offset %s is duplicate to"
+	  complaint (_("debug type entry at offset %s is duplicate to"
 		       " the entry at offset %s, signature %s"),
 		     sect_offset_str (sect_off), sect_offset_str (dup_sect_off),
 		     hex_string (header.signature));
@@ -7572,8 +7553,7 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
 
       if (has_children)
 	{
-	  complaint (&symfile_complaints,
-		     _("compilation unit with DW_AT_GNU_dwo_name"
+	  complaint (_("compilation unit with DW_AT_GNU_dwo_name"
 		       " has children (offset %s) [in module %s]"),
 		     sect_offset_str (this_cu->sect_off),
 		     bfd_get_filename (abfd));
@@ -8747,8 +8727,7 @@ partial_die_parent_scope (struct partial_die_info *pdi,
       /* FIXME drow/2004-04-01: What should we be doing with
 	 function-local names?  For partial symbols, we should probably be
 	 ignoring them.  */
-      complaint (&symfile_complaints,
-		 _("unhandled containing DIE tag %d for DIE at %s"),
+      complaint (_("unhandled containing DIE tag %d for DIE at %s"),
 		 parent->tag, sect_offset_str (pdi->sect_off));
       parent->scope = grandparent_scope;
     }
@@ -9106,7 +9085,7 @@ add_partial_enumeration (struct partial_die_info *enum_pdi,
   while (pdi)
     {
       if (pdi->tag != DW_TAG_enumerator || pdi->name == NULL)
-	complaint (&symfile_complaints, _("malformed enumerator DIE ignored"));
+	complaint (_("malformed enumerator DIE ignored"));
       else
 	add_partial_symbol (pdi, cu);
       pdi = pdi->die_sibling;
@@ -9198,16 +9177,14 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
 	{
 	  read_attribute (reader, &attr, &abbrev->attrs[i], info_ptr);
 	  if (attr.form == DW_FORM_ref_addr)
-	    complaint (&symfile_complaints,
-		       _("ignoring absolute DW_AT_sibling"));
+	    complaint (_("ignoring absolute DW_AT_sibling"));
 	  else
 	    {
 	      sect_offset off = dwarf2_get_ref_die_offset (&attr);
 	      const gdb_byte *sibling_ptr = buffer + to_underlying (off);
 
 	      if (sibling_ptr < info_ptr)
-		complaint (&symfile_complaints,
-			   _("DW_AT_sibling points backwards"));
+		complaint (_("DW_AT_sibling points backwards"));
 	      else if (sibling_ptr > reader->buffer_end)
 		dwarf2_section_buffer_overflow_complaint (reader->die_section);
 	      else
@@ -9762,8 +9739,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
 		  struct objfile *objfile
 		    = cu->per_cu->dwarf2_per_objfile->objfile;
 		  if (strcmp (package_name, this_package_name) != 0)
-		    complaint (&symfile_complaints,
-			       _("Symtab %s has objects from two different Go packages: %s and %s"),
+		    complaint (_("Symtab %s has objects from two different Go packages: %s and %s"),
 			       (symbol_symtab (sym) != NULL
 				? symtab_to_filename_for_display
 				    (symbol_symtab (sym))
@@ -9895,8 +9871,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
 	      || (TYPE_FIELD_LOC_KIND (field_type, index)
 		  != FIELD_LOC_KIND_BITPOS))
 	    {
-	      complaint (&symfile_complaints,
-			 _("Could not parse Rust enum encoding string \"%s\""
+	      complaint (_("Could not parse Rust enum encoding string \"%s\""
 			   "[in module %s]"),
 			 TYPE_FIELD_NAME (type, 0),
 			 objfile_name (objfile));
@@ -10594,7 +10569,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
       cu->processing_has_namespace_info = 1;
       if (die->child != NULL && (die->tag == DW_TAG_imported_declaration
 				 || cu->language != language_fortran))
-	complaint (&symfile_complaints, _("Tag '%s' has unexpected children"),
+	complaint (_("Tag '%s' has unexpected children"),
 		   dwarf_tag_name (die->tag));
       read_import_statement (die, cu);
       break;
@@ -10828,8 +10803,7 @@ dwarf2_compute_name (const char *name,
 		  attr = dwarf2_attr (child, DW_AT_type, cu);
 		  if (attr == NULL)
 		    {
-		      complaint (&symfile_complaints,
-				 _("template parameter missing DW_AT_type"));
+		      complaint (_("template parameter missing DW_AT_type"));
 		      buf.puts ("UNKNOWN_TYPE");
 		      continue;
 		    }
@@ -10844,8 +10818,7 @@ dwarf2_compute_name (const char *name,
 		  attr = dwarf2_attr (child, DW_AT_const_value, cu);
 		  if (attr == NULL)
 		    {
-		      complaint (&symfile_complaints,
-				 _("template parameter missing "
+		      complaint (_("template parameter missing "
 				   "DW_AT_const_value"));
 		      buf.puts ("UNKNOWN_VALUE");
 		      continue;
@@ -11039,8 +11012,7 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
 	     compute DW_AT_linkage_name incorrectly.  But in such case
 	     GDB would need to be bug-to-bug compatible.  */
 
-	  complaint (&symfile_complaints,
-		     _("Computed physname <%s> does not match demangled <%s> "
+	  complaint (_("Computed physname <%s> does not match demangled <%s> "
 		       "(from linkage <%s>) - DIE at %s [in module %s]"),
 		     physname, canon, mangled, sect_offset_str (die->sect_off),
 		     objfile_name (objfile));
@@ -11103,8 +11075,7 @@ read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu)
 
       if (num == MAX_NESTED_IMPORTED_DECLARATIONS)
 	{
-	  complaint (&symfile_complaints,
-		     _("DIE at %s has too many recursively imported "
+	  complaint (_("DIE at %s has too many recursively imported "
 		       "declarations"), sect_offset_str (d->sect_off));
 	  return 0;
 	}
@@ -11166,7 +11137,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
   import_attr = dwarf2_attr (die, DW_AT_import, cu);
   if (import_attr == NULL)
     {
-      complaint (&symfile_complaints, _("Tag '%s' has no DW_AT_import"),
+      complaint (_("Tag '%s' has no DW_AT_import"),
 		 dwarf_tag_name (die->tag));
       return;
     }
@@ -11246,8 +11217,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
 
 	if (child_die->tag != DW_TAG_imported_declaration)
 	  {
-	    complaint (&symfile_complaints,
-		       _("child DW_TAG_imported_declaration expected "
+	    complaint (_("child DW_TAG_imported_declaration expected "
 			 "- DIE at %s [in module %s]"),
 		       sect_offset_str (child_die->sect_off),
 		       objfile_name (objfile));
@@ -11257,7 +11227,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
 	import_attr = dwarf2_attr (child_die, DW_AT_import, cu);
 	if (import_attr == NULL)
 	  {
-	    complaint (&symfile_complaints, _("Tag '%s' has no DW_AT_import"),
+	    complaint (_("Tag '%s' has no DW_AT_import"),
 		       dwarf_tag_name (child_die->tag));
 	    continue;
 	  }
@@ -11268,8 +11238,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
 	imported_name = dwarf2_name (imported_die, imported_cu);
 	if (imported_name == NULL)
 	  {
-	    complaint (&symfile_complaints,
-		       _("child DW_TAG_imported_declaration has unknown "
+	    complaint (_("child DW_TAG_imported_declaration has unknown "
 			 "imported name - DIE at %s [in module %s]"),
 		       sect_offset_str (child_die->sect_off),
 		       objfile_name (objfile));
@@ -11522,8 +11491,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
   if (attr && cu->line_header)
     {
       if (dwarf2_attr (die, DW_AT_macro_info, cu))
-	complaint (&symfile_complaints,
-		   _("CU refers to both DW_AT_macros and DW_AT_macro_info"));
+	complaint (_("CU refers to both DW_AT_macros and DW_AT_macro_info"));
 
       dwarf_decode_macros (cu, DW_UNSND (attr), 1);
     }
@@ -11813,8 +11781,7 @@ create_dwo_cu_reader (const struct die_reader_specs *reader,
   attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
   if (attr == NULL)
     {
-      complaint (&symfile_complaints,
-		 _("Dwarf Error: debug entry at offset %s is missing"
+      complaint (_("Dwarf Error: debug entry at offset %s is missing"
 		   " its dwo_id [in module %s]"),
 		 sect_offset_str (sect_off), dwo_file->dwo_name);
       return;
@@ -11894,8 +11861,7 @@ create_cus_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
 	  const struct dwo_unit *dup_cu = (const struct dwo_unit *)*slot;
 	  sect_offset dup_sect_off = dup_cu->sect_off;
 
-	  complaint (&symfile_complaints,
-		     _("debug cu entry at offset %s is duplicate to"
+	  complaint (_("debug cu entry at offset %s is duplicate to"
 		       " the entry at offset %s, signature %s"),
 		     sect_offset_str (sect_off), sect_offset_str (dup_sect_off),
 		     hex_string (dwo_unit->signature));
@@ -12105,8 +12071,7 @@ create_dwp_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
       if (nr_slots != 0 || nr_units != 0
 	  || (version == 2 && nr_columns != 0))
 	{
-	  complaint (&symfile_complaints,
-		     _("Empty DWP but nr_slots,nr_units,nr_columns not"
+	  complaint (_("Empty DWP but nr_slots,nr_units,nr_columns not"
 		       " all zero [in modules %s]"),
 		     dwp_file->name);
 	}
@@ -13496,8 +13461,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
   if (die->tag != origin_die->tag
       && !(die->tag == DW_TAG_inlined_subroutine
 	   && origin_die->tag == DW_TAG_subprogram))
-    complaint (&symfile_complaints,
-	       _("DIE %s and its abstract origin %s have different tags"),
+    complaint (_("DIE %s and its abstract origin %s have different tags"),
 	       sect_offset_str (die->sect_off),
 	       sect_offset_str (origin_die->sect_off));
 
@@ -13543,14 +13507,12 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
 	  if (child_die->tag != child_origin_die->tag
 	      && !(child_die->tag == DW_TAG_inlined_subroutine
 		   && child_origin_die->tag == DW_TAG_subprogram))
-	    complaint (&symfile_complaints,
-		       _("Child DIE %s and its abstract origin %s have "
+	    complaint (_("Child DIE %s and its abstract origin %s have "
 			 "different tags"),
 		       sect_offset_str (child_die->sect_off),
 		       sect_offset_str (child_origin_die->sect_off));
 	  if (child_origin_die->parent != origin_die)
-	    complaint (&symfile_complaints,
-		       _("Child DIE %s and its abstract origin %s have "
+	    complaint (_("Child DIE %s and its abstract origin %s have "
 			 "different parents"),
 		       sect_offset_str (child_die->sect_off),
 		       sect_offset_str (child_origin_die->sect_off));
@@ -13562,8 +13524,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
   sect_offset *offsets_end = offsets.data () + offsets.size ();
   for (offsetp = offsets.data () + 1; offsetp < offsets_end; offsetp++)
     if (offsetp[-1] == *offsetp)
-      complaint (&symfile_complaints,
-		 _("Multiple children of DIE %s refer "
+      complaint (_("Multiple children of DIE %s refer "
 		   "to DIE %s as their abstract origin"),
 		 sect_offset_str (die->sect_off), sect_offset_str (*offsetp));
 
@@ -13629,8 +13590,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
      illegal according to the DWARF standard.  */
   if (name == NULL)
     {
-      complaint (&symfile_complaints,
-		 _("missing name for subprogram DIE at %s"),
+      complaint (_("missing name for subprogram DIE at %s"),
 		 sect_offset_str (die->sect_off));
       return;
     }
@@ -13641,8 +13601,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
     {
       attr = dwarf2_attr (die, DW_AT_external, cu);
       if (!attr || !DW_UNSND (attr))
-	complaint (&symfile_complaints,
-		   _("cannot get low and high bounds "
+	complaint (_("cannot get low and high bounds "
 		     "for subprogram DIE at %s"),
 		   sect_offset_str (die->sect_off));
       return;
@@ -13875,8 +13834,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
     }
   if (!attr)
     {
-      complaint (&symfile_complaints,
-		 _("missing DW_AT_call_return_pc for DW_TAG_call_site "
+      complaint (_("missing DW_AT_call_return_pc for DW_TAG_call_site "
 		   "DIE %s [in module %s]"),
 		 sect_offset_str (die->sect_off), objfile_name (objfile));
       return;
@@ -13892,8 +13850,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
   slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
   if (*slot != NULL)
     {
-      complaint (&symfile_complaints,
-		 _("Duplicate PC %s for DW_TAG_call_site "
+      complaint (_("Duplicate PC %s for DW_TAG_call_site "
 		   "DIE %s [in module %s]"),
 		 paddress (gdbarch, pc), sect_offset_str (die->sect_off),
 		 objfile_name (objfile));
@@ -13909,8 +13866,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
       if (child_die->tag != DW_TAG_call_site_parameter
           && child_die->tag != DW_TAG_GNU_call_site_parameter)
 	{
-	  complaint (&symfile_complaints,
-		     _("Tag %d is not DW_TAG_call_site_parameter in "
+	  complaint (_("Tag %d is not DW_TAG_call_site_parameter in "
 		       "DW_TAG_call_site child DIE %s [in module %s]"),
 		     child_die->tag, sect_offset_str (child_die->sect_off),
 		     objfile_name (objfile));
@@ -13972,8 +13928,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	      TYPE_TAIL_CALL_LIST (func_type) = call_site;
 	    }
 	  else
-	    complaint (&symfile_complaints,
-		       _("Cannot find function owning DW_TAG_call_site "
+	    complaint (_("Cannot find function owning DW_TAG_call_site "
 			 "DIE %s [in module %s]"),
 		       sect_offset_str (die->sect_off), objfile_name (objfile));
 	}
@@ -14019,8 +13974,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	  if (target_physname == NULL)
 	    target_physname = dwarf2_physname (NULL, target_die, target_cu);
 	  if (target_physname == NULL)
-	    complaint (&symfile_complaints,
-		       _("DW_AT_call_target target DIE has invalid "
+	    complaint (_("DW_AT_call_target target DIE has invalid "
 		         "physname, for referencing DIE %s [in module %s]"),
 		       sect_offset_str (die->sect_off), objfile_name (objfile));
 	  else
@@ -14033,8 +13987,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	  /* DW_AT_entry_pc should be preferred.  */
 	  if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
 	      <= PC_BOUNDS_INVALID)
-	    complaint (&symfile_complaints,
-		       _("DW_AT_call_target target DIE has invalid "
+	    complaint (_("DW_AT_call_target target DIE has invalid "
 		         "low pc, for referencing DIE %s [in module %s]"),
 		       sect_offset_str (die->sect_off), objfile_name (objfile));
 	  else
@@ -14045,8 +13998,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
     }
   else
-    complaint (&symfile_complaints,
-	       _("DW_TAG_call_site DW_AT_call_target is neither "
+    complaint (_("DW_TAG_call_site DW_AT_call_target is neither "
 		 "block nor reference, for DIE %s [in module %s]"),
 	       sect_offset_str (die->sect_off), objfile_name (objfile));
 
@@ -14092,8 +14044,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	      /* As DW_OP_GNU_parameter_ref uses CU-relative offset this
 		 binding can be done only inside one CU.  Such referenced DIE
 		 therefore cannot be even moved to DW_TAG_partial_unit.  */
-	      complaint (&symfile_complaints,
-			 _("DW_AT_call_parameter offset is not in CU for "
+	      complaint (_("DW_AT_call_parameter offset is not in CU for "
 			   "DW_TAG_call_site child DIE %s [in module %s]"),
 			 sect_offset_str (child_die->sect_off),
 			 objfile_name (objfile));
@@ -14104,8 +14055,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
       else if (loc == NULL || origin != NULL || !attr_form_is_block (loc))
 	{
-	  complaint (&symfile_complaints,
-		     _("No DW_FORM_block* DW_AT_location for "
+	  complaint (_("No DW_FORM_block* DW_AT_location for "
 		       "DW_TAG_call_site child DIE %s [in module %s]"),
 		     sect_offset_str (child_die->sect_off), objfile_name (objfile));
 	  continue;
@@ -14122,8 +14072,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	    parameter->kind = CALL_SITE_PARAMETER_FB_OFFSET;
 	  else
 	    {
-	      complaint (&symfile_complaints,
-			 _("Only single DW_OP_reg or DW_OP_fbreg is supported "
+	      complaint (_("Only single DW_OP_reg or DW_OP_fbreg is supported "
 			   "for DW_FORM_block* DW_AT_location is supported for "
 			   "DW_TAG_call_site child DIE %s "
 			   "[in module %s]"),
@@ -14138,8 +14087,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_value, cu);
       if (!attr_form_is_block (attr))
 	{
-	  complaint (&symfile_complaints,
-		     _("No DW_FORM_block* DW_AT_call_value for "
+	  complaint (_("No DW_FORM_block* DW_AT_call_value for "
 		       "DW_TAG_call_site child DIE %s [in module %s]"),
 		     sect_offset_str (child_die->sect_off),
 		     objfile_name (objfile));
@@ -14159,8 +14107,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
       if (attr)
 	{
 	  if (!attr_form_is_block (attr))
-	    complaint (&symfile_complaints,
-		       _("No DW_FORM_block* DW_AT_call_data_value for "
+	    complaint (_("No DW_FORM_block* DW_AT_call_data_value for "
 			 "DW_TAG_call_site child DIE %s [in module %s]"),
 		       sect_offset_str (child_die->sect_off),
 		       objfile_name (objfile));
@@ -14253,8 +14200,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
   dwarf2_read_section (objfile, &dwarf2_per_objfile->rnglists);
   if (offset >= dwarf2_per_objfile->rnglists.size)
     {
-      complaint (&symfile_complaints,
-		 _("Offset %d out of bounds for DW_AT_ranges attribute"),
+      complaint (_("Offset %d out of bounds for DW_AT_ranges attribute"),
 		 offset);
       return false;
     }
@@ -14335,8 +14281,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
 	  buffer += bytes_read;
 	  break;
 	default:
-	  complaint (&symfile_complaints,
-		     _("Invalid .debug_rnglists data (no base address)"));
+	  complaint (_("Invalid .debug_rnglists data (no base address)"));
 	  return false;
 	}
       if (rlet == DW_RLE_end_of_list || overflow)
@@ -14348,16 +14293,14 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
 	{
 	  /* We have no valid base address for the ranges
 	     data.  */
-	  complaint (&symfile_complaints,
-		     _("Invalid .debug_rnglists data (no base address)"));
+	  complaint (_("Invalid .debug_rnglists data (no base address)"));
 	  return false;
 	}
 
       if (range_beginning > range_end)
 	{
 	  /* Inverted range entries are invalid.  */
-	  complaint (&symfile_complaints,
-		     _("Invalid .debug_rnglists data (inverted range)"));
+	  complaint (_("Invalid .debug_rnglists data (inverted range)"));
 	  return false;
 	}
 
@@ -14373,8 +14316,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
       if (range_beginning + baseaddr == 0
 	  && !dwarf2_per_objfile->has_section_at_zero)
 	{
-	  complaint (&symfile_complaints,
-		     _(".debug_rnglists entry has start address of zero"
+	  complaint (_(".debug_rnglists entry has start address of zero"
 		       " [in module %s]"), objfile_name (objfile));
 	  continue;
 	}
@@ -14384,8 +14326,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
 
   if (overflow)
     {
-      complaint (&symfile_complaints,
-		 _("Offset %d is not terminated "
+      complaint (_("Offset %d is not terminated "
 		   "for DW_AT_ranges attribute"),
 		 offset);
       return false;
@@ -14427,8 +14368,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
   dwarf2_read_section (objfile, &dwarf2_per_objfile->ranges);
   if (offset >= dwarf2_per_objfile->ranges.size)
     {
-      complaint (&symfile_complaints,
-		 _("Offset %d out of bounds for DW_AT_ranges attribute"),
+      complaint (_("Offset %d out of bounds for DW_AT_ranges attribute"),
 		 offset);
       return 0;
     }
@@ -14467,16 +14407,14 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
 	{
 	  /* We have no valid base address for the ranges
 	     data.  */
-	  complaint (&symfile_complaints,
-		     _("Invalid .debug_ranges data (no base address)"));
+	  complaint (_("Invalid .debug_ranges data (no base address)"));
 	  return 0;
 	}
 
       if (range_beginning > range_end)
 	{
 	  /* Inverted range entries are invalid.  */
-	  complaint (&symfile_complaints,
-		     _("Invalid .debug_ranges data (inverted range)"));
+	  complaint (_("Invalid .debug_ranges data (inverted range)"));
 	  return 0;
 	}
 
@@ -14492,8 +14430,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
       if (range_beginning + baseaddr == 0
 	  && !dwarf2_per_objfile->has_section_at_zero)
 	{
-	  complaint (&symfile_complaints,
-		     _(".debug_ranges entry has start address of zero"
+	  complaint (_(".debug_ranges entry has start address of zero"
 		       " [in module %s]"), objfile_name (objfile));
 	  continue;
 	}
@@ -15169,8 +15106,7 @@ dwarf2_add_type_defn (struct field_info *fip, struct die_info *die,
       fp.is_protected = 1;
       break;
     default:
-      complaint (&symfile_complaints,
-		 _("Unhandled DW_AT_accessibility value (%x)"), accessibility);
+      complaint (_("Unhandled DW_AT_accessibility value (%x)"), accessibility);
     }
 
   if (die->tag == DW_TAG_typedef)
@@ -15267,7 +15203,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
 	default:
 	  /* Unknown accessibility.  Complain and treat it as public.  */
 	  {
-	    complaint (&symfile_complaints, _("unsupported accessibility %d"),
+	    complaint (_("unsupported accessibility %d"),
 		       field.accessibility);
 	  }
 	  break;
@@ -15396,7 +15332,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
 	fnp->voffset = VOFFSET_STATIC;
     }
   else
-    complaint (&symfile_complaints, _("member function type missing for '%s'"),
+    complaint (_("member function type missing for '%s'"),
 	       dwarf2_full_name (fieldname, die, cu));
 
   /* Get fcontext from DW_AT_containing_type if present.  */
@@ -15468,8 +15404,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
 	      if (TYPE_NFIELDS (this_type) == 0
 		  || !TYPE_FIELD_ARTIFICIAL (this_type, 0))
 		{
-		  complaint (&symfile_complaints,
-			     _("cannot determine context for virtual member "
+		  complaint (_("cannot determine context for virtual member "
 			       "function \"%s\" (offset %s)"),
 			     fieldname, sect_offset_str (die->sect_off));
 		}
@@ -15496,8 +15431,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
       if (attr && DW_UNSND (attr))
 	{
 	  /* GCC does this, as of 2008-08-25; PR debug/37237.  */
-	  complaint (&symfile_complaints,
-		     _("Member function \"%s\" (offset %s) is virtual "
+	  complaint (_("Member function \"%s\" (offset %s) is virtual "
 		       "but the vtable offset is not specified"),
 		     fieldname, sect_offset_str (die->sect_off));
 	  ALLOCATE_CPLUS_STRUCT_TYPE (type);
@@ -15610,8 +15544,7 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die)
 
   if (!attr_form_is_constant (attr))
     {
-      complaint (&symfile_complaints,
-		 _("DW_AT_alignment must have constant form"
+      complaint (_("DW_AT_alignment must have constant form"
 		   " - DIE at %s [in module %s]"),
 		 sect_offset_str (die->sect_off),
 		 objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -15624,8 +15557,7 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die)
       LONGEST val = DW_SND (attr);
       if (val < 0)
 	{
-	  complaint (&symfile_complaints,
-		     _("DW_AT_alignment value must not be negative"
+	  complaint (_("DW_AT_alignment value must not be negative"
 		       " - DIE at %s [in module %s]"),
 		     sect_offset_str (die->sect_off),
 		     objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -15638,8 +15570,7 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die)
 
   if (align == 0)
     {
-      complaint (&symfile_complaints,
-		 _("DW_AT_alignment value must not be zero"
+      complaint (_("DW_AT_alignment value must not be zero"
 		   " - DIE at %s [in module %s]"),
 		 sect_offset_str (die->sect_off),
 		 objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -15647,8 +15578,7 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die)
     }
   if ((align & (align - 1)) != 0)
     {
-      complaint (&symfile_complaints,
-		 _("DW_AT_alignment value must be a power of 2"
+      complaint (_("DW_AT_alignment value must be a power of 2"
 		   " - DIE at %s [in module %s]"),
 		 sect_offset_str (die->sect_off),
 		 objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -15666,8 +15596,7 @@ maybe_set_alignment (struct dwarf2_cu *cu, struct die_info *die,
 		     struct type *type)
 {
   if (!set_type_align (type, get_alignment (cu, die)))
-    complaint (&symfile_complaints,
-	       _("DW_AT_alignment value too large"
+    complaint (_("DW_AT_alignment value too large"
 		 " - DIE at %s [in module %s]"),
 	       sect_offset_str (die->sect_off),
 	       objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -15882,8 +15811,7 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
       /* We don't handle this but we might as well report it if we see
 	 it.  */
       if (dwarf2_attr (child_die, DW_AT_discr_list, cu) != nullptr)
-	  complaint (&symfile_complaints,
-		     _("DW_AT_discr_list is not supported yet"
+	  complaint (_("DW_AT_discr_list is not supported yet"
 		       " - DIE at %s [in module %s]"),
 		     sect_offset_str (child_die->sect_off),
 		     objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -15936,8 +15864,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
 	}
       else
 	{
-	  complaint (&symfile_complaints,
-		     _("DW_AT_discr does not have DIE reference form"
+	  complaint (_("DW_AT_discr does not have DIE reference form"
 		       " - DIE at %s [in module %s]"),
 		     sect_offset_str (die->sect_off),
 		     objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -16014,8 +15941,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
 
 		  /* Complain if virtual function table field not found.  */
 		  if (i < TYPE_N_BASECLASSES (t))
-		    complaint (&symfile_complaints,
-			       _("virtual function table pointer "
+		    complaint (_("virtual function table pointer "
 				 "not found when defining class '%s'"),
 			       TYPE_TAG_NAME (type) ? TYPE_TAG_NAME (type) :
 			       "");
@@ -16388,8 +16314,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
       stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop);
       if (!stride_ok)
 	{
-	  complaint (&symfile_complaints,
-		     _("unable to read array DW_AT_byte_stride "
+	  complaint (_("unable to read array DW_AT_byte_stride "
 		       " - DIE at %s [in module %s]"),
 		     sect_offset_str (die->sect_off),
 		     objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -16473,8 +16398,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
       if (DW_UNSND (attr) >= TYPE_LENGTH (type))
 	TYPE_LENGTH (type) = DW_UNSND (attr);
       else
-	complaint (&symfile_complaints,
-		   _("DW_AT_byte_size for array type smaller "
+	complaint (_("DW_AT_byte_size for array type smaller "
 		     "than the total size of elements"));
     }
 
@@ -16700,8 +16624,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
 		     not specified by DWARF.  It seems to have been
 		     emitted by gfortran at least as recently as:
 		     http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057.  */
-		  complaint (&symfile_complaints,
-			     _("Variable in common block has "
+		  complaint (_("Variable in common block has "
 			       "DW_AT_data_member_location "
 			       "- DIE at %s [in module %s]"),
 			       sect_offset_str (child_die->sect_off),
@@ -16823,8 +16746,7 @@ read_module_type (struct die_info *die, struct dwarf2_cu *cu)
 
   module_name = dwarf2_name (die, cu);
   if (!module_name)
-    complaint (&symfile_complaints,
-	       _("DW_TAG_module has no name, offset %s"),
+    complaint (_("DW_TAG_module has no name, offset %s"),
                sect_offset_str (die->sect_off));
   type = init_type (objfile, TYPE_CODE_MODULE, 0, module_name);
 
@@ -16943,13 +16865,11 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
 	}
       else if (TYPE_LENGTH (type) != byte_size)
 	{
-	  complaint (&symfile_complaints,
-		     _("invalid pointer size %d"), byte_size);
+	  complaint (_("invalid pointer size %d"), byte_size);
 	}
       else if (TYPE_RAW_ALIGN (type) != alignment)
 	{
-	  complaint (&symfile_complaints,
-		     _("Invalid DW_AT_alignment"
+	  complaint (_("Invalid DW_AT_alignment"
 		       " - DIE at %s [in module %s]"),
 		     sect_offset_str (die->sect_off),
 		     objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -17382,8 +17302,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu)
     {
       /* Self-referential typedefs are, it seems, not allowed by the DWARF
 	 spec and cause infinite loops in GDB.  */
-      complaint (&symfile_complaints,
-		 _("Self-referential DW_TAG_typedef "
+      complaint (_("Self-referential DW_TAG_typedef "
 		   "- DIE at %s [in module %s]"),
 		 sect_offset_str (die->sect_off), objfile_name (objfile));
       TYPE_TARGET_TYPE (this_type) = NULL;
@@ -17437,8 +17356,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
   name = dwarf2_name (die, cu);
   if (!name)
     {
-      complaint (&symfile_complaints,
-		 _("DW_AT_name missing from DW_TAG_base_type"));
+      complaint (_("DW_AT_name missing from DW_TAG_base_type"));
     }
 
   switch (encoding)
@@ -17499,8 +17417,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
 	    type = builtin_type (arch)->builtin_char32;
 	  else
 	    {
-	      complaint (&symfile_complaints,
-			 _("unsupported DW_ATE_UTF bit size: '%d'"),
+	      complaint (_("unsupported DW_ATE_UTF bit size: '%d'"),
 			 bits);
 	      type = init_integer_type (objfile, bits, 1, name);
 	    }
@@ -17509,7 +17426,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
 	break;
 
       default:
-	complaint (&symfile_complaints, _("unsupported DW_AT_encoding: '%s'"),
+	complaint (_("unsupported DW_AT_encoding: '%s'"),
 		   dwarf_type_encoding_name (encoding));
 	type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
 	break;
@@ -17692,7 +17609,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   if (attr)
     attr_to_dynamic_prop (attr, die, cu, &low);
   else if (!low_default_is_valid)
-    complaint (&symfile_complaints, _("Missing DW_AT_lower_bound "
+    complaint (_("Missing DW_AT_lower_bound "
 				      "- DIE at %s [in module %s]"),
 	       sect_offset_str (die->sect_off),
 	       objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -18325,8 +18242,7 @@ load_partial_dies (const struct die_reader_specs *reader,
 	 above.  In correct DWARF DW_TAG_typedef should have no children.  */
 
       if (pdi.tag == DW_TAG_typedef && pdi.has_children)
-	complaint (&symfile_complaints,
-		   _("DW_TAG_typedef has childen - GCC PR debug/47510 bug "
+	complaint (_("DW_TAG_typedef has childen - GCC PR debug/47510 bug "
 		     "- DIE at %s [in module %s]"),
 		   sect_offset_str (pdi.sect_off), objfile_name (objfile));
 
@@ -18341,8 +18257,7 @@ load_partial_dies (const struct die_reader_specs *reader,
 	  && parent_die->has_specification == 0)
 	{
 	  if (pdi.name == NULL)
-	    complaint (&symfile_complaints,
-		       _("malformed enumerator DIE ignored"));
+	    complaint (_("malformed enumerator DIE ignored"));
 	  else if (building_psymtab)
 	    add_psymbol_to_list (pdi.name, strlen (pdi.name), 0,
 				 VAR_DOMAIN, LOC_CONST,
@@ -18563,8 +18478,7 @@ partial_die_info::read (const struct die_reader_specs *reader,
 	  /* Ignore absolute siblings, they might point outside of
 	     the current compile unit.  */
 	  if (attr.form == DW_FORM_ref_addr)
-	    complaint (&symfile_complaints,
-		       _("ignoring absolute DW_AT_sibling"));
+	    complaint (_("ignoring absolute DW_AT_sibling"));
 	  else
 	    {
 	      const gdb_byte *buffer = reader->buffer;
@@ -18572,8 +18486,7 @@ partial_die_info::read (const struct die_reader_specs *reader,
 	      const gdb_byte *sibling_ptr = buffer + to_underlying (off);
 
 	      if (sibling_ptr < info_ptr)
-		complaint (&symfile_complaints,
-			   _("DW_AT_sibling points backwards"));
+		complaint (_("DW_AT_sibling points backwards"));
 	      else if (sibling_ptr > reader->buffer_end)
 		dwarf2_section_buffer_overflow_complaint (reader->die_section);
 	      else
@@ -18647,8 +18560,7 @@ partial_die_info::read (const struct die_reader_specs *reader,
 	  struct objfile *objfile = dwarf2_per_objfile->objfile;
 	  struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
-	  complaint (&symfile_complaints,
-		     _("DW_AT_low_pc %s is zero "
+	  complaint (_("DW_AT_low_pc %s is zero "
 		       "for DIE at %s [in module %s]"),
 		     paddress (gdbarch, lowpc),
 		     sect_offset_str (sect_off),
@@ -18660,8 +18572,7 @@ partial_die_info::read (const struct die_reader_specs *reader,
 	  struct objfile *objfile = dwarf2_per_objfile->objfile;
 	  struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
-	  complaint (&symfile_complaints,
-		     _("DW_AT_low_pc %s is not < DW_AT_high_pc %s "
+	  complaint (_("DW_AT_low_pc %s is not < DW_AT_high_pc %s "
 		       "for DIE at %s [in module %s]"),
 		     paddress (gdbarch, lowpc),
 		     paddress (gdbarch, highpc),
@@ -19143,8 +19054,7 @@ read_attribute_value (const struct die_reader_specs *reader,
       && DW_UNSND (attr) >= 0xffffffff)
     {
       complaint
-        (&symfile_complaints,
-         _("Suspicious DW_AT_byte_size value treated as zero instead of %s"),
+        (_("Suspicious DW_AT_byte_size value treated as zero instead of %s"),
          hex_string (DW_UNSND (attr)));
       DW_UNSND (attr) = 0;
     }
@@ -19342,8 +19252,7 @@ read_checked_initial_length_and_offset (bfd *abfd, const gdb_byte *buf,
 	      || cu_header->initial_length_size == 12);
 
   if (cu_header->initial_length_size != *bytes_read)
-    complaint (&symfile_complaints,
-	       _("intermixed 32-bit and 64-bit DWARF sections"));
+    complaint (_("intermixed 32-bit and 64-bit DWARF sections"));
 
   *offset_size = (*bytes_read == 4) ? 4 : 8;
   return length;
@@ -19888,8 +19797,7 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c
 	  || attr->form == DW_FORM_GNU_strp_alt)
 	str = DW_STRING (attr);
       else
-        complaint (&symfile_complaints,
-	           _("string type expected for attribute %s for "
+        complaint (_("string type expected for attribute %s for "
 		     "DIE at %s in module %s"),
 		   dwarf_attr_name (name), sect_offset_str (die->sect_off),
 		   objfile_name (cu->per_cu->dwarf2_per_objfile->objfile));
@@ -20121,8 +20029,7 @@ read_formatted_entries (struct dwarf2_per_objfile *dwarf2_per_objfile,
 	    case DW_LNCT_MD5:
 	      break;
 	    default:
-	      complaint (&symfile_complaints,
-			 _("Unknown format content type %s"),
+	      complaint (_("Unknown format content type %s"),
 			 pulongest (content_type));
 	    }
 	}
@@ -20160,9 +20067,9 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
   if (section->buffer == NULL)
     {
       if (cu->dwo_unit && cu->per_cu->is_debug_types)
-	complaint (&symfile_complaints, _("missing .debug_line.dwo section"));
+	complaint (_("missing .debug_line.dwo section"));
       else
-	complaint (&symfile_complaints, _("missing .debug_line section"));
+	complaint (_("missing .debug_line section"));
       return 0;
     }
 
@@ -20202,8 +20109,7 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
     {
       /* This is a version we don't understand.  The format could have
 	 changed in ways we don't handle properly so just punt.  */
-      complaint (&symfile_complaints,
-		 _("unsupported version in .debug_line section"));
+      complaint (_("unsupported version in .debug_line section"));
       return NULL;
     }
   if (lh->version >= 5)
@@ -20218,8 +20124,7 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
       line_ptr += 1;
       if (segment_selector_size != 0)
 	{
-	  complaint (&symfile_complaints,
-		     _("unsupported segment selector size %u "
+	  complaint (_("unsupported segment selector size %u "
 		       "in .debug_line section"),
 		     segment_selector_size);
 	  return NULL;
@@ -20240,8 +20145,7 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
   if (lh->maximum_ops_per_instruction == 0)
     {
       lh->maximum_ops_per_instruction = 1;
-      complaint (&symfile_complaints,
-		 _("invalid maximum_ops_per_instruction "
+      complaint (_("invalid maximum_ops_per_instruction "
 		   "in `.debug_line' section"));
     }
 
@@ -20315,8 +20219,7 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
   lh->statement_program_start = line_ptr;
 
   if (line_ptr > (section->buffer + section->size))
-    complaint (&symfile_complaints,
-	       _("line number info header doesn't "
+    complaint (_("line number info header doesn't "
 		 "fit in `.debug_line' section"));
 
   return lh;
@@ -20782,8 +20685,7 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
       struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
       long line_offset = line_ptr - get_debug_line_section (cu)->buffer;
 
-      complaint (&symfile_complaints,
-		 _(".debug_line address at offset 0x%lx is 0 [in module %s]"),
+      complaint (_(".debug_line address at offset 0x%lx is 0 [in module %s]"),
 		 line_offset, objfile_name (objfile));
       m_record_line_callback = noop_record_line;
       /* Note: record_line_callback is left as noop_record_line until
@@ -20910,8 +20812,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
 		  }
 		  break;
 		default:
-		  complaint (&symfile_complaints,
-			     _("mangled .debug_line section"));
+		  complaint (_("mangled .debug_line section"));
 		  return;
 		}
 	      /* Make sure that we parsed the extended op correctly.  If e.g.
@@ -20919,8 +20820,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
 		 we may have read the wrong number of bytes.  */
 	      if (line_ptr != extended_end)
 		{
-		  complaint (&symfile_complaints,
-			     _("mangled .debug_line section"));
+		  complaint (_("mangled .debug_line section"));
 		  return;
 		}
 	      break;
@@ -21299,8 +21199,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
 	    fe = NULL;
 
 	  if (fe == NULL)
-	    complaint (&symfile_complaints,
-		       _("file index out of range"));
+	    complaint (_("file index out of range"));
 	  else
 	    symbol_set_symtab (sym, fe->symtab);
 	}
@@ -21585,7 +21484,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
 	     trash data, but since we must specifically ignore things
 	     we don't recognize, there is nothing else we should do at
 	     this point.  */
-	  complaint (&symfile_complaints, _("unsupported tag: '%s'"),
+	  complaint (_("unsupported tag: '%s'"),
 		     dwarf_tag_name (die->tag));
 	  break;
 	}
@@ -21743,8 +21642,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
       break;
 
     default:
-      complaint (&symfile_complaints,
-		 _("unsupported const value attribute form: '%s'"),
+      complaint (_("unsupported const value attribute form: '%s'"),
 		 dwarf_form_name (attr->form));
       *value = 0;
       break;
@@ -21928,8 +21826,7 @@ lookup_die_type (struct die_info *die, const struct attribute *attr,
     }
   else
     {
-      complaint (&symfile_complaints,
-		 _("Dwarf Error: Bad type attribute %s in DIE"
+      complaint (_("Dwarf Error: Bad type attribute %s in DIE"
 		   " at %s [in module %s]"),
 		 dwarf_attr_name (attr->name), sect_offset_str (die->sect_off),
 		 objfile_name (objfile));
@@ -22057,8 +21954,7 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu)
       this_type = read_tag_atomic_type (die, cu);
       break;
     default:
-      complaint (&symfile_complaints,
-		 _("unexpected tag in read_type_die: '%s'"),
+      complaint (_("unexpected tag in read_type_die: '%s'"),
 		 dwarf_tag_name (die->tag));
       break;
     }
@@ -22272,8 +22168,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
 	 doesn't allow it), and break the loop here.  */
       name = dwarf2_name (die, cu);
       parent_name = dwarf2_name (parent, cu);
-      complaint (&symfile_complaints,
-		 _("template param type '%s' defined within parent '%s'"),
+      complaint (_("template param type '%s' defined within parent '%s'"),
 		 name ? name : "<unknown>",
 		 parent_name ? parent_name : "<unknown>");
       return "";
@@ -22808,8 +22703,7 @@ dwarf2_get_ref_die_offset (const struct attribute *attr)
   if (attr_form_is_ref (attr))
     return (sect_offset) DW_UNSND (attr);
 
-  complaint (&symfile_complaints,
-	     _("unsupported die ref attribute form: '%s'"),
+  complaint (_("unsupported die ref attribute form: '%s'"),
 	     dwarf_form_name (attr->form));
   return {};
 }
@@ -22831,8 +22725,7 @@ dwarf2_get_attr_constant_value (const struct attribute *attr, int default_value)
   else
     {
       /* For DW_FORM_data16 see attr_form_is_constant.  */
-      complaint (&symfile_complaints,
-		 _("Attribute value is not a constant (%s)"),
+      complaint (_("Attribute value is not a constant (%s)"),
                  dwarf_form_name (attr->form));
       return default_value;
     }
@@ -23169,8 +23062,7 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
       break;
 
     default:
-      complaint (&symfile_complaints,
-		 _("unsupported const value attribute form: '%s'"),
+      complaint (_("unsupported const value attribute form: '%s'"),
 		 dwarf_form_name (attr->form));
       break;
     }
@@ -23321,8 +23213,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
      the debug info.  */
   if (sig_type == NULL)
     {
-      complaint (&symfile_complaints,
-		 _("Dwarf Error: Cannot find signatured DIE %s referenced"
+      complaint (_("Dwarf Error: Cannot find signatured DIE %s referenced"
 		   " from DIE at %s [in module %s]"),
 		 hex_string (signature), sect_offset_str (die->sect_off),
 		 objfile_name (dwarf2_per_objfile->objfile));
@@ -23343,8 +23234,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
       type = read_type_die (type_die, type_cu);
       if (type == NULL)
 	{
-	  complaint (&symfile_complaints,
-		     _("Dwarf Error: Cannot build signatured type %s"
+	  complaint (_("Dwarf Error: Cannot build signatured type %s"
 		       " referenced from DIE at %s [in module %s]"),
 		     hex_string (signature), sect_offset_str (die->sect_off),
 		     objfile_name (dwarf2_per_objfile->objfile));
@@ -23353,8 +23243,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
     }
   else
     {
-      complaint (&symfile_complaints,
-		 _("Dwarf Error: Problem reading signatured DIE %s referenced"
+      complaint (_("Dwarf Error: Problem reading signatured DIE %s referenced"
 		   " from DIE at %s [in module %s]"),
 		 hex_string (signature), sect_offset_str (die->sect_off),
 		 objfile_name (dwarf2_per_objfile->objfile));
@@ -23389,8 +23278,7 @@ get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr,
       struct dwarf2_per_objfile *dwarf2_per_objfile
 	= cu->per_cu->dwarf2_per_objfile;
 
-      complaint (&symfile_complaints,
-		 _("Dwarf Error: DW_AT_signature has bad form %s in DIE"
+      complaint (_("Dwarf Error: DW_AT_signature has bad form %s in DIE"
 		   " at %s [in module %s]"),
 		 dwarf_form_name (attr->form), sect_offset_str (die->sect_off),
 		 objfile_name (dwarf2_per_objfile->objfile));
@@ -23710,10 +23598,10 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
 	    const char *name = get_DW_OP_name (op);
 
 	    if (name)
-	      complaint (&symfile_complaints, _("unsupported stack op: '%s'"),
+	      complaint (_("unsupported stack op: '%s'"),
 			 name);
 	    else
-	      complaint (&symfile_complaints, _("unsupported stack op: '%02x'"),
+	      complaint (_("unsupported stack op: '%02x'"),
 			 op);
 	  }
 
@@ -23724,15 +23612,13 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
          outside of the allocated space.  Also enforce minimum>0.  */
       if (stacki >= ARRAY_SIZE (stack) - 1)
 	{
-	  complaint (&symfile_complaints,
-		     _("location description stack overflow"));
+	  complaint (_("location description stack overflow"));
 	  return 0;
 	}
 
       if (stacki <= 0)
 	{
-	  complaint (&symfile_complaints,
-		     _("location description stack underflow"));
+	  complaint (_("location description stack underflow"));
 	  return 0;
 	}
     }
@@ -23795,8 +23681,7 @@ file_file_name (int file, struct line_header *lh)
       xsnprintf (fake_name, sizeof (fake_name),
 		 "<bad macro file number %d>", file);
 
-      complaint (&symfile_complaints,
-                 _("bad file number in macro information (%d)"),
+      complaint (_("bad file number in macro information (%d)"),
                  file);
 
       return xstrdup (fake_name);
@@ -23858,8 +23743,7 @@ consume_improper_spaces (const char *p, const char *body)
 {
   if (*p == ' ')
     {
-      complaint (&symfile_complaints,
-		 _("macro definition contains spaces "
+      complaint (_("macro definition contains spaces "
 		   "in formal argument list:\n`%s'"),
 		 body);
 
@@ -24088,8 +23972,7 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
 
     default:
       {
-	complaint (&symfile_complaints,
-		   _("invalid form 0x%x in `%s'"),
+	complaint (_("invalid form 0x%x in `%s'"),
 		   form, get_section_name (section));
 	return NULL;
       }
@@ -24116,8 +23999,7 @@ skip_unknown_opcode (unsigned int opcode,
 
   if (opcode_definitions[opcode] == NULL)
     {
-      complaint (&symfile_complaints,
-		 _("unrecognized DW_MACFINO opcode 0x%x"),
+      complaint (_("unrecognized DW_MACFINO opcode 0x%x"),
 		 opcode);
       return NULL;
     }
@@ -24162,8 +24044,7 @@ dwarf_parse_macro_header (const gdb_byte **opcode_definitions,
       version = read_2_bytes (abfd, mac_ptr);
       if (version != 4 && version != 5)
 	{
-	  complaint (&symfile_complaints,
-		     _("unrecognized version `%d' in .debug_macro section"),
+	  complaint (_("unrecognized version `%d' in .debug_macro section"),
 		     version);
 	  return NULL;
 	}
@@ -24310,8 +24191,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
             if (! current_file)
 	      {
 		/* DWARF violation as no main source is present.  */
-		complaint (&symfile_complaints,
-			   _("debug info with no main source gives macro %s "
+		complaint (_("debug info with no main source gives macro %s "
 			     "on line %d: %s"),
 			   is_define ? _("definition") : _("undefinition"),
 			   line, body);
@@ -24319,8 +24199,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
 	      }
 	    if ((line == 0 && !at_commandline)
 		|| (line != 0 && at_commandline))
-	      complaint (&symfile_complaints,
-			 _("debug info gives %s macro %s with %s line %d: %s"),
+	      complaint (_("debug info gives %s macro %s with %s line %d: %s"),
 			 at_commandline ? _("command-line") : _("in-file"),
 			 is_define ? _("definition") : _("undefinition"),
 			 line == 0 ? _("zero") : _("non-zero"), line, body);
@@ -24349,8 +24228,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
 
 	    if ((line == 0 && !at_commandline)
 		|| (line != 0 && at_commandline))
-	      complaint (&symfile_complaints,
-			 _("debug info gives source %d included "
+	      complaint (_("debug info gives source %d included "
 			   "from %s at %s line %d"),
 			 file, at_commandline ? _("command-line") : _("file"),
 			 line == 0 ? _("zero") : _("non-zero"), line);
@@ -24368,8 +24246,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
 
         case DW_MACRO_end_file:
           if (! current_file)
-	    complaint (&symfile_complaints,
-		       _("macro debug info has an unmatched "
+	    complaint (_("macro debug info has an unmatched "
 			 "`close_file' directive"));
           else
             {
@@ -24396,8 +24273,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
 		    = (enum dwarf_macro_record_type) read_1_byte (abfd,
 								  mac_ptr);
                   if (next_type != 0)
-		    complaint (&symfile_complaints,
-			       _("no terminating 0-type entry for "
+		    complaint (_("no terminating 0-type entry for "
 				 "macros in `.debug_macinfo' section"));
 
                   return;
@@ -24438,8 +24314,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
 	      {
 		/* This has actually happened; see
 		   http://sourceware.org/bugzilla/show_bug.cgi?id=13568.  */
-		complaint (&symfile_complaints,
-			   _("recursive DW_MACRO_import in "
+		complaint (_("recursive DW_MACRO_import in "
 			     ".debug_macro section"));
 	      }
 	    else
@@ -24534,7 +24409,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
   dwarf2_read_section (objfile, section);
   if (section->buffer == NULL)
     {
-      complaint (&symfile_complaints, _("missing %s section"), section_name);
+      complaint (_("missing %s section"), section_name);
       return;
     }
   abfd = get_section_bfd_owner (section);
@@ -24832,8 +24707,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
       fill_in_loclist_baton (cu, baton, attr);
 
       if (cu->base_known == 0)
-	complaint (&symfile_complaints,
-		   _("Location list used without "
+	complaint (_("Location list used without "
 		     "specifying the CU base address."));
 
       SYMBOL_ACLASS_INDEX (sym) = (is_block
@@ -25250,8 +25124,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
     }
   else if (attr != NULL)
     {
-      complaint (&symfile_complaints,
-		 _("DW_AT_allocated has the wrong form (%s) at DIE %s"),
+      complaint (_("DW_AT_allocated has the wrong form (%s) at DIE %s"),
 		 (attr != NULL ? dwarf_form_name (attr->form) : "n/a"),
 		 sect_offset_str (die->sect_off));
     }
@@ -25265,8 +25138,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
     }
   else if (attr != NULL)
     {
-      complaint (&symfile_complaints,
-		 _("DW_AT_associated has the wrong form (%s) at DIE %s"),
+      complaint (_("DW_AT_associated has the wrong form (%s) at DIE %s"),
 		 (attr != NULL ? dwarf_form_name (attr->form) : "n/a"),
 		 sect_offset_str (die->sect_off));
     }
@@ -25294,8 +25166,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
   slot = (struct dwarf2_per_cu_offset_and_type **)
     htab_find_slot (dwarf2_per_objfile->die_type_hash, &ofs, INSERT);
   if (*slot)
-    complaint (&symfile_complaints,
-	       _("A problem internal to GDB: DIE %s has type already set"),
+    complaint (_("A problem internal to GDB: DIE %s has type already set"),
 	       sect_offset_str (die->sect_off));
   *slot = XOBNEW (&objfile->objfile_obstack,
 		  struct dwarf2_per_cu_offset_and_type);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 6d70006081..4f77a5214e 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1887,7 +1887,7 @@ get_vptr_fieldno (struct type *type, struct type **basetypep)
 static void
 stub_noname_complaint (void)
 {
-  complaint (&symfile_complaints, _("stub type has NULL name"));
+  complaint (_("stub type has NULL name"));
 }
 
 /* Return nonzero if TYPE has a DYN_PROP_BYTE_STRIDE dynamic property
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 230bd860a4..4c1d4f0bfa 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -191,8 +191,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
 	      if (sym->name == NULL || sym->name[0] == 0)
                 {
                   /* Unexpected empty N_SO.  */
-                  complaint (&symfile_complaints,
-                             _("Unexpected empty N_SO stab"));
+                  complaint (_("Unexpected empty N_SO stab"));
                 }
               else
                 {
@@ -209,8 +208,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
                 }
 
               /* Debugging symbols are not expected here.  */
-              complaint (&symfile_complaints,
-                         _("%s: Unexpected debug stab outside SO markers"),
+              complaint (_("%s: Unexpected debug stab outside SO markers"),
                          objfile_name (objfile));
             }
           else
@@ -227,7 +225,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
 	      if (sym->name == NULL || sym->name[0] == 0)
                 {
                   /* Unexpected empty N_SO.  */
-                  complaint (&symfile_complaints, _("Empty SO section"));
+                  complaint (_("Empty SO section"));
                   state = S_NO_SO;
                 }
               else if (state == S_FIRST_SO)
@@ -237,7 +235,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
                   state = S_SECOND_SO;
                 }
               else
-                complaint (&symfile_complaints, _("Three SO in a raw"));
+                complaint (_("Three SO in a raw"));
             }
           else if (mach_o_sym->n_type == N_OSO)
             {
@@ -258,8 +256,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
                 }
             }
           else
-            complaint (&symfile_complaints,
-                       _("Unexpected stab after SO"));
+            complaint (_("Unexpected stab after SO"));
           break;
 
         case S_STAB_FILE:
@@ -276,7 +273,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
                 }
               else
                 {
-                  complaint (&symfile_complaints, _("Missing nul SO"));
+                  complaint (_("Missing nul SO"));
                   file_so = sym;
                   state = S_FIRST_SO;
                 }
@@ -304,21 +301,19 @@ macho_symtab_read (minimal_symbol_reader &reader,
                     case N_GSYM:
                       break;
                     default:
-                      complaint (&symfile_complaints,
-                                 _("unhandled stab for dwarf OSO file"));
+                      complaint (_("unhandled stab for dwarf OSO file"));
                       break;
                     }
                 }
             }
           else
-            complaint (&symfile_complaints,
-                       _("non-debugging symbol within SO"));
+            complaint (_("non-debugging symbol within SO"));
           break;
         }
     }
 
   if (state != S_NO_SO)
-    complaint (&symfile_complaints, _("missing nul SO"));
+    complaint (_("missing nul SO"));
 }
 
 /* If NAME describes an archive member (ie: ARCHIVE '(' MEMBER ')'),
@@ -496,8 +491,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
           ent = (struct macho_sym_hash_entry *)
             bfd_hash_lookup (&table, sym->name, TRUE, FALSE);
           if (ent->sym != NULL)
-            complaint (&symfile_complaints,
-                       _("Duplicated symbol %s in symbol table"), sym->name);
+            complaint (_("Duplicated symbol %s in symbol table"), sym->name);
           else
             {
               if (mach_o_debug_level > 4)
diff --git a/gdb/macroscope.c b/gdb/macroscope.c
index 23d2e50fdd..d0a86239e3 100644
--- a/gdb/macroscope.c
+++ b/gdb/macroscope.c
@@ -76,8 +76,7 @@ sal_macro_scope (struct symtab_and_line sal)
       ms->file = main_file;
       ms->line = -1;
 
-      complaint (&symfile_complaints,
-                 _("symtab found for `%s', but that file\n"
+      complaint (_("symtab found for `%s', but that file\n"
                  "is not covered in the compilation unit's macro information"),
                  symtab_to_filename_for_display (sal.symtab));
     }
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index db8dbeae82..2171580637 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -478,8 +478,7 @@ macro_include (struct macro_source_file *source,
 
       link_fullname = macro_source_fullname (*link);
       source_fullname = macro_source_fullname (source);
-      complaint (&symfile_complaints,
-		 _("both `%s' and `%s' allegedly #included at %s:%d"),
+      complaint (_("both `%s' and `%s' allegedly #included at %s:%d"),
 		 included, link_fullname, source_fullname, line);
       xfree (source_fullname);
       xfree (link_fullname);
@@ -730,8 +729,7 @@ check_for_redefinition (struct macro_source_file *source, int line,
 	  
 	  source_fullname = macro_source_fullname (source);
 	  found_key_fullname = macro_source_fullname (found_key->start_file);
-	  complaint (&symfile_complaints,
-		     _("macro `%s' redefined at %s:%d; "
+	  complaint (_("macro `%s' redefined at %s:%d; "
 		       "original definition at %s:%d"),
 		     name, source_fullname, line, found_key_fullname,
 		     found_key->start_line);
@@ -859,8 +857,7 @@ macro_undef (struct macro_source_file *source, int line,
 
 	      source_fullname = macro_source_fullname (source);
 	      key_fullname = macro_source_fullname (key->end_file);
-              complaint (&symfile_complaints,
-                         _("macro '%s' is #undefined twice,"
+              complaint (_("macro '%s' is #undefined twice,"
                            " at %s:%d and %s:%d"),
 			 name, source_fullname, line, key_fullname,
 			 key->end_line);
@@ -880,8 +877,7 @@ macro_undef (struct macro_source_file *source, int line,
          has no macro definition in scope is ignored.  So we should
          ignore it too.  */
 #if 0
-      complaint (&symfile_complaints,
-		 _("no definition for macro `%s' in scope to #undef at %s:%d"),
+      complaint (_("no definition for macro `%s' in scope to #undef at %s:%d"),
 		 name, source->filename, line);
 #endif
     }
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 3f0cdc74aa..eeefb665cd 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -125,40 +125,39 @@ struct symloc
 static void
 index_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints, _("bad aux index at symbol %s"), arg1);
+  complaint (_("bad aux index at symbol %s"), arg1);
 }
 
 static void
 unknown_ext_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints, _("unknown external symbol %s"), arg1);
+  complaint (_("unknown external symbol %s"), arg1);
 }
 
 static void
 basic_type_complaint (int arg1, const char *arg2)
 {
-  complaint (&symfile_complaints, _("cannot map ECOFF basic type 0x%x for %s"),
+  complaint (_("cannot map ECOFF basic type 0x%x for %s"),
 	     arg1, arg2);
 }
 
 static void
 bad_tag_guess_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints,
-	     _("guessed tag type of %s incorrectly"), arg1);
+  complaint (_("guessed tag type of %s incorrectly"), arg1);
 }
 
 static void
 bad_rfd_entry_complaint (const char *arg1, int arg2, int arg3)
 {
-  complaint (&symfile_complaints, _("bad rfd entry for %s: file %d, index %d"),
+  complaint (_("bad rfd entry for %s: file %d, index %d"),
 	     arg1, arg2, arg3);
 }
 
 static void
 unexpected_type_code_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints, _("unexpected type code for %s"), arg1);
+  complaint (_("unexpected type code for %s"), arg1);
 }
 
 /* Macros and extra defs.  */
@@ -521,8 +520,7 @@ add_pending (FDR *fh, char *sh, struct type *t)
 static void
 reg_value_complaint (int regnum, int num_regs, const char *sym)
 {
-  complaint (&symfile_complaints,
-	     _("bad register number %d (max %d) in symbol %s"),
+  complaint (_("bad register number %d (max %d) in symbol %s"),
              regnum, num_regs - 1, sym);
 }
 
@@ -747,8 +745,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                     keep_counting = 0;
                     break;
                   default:
-                    complaint (&symfile_complaints,
-                               _("unknown symbol type 0x%x"), sh->st);
+                    complaint (_("unknown symbol type 0x%x"), sh->st);
                     break;
                 }
             }
@@ -965,8 +962,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 		break;
 
 	      default:
-		complaint (&symfile_complaints,
-			   _("declaration block contains "
+		complaint (_("declaration block contains "
 			     "unhandled symbol type %d"),
 			   tsym.st);
 	      }
@@ -1245,8 +1241,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 	  ;
 	}
       else
-	complaint (&symfile_complaints,
-		   _("stEnd with storage class %d not handled"), sh->sc);
+	complaint (_("stEnd with storage class %d not handled"), sh->sc);
 
       pop_parse_stack ();	/* Restore previous lexical context.  */
       break;
@@ -1358,7 +1353,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
     case stConstant:
       break;			/* constant */
     default:
-      complaint (&symfile_complaints, _("unknown symbol type 0x%x"), sh->st);
+      complaint (_("unknown symbol type 0x%x"), sh->st);
       break;
     }
 
@@ -1599,8 +1594,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
 	  else if (t->bt == btEnum)
 	    ;
 	  else
-	    complaint (&symfile_complaints,
-		       _("can't handle TIR fBitfield for %s"),
+	    complaint (_("can't handle TIR fBitfield for %s"),
 		       sym_name);
 	}
       else
@@ -1629,8 +1623,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
 
       if (rf == -1)
 	{
-	  complaint (&symfile_complaints,
-		     _("unable to cross ref btIndirect for %s"), sym_name);
+	  complaint (_("unable to cross ref btIndirect for %s"), sym_name);
 	  return basic_type (btInt, mdebugread_objfile);
 	}
       xref_fh = get_rfd (fd, rf);
@@ -1749,8 +1742,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
       ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
       if (tp == (struct type *) NULL)
 	{
-	  complaint (&symfile_complaints,
-		     _("unable to cross ref btTypedef for %s"), sym_name);
+	  complaint (_("unable to cross ref btTypedef for %s"), sym_name);
 	  tp = basic_type (btInt, mdebugread_objfile);
 	}
     }
@@ -1796,8 +1788,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
 
   /* Complain for illegal continuations due to corrupt aux entries.  */
   if (t->continued)
-    complaint (&symfile_complaints,
-	       _("illegal TIR continued for %s"), sym_name);
+    complaint (_("illegal TIR continued for %s"), sym_name);
 
   return tp;
 }
@@ -1859,8 +1850,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
          else due to corrupt aux entries.  */
       if (TYPE_CODE (indx) != TYPE_CODE_INT)
 	{
-	  complaint (&symfile_complaints,
-		     _("illegal array index type for %s, assuming int"),
+	  complaint (_("illegal array index type for %s, assuming int"),
 		     sym_name);
 	  indx = objfile_type (mdebugread_objfile)->builtin_int;
 	}
@@ -1908,7 +1898,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
       return 0;
 
     default:
-      complaint (&symfile_complaints, _("unknown type qualifier 0x%x"), tq);
+      complaint (_("unknown type qualifier 0x%x"), tq);
       return 0;
     }
 }
@@ -1940,8 +1930,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
 	{
 	  /* Static procedure at address pr->adr.  Sigh.  */
 	  /* FIXME-32x64.  assuming pr->adr fits in long.  */
-	  complaint (&symfile_complaints,
-		     _("can't handle PDR for static proc at 0x%lx"),
+	  complaint (_("can't handle PDR for static proc at 0x%lx"),
 		     (unsigned long) pr->adr);
 	  return;
 	}
@@ -2004,7 +1993,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
     }
   else
     {
-      complaint (&symfile_complaints, _("PDR for %s, but no symbol"), sh_name);
+      complaint (_("PDR for %s, but no symbol"), sh_name);
 #if 1
       return;
 #else
@@ -2230,8 +2219,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
 	     with corrupt binaries.  */
 	  if (lt->nitems >= maxlines)
 	    {
-	      complaint (&symfile_complaints,
-			 _("guessed size of linetable for %s incorrectly"),
+	      complaint (_("guessed size of linetable for %s incorrectly"),
 			 fdr_name (fh));
 	      break;
 	    }
@@ -2244,8 +2232,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
 static void
 function_outside_compilation_unit_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints,
-	     _("function `%s' appears to be defined "
+  complaint (_("function `%s' appears to be defined "
 	       "outside of all compilation units"),
 	     arg1);
 }
@@ -2486,15 +2473,13 @@ parse_partial_symbols (minimal_symbol_reader &reader,
          external symbols.  */
       if (ext_in->ifd < -1 || ext_in->ifd >= hdr->ifdMax)
 	{
-	  complaint (&symfile_complaints,
-		     _("bad ifd for external symbol: %d (max %ld)"),
+	  complaint (_("bad ifd for external symbol: %d (max %ld)"),
 		     ext_in->ifd, hdr->ifdMax);
 	  continue;
 	}
       if (ext_in->asym.iss < 0 || ext_in->asym.iss >= hdr->issExtMax)
 	{
-	  complaint (&symfile_complaints,
-		     _("bad iss for external symbol: %ld (max %ld)"),
+	  complaint (_("bad iss for external symbol: %ld (max %ld)"),
 		     ext_in->asym.iss, hdr->issExtMax);
 	  continue;
 	}
@@ -3312,8 +3297,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 			   searching to the end of every string looking for
 			   a backslash.  */
 
-			complaint (&symfile_complaints,
-				   _("unknown symbol descriptor `%c'"), p[1]);
+			complaint (_("unknown symbol descriptor `%c'"), p[1]);
 
 			/* Ignore it; perhaps it is an extension that we don't
 			   know about.  */
@@ -3377,8 +3361,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 		  default:
 		    /* If we haven't found it yet, ignore it.  It's
 		       probably some new type we don't know about yet.  */
-		    complaint (&symfile_complaints,
-			       _("unknown symbol type %s"),
+		    complaint (_("unknown symbol type %s"),
 			       hex_string (type_code)); /* CUR_SYMBOL_TYPE */
 		    continue;
 		  }
@@ -3479,8 +3462,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 		  if (new_sdx <= cur_sdx)
 		    {
 		      /* This should not happen either... FIXME.  */
-		      complaint (&symfile_complaints,
-				 _("bad proc end in aux found from symbol %s"),
+		      complaint (_("bad proc end in aux found from symbol %s"),
 				 name);
 		      new_sdx = cur_sdx + 1;	/* Don't skip backward.  */
 		    }
@@ -3589,8 +3571,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 		  if (new_sdx <= cur_sdx)
 		    {
 		      /* This happens with the Ultrix kernel.  */
-		      complaint (&symfile_complaints,
-				 _("bad aux index at block symbol %s"), name);
+		      complaint (_("bad aux index at block symbol %s"), name);
 		      new_sdx = cur_sdx + 1;	/* Don't skip backward.  */
 		    }
 		  cur_sdx = new_sdx;
@@ -3610,9 +3591,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 		default:
 		  /* Both complaints are valid:  one gives symbol name,
 		     the other the offending symbol type.  */
-		  complaint (&symfile_complaints, _("unknown local symbol %s"),
+		  complaint (_("unknown local symbol %s"),
 			     name);
-		  complaint (&symfile_complaints, _("with type %d"), sh.st);
+		  complaint (_("with type %d"), sh.st);
 		  cur_sdx++;
 		  continue;
 		}
@@ -3774,7 +3755,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 			  &rh);
 	  if (rh < 0 || rh >= hdr->ifdMax)
 	    {
-	      complaint (&symfile_complaints, _("bad file number %ld"), rh);
+	      complaint (_("bad file number %ld"), rh);
 	      continue;
 	    }
 
@@ -4084,8 +4065,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
 	    /* These are generated by gcc-2.x, do not complain.  */
 	    ;
 	  else
-	    complaint (&symfile_complaints,
-		       _("unknown stabs symbol %s"), name);
+	    complaint (_("unknown stabs symbol %s"), name);
 	}
 
       if (! last_symtab_ended)
@@ -4444,8 +4424,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
 					+ fh->iauxBase + sh.index)->a_ti,
 				      &tir);
 	  if (tir.tq0 != tqNil)
-	    complaint (&symfile_complaints,
-		       _("illegal tq0 in forward typedef for %s"), sym_name);
+	    complaint (_("illegal tq0 in forward typedef for %s"), sym_name);
 	  switch (tir.bt)
 	    {
 	    case btVoid:
@@ -4481,8 +4460,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
 	      break;
 
 	    default:
-	      complaint (&symfile_complaints,
-			 _("illegal bt %d in forward typedef for %s"), tir.bt,
+	      complaint (_("illegal bt %d in forward typedef for %s"), tir.bt,
 			 sym_name);
 	      *tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
 	      break;
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 8c24fde3ee..308aa9a2a7 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -124,8 +124,7 @@ lookup_objc_class (struct gdbarch *gdbarch, const char *classname)
     function = find_function_in_inferior("objc_lookup_class", NULL);
   else
     {
-      complaint (&symfile_complaints,
-		 _("no way to lookup Objective-C classes"));
+      complaint (_("no way to lookup Objective-C classes"));
       return 0;
     }
 
@@ -154,8 +153,7 @@ lookup_child_selector (struct gdbarch *gdbarch, const char *selname)
     function = find_function_in_inferior("sel_get_any_uid", NULL);
   else
     {
-      complaint (&symfile_complaints,
-		 _("no way to lookup Objective-C selectors"));
+      complaint (_("no way to lookup Objective-C selectors"));
       return 0;
     }
 
@@ -626,8 +624,7 @@ info_selectors_command (const char *regexp, int from_tty)
 	  name = (char *) strchr (name+2, ' ');
 	  if (name == NULL)
 	    {
-	      complaint (&symfile_complaints, 
-			 _("Bad method name '%s'"), 
+	      complaint (_("Bad method name '%s'"), 
 			 MSYMBOL_NATURAL_NAME (msymbol));
 	      continue;
 	    }
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index f57f4f58b0..0432ce6208 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1284,8 +1284,7 @@ filter_overlapping_sections (struct obj_section **map, int map_size)
 
 	      struct gdbarch *const gdbarch = get_objfile_arch (objf1);
 
-	      complaint (&symfile_complaints,
-			 _("unexpected overlap between:\n"
+	      complaint (_("unexpected overlap between:\n"
 			   " (A) section `%s' from `%s' [%s, %s)\n"
 			   " (B) section `%s' from `%s' [%s, %s).\n"
 			   "Will ignore section B"),
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 4cfefaa3e0..366b07d4a2 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -164,21 +164,20 @@ static const char vb_name[] = "_vb$";
 static void
 invalid_cpp_abbrev_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints, _("invalid C++ abbreviation `%s'"), arg1);
+  complaint (_("invalid C++ abbreviation `%s'"), arg1);
 }
 
 static void
 reg_value_complaint (int regnum, int num_regs, const char *sym)
 {
-  complaint (&symfile_complaints,
-	     _("bad register number %d (max %d) in symbol %s"),
+  complaint (_("bad register number %d (max %d) in symbol %s"),
              regnum, num_regs - 1, sym);
 }
 
 static void
 stabs_general_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints, "%s", arg1);
+  complaint ("%s", arg1);
 }
 
 /* Make a list of forward references which haven't been defined.  */
@@ -249,8 +248,7 @@ dbx_lookup_type (int typenums[2], struct objfile *objfile)
 
   if (filenum < 0 || filenum >= n_this_object_header_files)
     {
-      complaint (&symfile_complaints,
-		 _("Invalid symbol data: type number "
+      complaint (_("Invalid symbol data: type number "
 		   "(%d,%d) out of range at symtab pos %d."),
 		 filenum, index, symnum);
       goto error_return;
@@ -673,7 +671,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
       p = strchr (p, ':');
       if (p == NULL)
 	{
-	  complaint (&symfile_complaints, 
+	  complaint (
 		     _("Bad stabs string '%s'"), string);
 	  return NULL;
 	}
@@ -726,7 +724,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
 	  /* fall through */
 
 	default:
-	  complaint (&symfile_complaints, _("Unknown C++ symbol name `%s'"),
+	  complaint (_("Unknown C++ symbol name `%s'"),
 		     string);
 	  goto normal;		/* Do *something* with it.  */
 	}
@@ -1490,8 +1488,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
 static struct type *
 error_type (const char **pp, struct objfile *objfile)
 {
-  complaint (&symfile_complaints,
-	     _("couldn't parse type; debugger out of date?"));
+  complaint (_("couldn't parse type; debugger out of date?"));
   while (1)
     {
       /* Skip to end of symbol.  */
@@ -1611,8 +1608,7 @@ again:
 	      {
 		/* Complain and keep going, so compilers can invent new
 		   cross-reference types.  */
-		complaint (&symfile_complaints,
-			   _("Unrecognized cross-reference type `%c'"),
+		complaint (_("Unrecognized cross-reference type `%c'"),
 			   (*pp)[0]);
 		code = TYPE_CODE_STRUCT;
 		break;
@@ -1842,8 +1838,7 @@ again:
           ++*pp;
         else
           {
-	    complaint (&symfile_complaints,
-		       _("Prototyped function type didn't "
+	    complaint (_("Prototyped function type didn't "
 			 "end arguments with `#':\n%s"),
 		       type_start);
           }
@@ -1955,8 +1950,7 @@ again:
 	  (*pp)++;
 	  return_type = read_type (pp, objfile);
 	  if (*(*pp)++ != ';')
-	    complaint (&symfile_complaints,
-		       _("invalid (minimal) member type "
+	    complaint (_("invalid (minimal) member type "
 			 "data format at symtab pos %d."),
 		       symnum);
 	  type = allocate_stub_method (return_type);
@@ -2088,7 +2082,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
 
   if (typenum >= 0 || typenum < -NUMBER_RECOGNIZED)
     {
-      complaint (&symfile_complaints, _("Unknown builtin type %d"), typenum);
+      complaint (_("Unknown builtin type %d"), typenum);
       return objfile_type (objfile)->builtin_error;
     }
 
@@ -2254,8 +2248,7 @@ stabs_method_name_from_physname (const char *physname)
 
   if (method_name == NULL)
     {
-      complaint (&symfile_complaints,
-		 _("Method has bad physname %s\n"), physname);
+      complaint (_("Method has bad physname %s\n"), physname);
       return NULL;
     }
 
@@ -2446,8 +2439,7 @@ read_member_functions (struct field_info *fip, const char **pp,
 	    case '.':
 	      break;
 	    default:
-	      complaint (&symfile_complaints,
-			 _("const/volatile indicator missing, got '%c'"),
+	      complaint (_("const/volatile indicator missing, got '%c'"),
 			 **pp);
 	      break;
 	    }
@@ -2530,8 +2522,7 @@ read_member_functions (struct field_info *fip, const char **pp,
 
 	    default:
 	      /* error */
-	      complaint (&symfile_complaints,
-			 _("member function type missing, got '%c'"),
+	      complaint (_("member function type missing, got '%c'"),
 			 (*pp)[-1]);
 	      /* Normal member function.  */
 	      /* Fall through.  */
@@ -2805,8 +2796,7 @@ read_cpp_abbrev (struct field_info *fip, const char **pp, struct type *type,
 	  name = type_name_no_tag (context);
 	  if (name == NULL)
 	    {
-	      complaint (&symfile_complaints,
-			 _("C++ abbreviated type name "
+	      complaint (_("C++ abbreviated type name "
 			   "unknown at symtab pos %d"),
 			 symnum);
 	      name = "FOO";
@@ -3167,8 +3157,7 @@ read_baseclasses (struct field_info *fip, const char **pp, struct type *type,
 	default:
 	  /* Unknown character.  Complain and treat it as non-virtual.  */
 	  {
-	    complaint (&symfile_complaints,
-		       _("Unknown virtual character `%c' for baseclass"),
+	    complaint (_("Unknown virtual character `%c' for baseclass"),
 		       **pp);
 	  }
 	}
@@ -3185,8 +3174,7 @@ read_baseclasses (struct field_info *fip, const char **pp, struct type *type,
 	  /* Bad visibility format.  Complain and treat it as
 	     public.  */
 	  {
-	    complaint (&symfile_complaints,
-		       _("Unknown visibility `%c' for baseclass"),
+	    complaint (_("Unknown visibility `%c' for baseclass"),
 		       newobj->visibility);
 	    newobj->visibility = VISIBILITY_PUBLIC;
 	  }
@@ -3294,8 +3282,7 @@ read_tilde_fields (struct field_info *fip, const char **pp, struct type *type,
 		    }
 		}
 	      /* Virtual function table field not found.  */
-	      complaint (&symfile_complaints,
-			 _("virtual function table pointer "
+	      complaint (_("virtual function table pointer "
 			   "not found when defining class `%s'"),
 			 TYPE_NAME (type));
 	      return 0;
@@ -3407,8 +3394,7 @@ attach_fields_to_type (struct field_info *fip, struct type *type,
 	default:
 	  /* Unknown visibility.  Complain and treat it as public.  */
 	  {
-	    complaint (&symfile_complaints,
-		       _("Unknown visibility `%c' for field"),
+	    complaint (_("Unknown visibility `%c' for field"),
 		       fip->list->visibility);
 	  }
 	  break;
@@ -3449,8 +3435,7 @@ complain_about_struct_wipeout (struct type *type)
       kind = "";
     }
 
-  complaint (&symfile_complaints,
-	     _("struct/union type gets multiply defined: %s%s"), kind, name);
+  complaint (_("struct/union type gets multiply defined: %s%s"), kind, name);
 }
 
 /* Set the length for all variants of a same main_type, which are
@@ -4251,8 +4236,7 @@ handle_true_range:
       /* Does this actually ever happen?  Is that why we are worrying
          about dealing with it rather than just calling error_type?  */
 
-      complaint (&symfile_complaints,
-		 _("base type %d of range type is not defined"), rangenums[1]);
+      complaint (_("base type %d of range type is not defined"), rangenums[1]);
 
       index_type = objfile_type (objfile)->builtin_int;
     }
@@ -4293,7 +4277,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
 	 have been present ";-16,(0,43)" reference instead.  This way the
 	 excessive ";" marker prematurely stops the parameters parsing.  */
 
-      complaint (&symfile_complaints, _("Invalid (empty) method arguments"));
+      complaint (_("Invalid (empty) method arguments"));
       *varargsp = 0;
     }
   else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
@@ -4335,8 +4319,7 @@ common_block_start (const char *name, struct objfile *objfile)
 {
   if (common_block_name != NULL)
     {
-      complaint (&symfile_complaints,
-		 _("Invalid symbol data: common block within common block"));
+      complaint (_("Invalid symbol data: common block within common block"));
     }
   common_block = local_symbols;
   common_block_i = local_symbols ? local_symbols->nsyms : 0;
@@ -4362,7 +4345,7 @@ common_block_end (struct objfile *objfile)
 
   if (common_block_name == NULL)
     {
-      complaint (&symfile_complaints, _("ECOMM symbol unmatched by BCOMM"));
+      complaint (_("ECOMM symbol unmatched by BCOMM"));
       return;
     }
 
@@ -4564,7 +4547,7 @@ cleanup_undefined_types_1 (void)
 
 		if (type_name == NULL)
 		  {
-		    complaint (&symfile_complaints, _("need a type name"));
+		    complaint (_("need a type name"));
 		    break;
 		  }
 		for (ppt = file_symbols; ppt; ppt = ppt->next)
@@ -4590,8 +4573,7 @@ cleanup_undefined_types_1 (void)
 
 	default:
 	  {
-	    complaint (&symfile_complaints,
-		       _("forward-referenced types left unresolved, "
+	    complaint (_("forward-referenced types left unresolved, "
                        "type code %d."),
 		       TYPE_CODE (*type));
 	  }
@@ -4742,8 +4724,7 @@ scan_file_globals (struct objfile *objfile)
 	  if (SYMBOL_CLASS (prev) == LOC_STATIC)
 	    SYMBOL_ACLASS_INDEX (prev) = LOC_UNRESOLVED;
 	  else
-	    complaint (&symfile_complaints,
-		       _("%s: common block `%s' from "
+	    complaint (_("%s: common block `%s' from "
 			 "global_sym_chain unresolved"),
 		       objfile_name (objfile), SYMBOL_PRINT_NAME (prev));
 	}
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 52e5267968..ed7e1a0d3f 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -1512,7 +1512,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
   /* Making sure there is a name.  */
   if (name == NULL)
     {
-      complaint (&symfile_complaints, _("corrupt probe name when "
+      complaint (_("corrupt probe name when "
 					"reading `%s'"),
 		 objfile_name (objfile));
 
@@ -1549,7 +1549,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
       || (memchr (probe_args, '\0', (char *) el->data + el->size - name)
 	  != el->data + el->size - 1))
     {
-      complaint (&symfile_complaints, _("corrupt probe argument when "
+      complaint (_("corrupt probe argument when "
 					"reading `%s'"),
 		 objfile_name (objfile));
       /* If the argument string is NULL, it means some problem happened with
@@ -1590,7 +1590,7 @@ get_stap_base_address (bfd *obfd, bfd_vma *base)
 
   if (ret == NULL)
     {
-      complaint (&symfile_complaints, _("could not obtain base address for "
+      complaint (_("could not obtain base address for "
 					"SystemTap section on objfile `%s'."),
 		 obfd->filename);
       return 0;
@@ -1660,7 +1660,7 @@ stap_static_probe_ops::get_probes (std::vector<probe *> *probesp,
     {
       /* If we are here, it means we have failed to parse every known
 	 probe.  */
-      complaint (&symfile_complaints, _("could not parse SystemTap probe(s) "
+      complaint (_("could not parse SystemTap probe(s) "
 					"from inferior"));
       return;
     }
diff --git a/gdb/symfile.c b/gdb/symfile.c
index e48089a130..a57bd6a593 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -986,7 +986,7 @@ syms_from_objfile_1 (struct objfile *objfile,
      initial symbol reading for this file.  */
 
   (*objfile->sf->sym_init) (objfile);
-  clear_complaints (&symfile_complaints, 1);
+  clear_complaints (1);
 
   (*objfile->sf->sym_offsets) (objfile, *addrs);
 
@@ -1033,7 +1033,7 @@ finish_new_objfile (struct objfile *objfile, symfile_add_flags add_flags)
     }
 
   /* We're done reading the symbol file; finish off complaints.  */
-  clear_complaints (&symfile_complaints, 0);
+  clear_complaints (0);
 }
 
 /* Process a symbol file, as either the main file or as a dynamically
@@ -2457,7 +2457,7 @@ reread_symbols (void)
 	    }
 
 	  (*objfile->sf->sym_init) (objfile);
-	  clear_complaints (&symfile_complaints, 1);
+	  clear_complaints (1);
 
 	  objfile->flags &= ~OBJF_PSYMTABS_READ;
 
@@ -2487,7 +2487,7 @@ reread_symbols (void)
 	    }
 
 	  /* We're done reading the symbol file; finish off complaints.  */
-	  clear_complaints (&symfile_complaints, 0);
+	  clear_complaints (0);
 
 	  /* Getting new symbols may change our opinion about what is
 	     frameless.  */
diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index 774ff89ae6..886b43521d 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -59,27 +59,27 @@ proc test_initial_complaints { } {
 
     # Prime the system
     gdb_test_stdio \
-	"call complaint_internal (&symfile_complaints, \"Register a complaint\")" \
+	"call complaint_internal (\"Register a complaint\")" \
 	"During symbol reading, Register a complaint."
 
     # Check that the complaint was inserted and where
-    gdb_test "print symfile_complaints->root->fmt" \
+    gdb_test "print symfile_complaint_book.root->fmt" \
 	    ".\[0-9\]+ =.*\"Register a complaint\""
 
     # Re-issue the first message #1
     gdb_test_stdio \
-	"call complaint_internal (&symfile_complaints, symfile_complaints->root->fmt)" \
+	"call complaint_internal (symfile_complaint_book.root->fmt)" \
 	"During symbol reading, Register a complaint."
 
     # Check that there is only one thing in the list.  How the boolean
     # result is output depends on whether GDB is built as a C or C++
     # program.
-    gdb_test "print symfile_complaints->root->next == &complaint_sentinel" \
+    gdb_test "print symfile_complaint_book.root->next == &complaint_sentinel" \
 	    ".\[0-9\]+ = \(1|true\)" "list has one entry"
 
     # Add a second complaint, expect it
     gdb_test_stdio \
-	"call complaint_internal (&symfile_complaints, \"Testing! Testing! Testing!\")" \
+	"call complaint_internal (\"Testing! Testing! Testing!\")" \
 	"During symbol reading, Testing. Testing. Testing.."
 
     return 0
@@ -88,17 +88,17 @@ proc test_initial_complaints { } {
 # For short complaints, all are the same
 
 proc test_short_complaints { } {
-    gdb_test_exact "call clear_complaints (&symfile_complaints, 1)" "" "short start"
+    gdb_test_exact "call clear_complaints (1)" "" "short start"
 
     # Prime the system
     test_complaint \
-	"call complaint_internal (&symfile_complaints, \"short line 1\")" \
+	"call complaint_internal (\"short line 1\")" \
 	"short line 1..." \
 	"short line 1"
 
     # Add a second complaint, expect it
     test_complaint \
-	"call complaint_internal (&symfile_complaints, \"short line 2\")" \
+	"call complaint_internal (\"short line 2\")" \
 	"short line 2..." \
 	"short line 2"
 
@@ -131,9 +131,9 @@ proc test_empty_complaint { cmd msg } {
 
 proc test_empty_complaints { } {
 
-    test_empty_complaint "call clear_complaints(&symfile_complaints,0)" \
+    test_empty_complaint "call clear_complaints(0)" \
 	    "empty non-verbose clear"
-    test_empty_complaint "call clear_complaints(&symfile_complaints,1)" \
+    test_empty_complaint "call clear_complaints(1)" \
 	    "empty verbose clear"
 
     return 0
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 16ebd17607..9655694558 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -876,7 +876,7 @@ handle_unload_dll ()
      4 mysterious UNLOAD_DLL_DEBUG_EVENTs during the startup phase (these
      events are apparently caused by the WOW layer, the interface between
      32bit and 64bit worlds).  */
-  complaint (&symfile_complaints, _("dll starting at %s not found."),
+  complaint (_("dll starting at %s not found."),
 	     host_address_to_string (lpBaseOfDll));
 }
 
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 7cf5e259d9..7b9694bcff 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -182,22 +182,19 @@ static const struct dwarf2_debug_sections dwarf2_xcoff_names = {
 static void
 bf_notfound_complaint (void)
 {
-  complaint (&symfile_complaints,
-	     _("line numbers off, `.bf' symbol not found"));
+  complaint (_("line numbers off, `.bf' symbol not found"));
 }
 
 static void
 ef_complaint (int arg1)
 {
-  complaint (&symfile_complaints,
-	     _("Mismatched .ef symbol ignored starting at symnum %d"), arg1);
+  complaint (_("Mismatched .ef symbol ignored starting at symnum %d"), arg1);
 }
 
 static void
 eb_complaint (int arg1)
 {
-  complaint (&symfile_complaints,
-	     _("Mismatched .eb symbol ignored starting at symnum %d"), arg1);
+  complaint (_("Mismatched .eb symbol ignored starting at symnum %d"), arg1);
 }
 
 static void xcoff_initial_scan (struct objfile *, symfile_add_flags);
@@ -558,7 +555,7 @@ record_include_begin (struct coff_symbol *cs)
       /* This can happen with old versions of GCC.
          GCC 2.3.3-930426 does not exhibit this on a test case which
          a user said produced the message for him.  */
-      complaint (&symfile_complaints, _("Nested C_BINCL symbols"));
+      complaint (_("Nested C_BINCL symbols"));
     }
   ++inclDepth;
 
@@ -575,7 +572,7 @@ record_include_end (struct coff_symbol *cs)
 
   if (inclDepth == 0)
     {
-      complaint (&symfile_complaints, _("Mismatched C_BINCL/C_EINCL pair"));
+      complaint (_("Mismatched C_BINCL/C_EINCL pair"));
     }
 
   allocate_include_entry ();
@@ -856,8 +853,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
     {
       if (endoffset >= limit_offset)
 	{
-	  complaint (&symfile_complaints,
-		     _("Bad line table offset in C_EINCL directive"));
+	  complaint (_("Bad line table offset in C_EINCL directive"));
 	  return;
 	}
       limit_offset = endoffset;
@@ -978,7 +974,7 @@ xcoff_next_symbol_text (struct objfile *objfile)
   bfd_coff_swap_sym_in (objfile->obfd, raw_symbol, &symbol);
   if (symbol.n_zeroes)
     {
-      complaint (&symfile_complaints, _("Unexpected symbol continuation"));
+      complaint (_("Unexpected symbol continuation"));
 
       /* Return something which points to '\0' and hope the symbol reading
          code does something reasonable.  */
@@ -992,7 +988,7 @@ xcoff_next_symbol_text (struct objfile *objfile)
     }
   else
     {
-      complaint (&symfile_complaints, _("Unexpected symbol continuation"));
+      complaint (_("Unexpected symbol continuation"));
 
       /* Return something which points to '\0' and hope the symbol reading
          code does something reasonable.  */
@@ -1446,8 +1442,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
 	case C_UNTAG:
 	case C_ENTAG:
 	  {
-	    complaint (&symfile_complaints,
-		       _("Unrecognized storage class %d."),
+	    complaint (_("Unrecognized storage class %d."),
 		       cs->c_sclass);
 	  }
 	  break;
@@ -1632,7 +1627,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
 	  break;
 
 	default:
-	  complaint (&symfile_complaints, _("Unexpected storage class: %d"),
+	  complaint (_("Unexpected storage class: %d"),
 		     cs->c_sclass);
 	  /* FALLTHROUGH */
 
@@ -1717,7 +1712,7 @@ read_symbol (struct internal_syment *symbol, int symno)
 
   if (symno < 0 || symno >= nsyms)
     {
-      complaint (&symfile_complaints, _("Invalid symbol offset"));
+      complaint (_("Invalid symbol offset"));
       symbol->n_value = 0;
       symbol->n_scnum = -1;
       return;
@@ -2192,8 +2187,7 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
 static void
 function_outside_compilation_unit_complaint (const char *arg1)
 {
-  complaint (&symfile_complaints,
-	     _("function `%s' appears to be defined "
+  complaint (_("function `%s' appears to be defined "
 	       "outside of all compilation units"),
 	     arg1);
 }
@@ -2524,8 +2518,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
 
 	default:
 	  {
-	    complaint (&symfile_complaints,
-		       _("Storage class %d not recognized during scan"),
+	    complaint (_("Storage class %d not recognized during scan"),
 		       sclass);
 	  }
 	  /* FALLTHROUGH */
@@ -2901,8 +2894,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
 		   the end of every string looking for a
 		   backslash.  */
 
-		complaint (&symfile_complaints,
-			   _("unknown symbol descriptor `%c'"), p[1]);
+		complaint (_("unknown symbol descriptor `%c'"), p[1]);
 
 		/* Ignore it; perhaps it is an extension that we don't
 		   know about.  */
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 1/9] Remove internal_complaint
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
                   ` (5 preceding siblings ...)
  2018-05-22  5:09 ` [RFA 8/9] Remove struct complain Tom Tromey
@ 2018-05-22  5:09 ` Tom Tromey
  2018-05-22  5:50 ` [RFA 3/9] Remove "noisy" parameter from clear_complaints Tom Tromey
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I happened to notice that gdb has both complaint_internal and
internal_complaint.  The latter is unused, so this patch removes it.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (internal_complaint): Remove.
	* complaints.h (internal_complaint): Remove.
---
 gdb/ChangeLog    |  5 +++++
 gdb/complaints.c | 10 ----------
 gdb/complaints.h |  5 -----
 3 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index 44e98f8dad..9e5df396eb 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -245,16 +245,6 @@ complaint_internal (struct complaints **complaints, const char *fmt, ...)
   va_end (args);
 }
 
-void
-internal_complaint (struct complaints **complaints, const char *file,
-		    int line, const char *fmt, ...)
-{
-  va_list args;
-  va_start (args, fmt);
-  vcomplaint (complaints, file, line, fmt, args);
-  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
diff --git a/gdb/complaints.h b/gdb/complaints.h
index 3c1b3c5c6b..37648fb525 100644
--- a/gdb/complaints.h
+++ b/gdb/complaints.h
@@ -47,11 +47,6 @@ extern void complaint_internal (struct complaints **complaints,
     }								\
   while (0)
 
-extern void internal_complaint (struct complaints **complaints,
-				const char *file, int line,
-				const char *fmt,
-				...) ATTRIBUTE_PRINTF (4, 5);
-
 /* 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
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 3/9] Remove "noisy" parameter from clear_complaints
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
                   ` (6 preceding siblings ...)
  2018-05-22  5:09 ` [RFA 1/9] Remove internal_complaint Tom Tromey
@ 2018-05-22  5:50 ` Tom Tromey
  2018-05-22  7:01 ` [RFA 7/9] Remove file and line from struct complain Tom Tromey
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  5:50 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

After the previous patch, the "noisy" parameter to clear_complaints is
no longer used, so this patch removes it.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (clear_complaints): Remove "noisy" parameter.
	* complaints.h (clear_complaints): Update.
	* symfile.c (syms_from_objfile_1, finish_new_objfile)
	(reread_symbols): Update.

gdb/testsuite/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* gdb.gdb/complaints.exp (test_empty_complaints): Update.
---
 gdb/ChangeLog                        |  7 +++++++
 gdb/complaints.c                     |  6 ++----
 gdb/complaints.h                     |  2 +-
 gdb/symfile.c                        |  8 ++++----
 gdb/testsuite/ChangeLog              |  4 ++++
 gdb/testsuite/gdb.gdb/complaints.exp | 14 +++++---------
 6 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index 71d36e6326..d29b3c7830 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -220,12 +220,10 @@ complaint_internal (struct complaints **complaints, const char *fmt, ...)
    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.  */
+   complaints (rather than being interleaved with other messages).  */
 
 void
-clear_complaints (struct complaints **c, int less_verbose, int noisy)
+clear_complaints (struct complaints **c, int less_verbose)
 {
   struct complaints *complaints = get_complaints (c);
   struct complain *p;
diff --git a/gdb/complaints.h b/gdb/complaints.h
index 37648fb525..652827e47b 100644
--- a/gdb/complaints.h
+++ b/gdb/complaints.h
@@ -56,7 +56,7 @@ extern void complaint_internal (struct complaints **complaints,
    enough context for the user to figure it out.  */
 
 extern void clear_complaints (struct complaints **complaints,
-			      int less_verbose, int noisy);
+			      int less_verbose);
 
 
 #endif /* !defined (COMPLAINTS_H) */
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 7bc03fbb8f..e48089a130 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -986,7 +986,7 @@ syms_from_objfile_1 (struct objfile *objfile,
      initial symbol reading for this file.  */
 
   (*objfile->sf->sym_init) (objfile);
-  clear_complaints (&symfile_complaints, 1, add_flags & SYMFILE_VERBOSE);
+  clear_complaints (&symfile_complaints, 1);
 
   (*objfile->sf->sym_offsets) (objfile, *addrs);
 
@@ -1033,7 +1033,7 @@ finish_new_objfile (struct objfile *objfile, symfile_add_flags add_flags)
     }
 
   /* We're done reading the symbol file; finish off complaints.  */
-  clear_complaints (&symfile_complaints, 0, add_flags & SYMFILE_VERBOSE);
+  clear_complaints (&symfile_complaints, 0);
 }
 
 /* Process a symbol file, as either the main file or as a dynamically
@@ -2457,7 +2457,7 @@ reread_symbols (void)
 	    }
 
 	  (*objfile->sf->sym_init) (objfile);
-	  clear_complaints (&symfile_complaints, 1, 1);
+	  clear_complaints (&symfile_complaints, 1);
 
 	  objfile->flags &= ~OBJF_PSYMTABS_READ;
 
@@ -2487,7 +2487,7 @@ reread_symbols (void)
 	    }
 
 	  /* We're done reading the symbol file; finish off complaints.  */
-	  clear_complaints (&symfile_complaints, 0, 1);
+	  clear_complaints (&symfile_complaints, 0);
 
 	  /* Getting new symbols may change our opinion about what is
 	     frameless.  */
diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index 1d532b7fd6..774ff89ae6 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -88,7 +88,7 @@ proc test_initial_complaints { } {
 # For short complaints, all are the same
 
 proc test_short_complaints { } {
-    gdb_test_exact "call clear_complaints (&symfile_complaints, 1, 1)" "" "short start"
+    gdb_test_exact "call clear_complaints (&symfile_complaints, 1)" "" "short start"
 
     # Prime the system
     test_complaint \
@@ -131,14 +131,10 @@ proc test_empty_complaint { cmd msg } {
 
 proc test_empty_complaints { } {
 
-    test_empty_complaint "call clear_complaints(&symfile_complaints,0,0)" \
-	    "empty non-verbose non-noisy clear"
-    test_empty_complaint "call clear_complaints(&symfile_complaints,1,0)" \
-	    "empty verbose non-noisy clear"
-    test_empty_complaint "call clear_complaints(&symfile_complaints,1,1)" \
-	    "empty verbose noisy clear"
-    test_empty_complaint "call clear_complaints(&symfile_complaints,0,1)" \
-	    "empty non-verbose noisy clear"
+    test_empty_complaint "call clear_complaints(&symfile_complaints,0)" \
+	    "empty non-verbose clear"
+    test_empty_complaint "call clear_complaints(&symfile_complaints,1)" \
+	    "empty verbose clear"
 
     return 0
 }
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFA 7/9] Remove file and line from struct complain
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
                   ` (7 preceding siblings ...)
  2018-05-22  5:50 ` [RFA 3/9] Remove "noisy" parameter from clear_complaints Tom Tromey
@ 2018-05-22  7:01 ` Tom Tromey
  2018-05-23 14:49 ` [RFA 0/9] Radically simplify the complaint system Pedro Alves
  2018-06-04 20:25 ` Possible regression on gdb.gdb/complaints.exp (was: Re: [RFA 0/9] Radically simplify the complaint system) Sergio Durigan Junior
  10 siblings, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-22  7:01 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

The file and line handling in complaints.c wasn't used once
internal_complaint was removed.  This patch removes all the related
code.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (struct complain) <file, line>: Remove.
	(find_complaint): Remove file, line parameters.
	(complaint_internal): Update.
---
 gdb/ChangeLog    |  6 ++++++
 gdb/complaints.c | 20 +++++---------------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index 4b7532582f..851d8f5d6f 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -38,8 +38,6 @@ enum complaint_series {
 
 struct complain
 {
-  const char *file;
-  int line;
   const char *fmt;
   int counter;
   struct complain *next;
@@ -59,9 +57,8 @@ static struct complaints symfile_complaint_book = {
   ISOLATED_MESSAGE
 };
 
-static struct complain * ATTRIBUTE_PRINTF (4, 0)
-find_complaint (struct complaints *complaints, const char *file,
-		int line, const char *fmt)
+static struct complain * ATTRIBUTE_PRINTF (2, 0)
+find_complaint (struct complaints *complaints, const char *fmt)
 {
   struct complain *complaint;
 
@@ -73,17 +70,13 @@ find_complaint (struct complaints *complaints, const char *file,
        complaint != NULL;
        complaint = complaint->next)
     {
-      if (complaint->fmt == fmt
-	  && complaint->file == file
-	  && complaint->line == line)
+      if (complaint->fmt == fmt)
 	return complaint;
     }
 
   /* Oops not seen before, fill in a new complaint.  */
   complaint = XNEW (struct complain);
   complaint->fmt = fmt;
-  complaint->file = file;
-  complaint->line = line;
   complaint->counter = 0;
   complaint->next = NULL;
 
@@ -107,8 +100,7 @@ complaint_internal (const char *fmt, ...)
 {
   va_list args;
 
-  struct complain *complaint = find_complaint (&symfile_complaint_book, NULL,
-					       0, fmt);
+  struct complain *complaint = find_complaint (&symfile_complaint_book, fmt);
   enum complaint_series series;
 
   complaint->counter++;
@@ -125,9 +117,7 @@ complaint_internal (const char *fmt, ...)
      string somewhere up the call chain.  */
   gdb_assert (complaint->fmt == fmt);
 
-  if (complaint->file != NULL)
-    internal_vwarning (complaint->file, complaint->line, fmt, args);
-  else if (deprecated_warning_hook)
+  if (deprecated_warning_hook)
     (*deprecated_warning_hook) (fmt, args);
   else
     {
-- 
2.13.6

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA 0/9] Radically simplify the complaint system
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
                   ` (8 preceding siblings ...)
  2018-05-22  7:01 ` [RFA 7/9] Remove file and line from struct complain Tom Tromey
@ 2018-05-23 14:49 ` Pedro Alves
  2018-05-23 15:08   ` Tom Tromey
  2018-06-04 20:25 ` Possible regression on gdb.gdb/complaints.exp (was: Re: [RFA 0/9] Radically simplify the complaint system) Sergio Durigan Junior
  10 siblings, 1 reply; 21+ messages in thread
From: Pedro Alves @ 2018-05-23 14:49 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 05/22/2018 06:06 AM, Tom Tromey wrote:
> I must confess, I've long disliked the complaint system.  It got in
> the way a little bit, ages ago, when I tried to multi-thread the
> psymtab reader.  And, it got in the way a bit more during one of my
> attempts to format the "Reading symbols" output more nicely (spoiler:
> I have another approach to this in the works, but I took this detour
> first).  Aside from these things, the code also seemed unusually
> complex for the task it performed.
> 
> This series radically simplifies the complaint system.  It removes
> most of the code -- which, I think, has never really been used.

Awesome!  I started doing something similar a while ago after adding
the complaint wrapper macro, but never really finished it off:

  https://github.com/palves/gdb/tree/palves/complaints

Probably nothing worth looking over.

This looks good to me, but I have one question:

Can you give an example case of when do we still need or want
the ISOLATED_MESSAGE vs SHORT_FIRST_MESSAGE distinction?
I removed it from my version, but I don't recall whether I
concluded the distinction made no difference, or whether
I still wanted to double check.  Off hand, since we're
admitting that complaints are only for debug info reading,
I'd think the distinction doesn't make much sense.  Unless
we're really not admitting that?  /me confused, I guess.

> Tested by the buildbot.  I also locally tested complaints.exp with
> each patch in the series.
Note: git am showed:

Applying: Remove symfile_complaints
.git/rebase-apply/patch:247: trailing whitespace.
vcomplaint (const char *file, 
.git/rebase-apply/patch:253: trailing whitespace.
  struct complain *complaint = find_complaint (&symfile_complaint_book, file, 
.git/rebase-apply/patch:2497: trailing whitespace.
              complaint (_("Bad method name '%s'"), 
warning: 3 lines add whitespace errors.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA 0/9] Radically simplify the complaint system
  2018-05-23 14:49 ` [RFA 0/9] Radically simplify the complaint system Pedro Alves
@ 2018-05-23 15:08   ` Tom Tromey
  2018-05-23 17:44     ` Pedro Alves
  0 siblings, 1 reply; 21+ messages in thread
From: Tom Tromey @ 2018-05-23 15:08 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Can you give an example case of when do we still need or want
Pedro> the ISOLATED_MESSAGE vs SHORT_FIRST_MESSAGE distinction?

Sure.  You can see it using:

$ ./gdb -nx
(gdb) set complaints 1
(gdb) file ./gdb

I get:

    Reading symbols from ./gdb...DW_AT_low_pc 0x0 is zero for DIE at 0x1717ad8 [in module /home/tromey/gdb/build/gdb/gdb]....debug_line address at offset 0xa6284 is 0 [in module /home/tromey/gdb/build/gdb/gdb]...done.

    ... stuff here ...

    During symbol reading, unsupported tag: 'DW_TAG_unspecified_type'.
    During symbol reading, const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0.


What's happening here is that the SHORT_FIRST_MESSAGE stuff is printed
during the "Reading symbols...", and then once psymtabs are read, we hit
a call to clear_complaints.  Any subsequent complaints -- say, during
psymtab expansion -- are issued as ISOLATED_MESSAGE.

I have some more patches to try to clean some of this up as well, but I
thought it would be better to submit this series as a simple complaint
cleanup rather than trying to change the output at the same time.

What I have so far still preserves this distinction, so this would be a
good time to talk about what should be done.  All I really did is add
some newlines and remove the "done." text, so that the "Reading symbols"
output is cleaner, like:

    Reading symbols from ./gdb...
    DW_AT_low_pc 0x0 is zero for DIE at 0x1717ad8 [in module /home/tromey/gdb/build/gdb/gdb]
    debug_line address at offset 0xa6284 is 0 [in module /home/tromey/gdb/build/gdb/gdb]

This is a bit weird sometimes still, because some of the complaints are
rather uninformative, e.g.:

	  complaint (&symfile_complaints,
		     _("location description stack overflow"));

I do think it would be good to be able to remove the *_MESSAGE
constants, I'm just not sure exactly what to print.  Probably I'm just
overthinking it since I doubt anyone except gdb developers enable
complaints.

Pedro> Note: git am showed:

I'll fix that.

Tom

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA 0/9] Radically simplify the complaint system
  2018-05-23 15:08   ` Tom Tromey
@ 2018-05-23 17:44     ` Pedro Alves
  2018-05-28 10:41       ` Tom Tromey
  0 siblings, 1 reply; 21+ messages in thread
From: Pedro Alves @ 2018-05-23 17:44 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 05/23/2018 03:17 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> Can you give an example case of when do we still need or want
> Pedro> the ISOLATED_MESSAGE vs SHORT_FIRST_MESSAGE distinction?
> 
> Sure.  You can see it using:
> 
> $ ./gdb -nx
> (gdb) set complaints 1
> (gdb) file ./gdb
> 
> I get:
> 
>     Reading symbols from ./gdb...DW_AT_low_pc 0x0 is zero for DIE at 0x1717ad8 [in module /home/tromey/gdb/build/gdb/gdb]....debug_line address at offset 0xa6284 is 0 [in module /home/tromey/gdb/build/gdb/gdb]...done.
> 
>     ... stuff here ...
> 
>     During symbol reading, unsupported tag: 'DW_TAG_unspecified_type'.
>     During symbol reading, const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0.
> 
> 
> What's happening here is that the SHORT_FIRST_MESSAGE stuff is printed
> during the "Reading symbols...", and then once psymtabs are read, we hit
> a call to clear_complaints.  Any subsequent complaints -- say, during
> psymtab expansion -- are issued as ISOLATED_MESSAGE.

Ah, OK.  I don't get those SHORT_FIRST_MESSAGE ones here, lucky me.

I do get them if I interrupt debug info reading with ctrl-c, eh:

Reading symbols from ./gdb...^Cdone.
Quit
Setting up the environment for debugging gdb.
unsupported tag: 'DW_TAG_unspecified_type'...debug info gives source 58 included from file at zero line 0...debug info gives command-line macro definition with non-zero line 19: _STDC_PREDEF_H 1...Breakpoint 1 at 0x63811a: file /home/pedro/gdb/binutils-gdb/src/gdb/common/errors.c, line 54.
const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0...Member function "~_Sp_counted_base" (offset 0x422925) is virtual but the vtable offset is not specified...cannot get low and high bounds for subprogram DIE at 0x42b8d6...Child DIE 0x443665 and its abstract origin 0x443601 have different parents...Multiple children of DIE 0x445e71 refer to DIE 0x445e60 as their abstract origin...Breakpoint 2 at 0x475d2c: file /home/pedro/gdb/binutils-gdb/src/gdb/cli/cli-cmds.c, line 197.
(top-gdb) 

I've thought before that those several complaints printed in the same
line were very confusing to read.  I wouldn't miss not-having-newlines
at all.

> 
> I have some more patches to try to clean some of this up as well, but I
> thought it would be better to submit this series as a simple complaint
> cleanup rather than trying to change the output at the same time.

That's reasonable.  The patch is fine with me to merge as is.

> 
> What I have so far still preserves this distinction, so this would be a
> good time to talk about what should be done.  All I really did is add
> some newlines and remove the "done." text, so that the "Reading symbols"
> output is cleaner, like:
> 
>     Reading symbols from ./gdb...
>     DW_AT_low_pc 0x0 is zero for DIE at 0x1717ad8 [in module /home/tromey/gdb/build/gdb/gdb]
>     debug_line address at offset 0xa6284 is 0 [in module /home/tromey/gdb/build/gdb/gdb]
> 
> This is a bit weird sometimes still, because some of the complaints are
> rather uninformative, e.g.:
> 
> 	  complaint (&symfile_complaints,
> 		     _("location description stack overflow"));
> 
> I do think it would be good to be able to remove the *_MESSAGE
> constants, I'm just not sure exactly what to print.  Probably I'm just
> overthinking it since I doubt anyone except gdb developers enable
> complaints.

Yeah, why would a user want them?

I wonder whether printing the module name first, maybe also a context
prefix, before the complaint message would make it a little bit nicer.
Something like:

Reading symbols from ./gdb...
DWARF reader: /home/tromey/gdb/build/gdb/gdb: DW_AT_low_pc 0x0 is zero for DIE at 0x1717ad8
DWARF reader: /home/tromey/gdb/build/gdb/gdb: debug_line address at offset 0xa6284 is 0

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA 0/9] Radically simplify the complaint system
  2018-05-28 10:41       ` Tom Tromey
@ 2018-05-28 10:41         ` Tom Tromey
  2018-05-28 19:37         ` Pedro Alves
  1 sibling, 0 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-28 10:41 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom>   const char *filename = get_section_file_name (section);
Tom> ...
Tom> 	  complaint (_("debug type entry at offset %s is duplicate to"
Tom> 		       " the entry at offset %s, signature %s"),
Tom> 		     sect_offset_str (sect_off), sect_offset_str (dup_sect_off),
Tom> 		     hex_string (header.signature));

I cut-and-pasted the wrong complaint here, and in fact that function
doesn't do this.  But there's at least one more example, this time from
skip_form_bytes:

	complaint (_("invalid form 0x%x in `%s'"),
		   form, get_section_name (section));

Tom

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA 0/9] Radically simplify the complaint system
  2018-05-23 17:44     ` Pedro Alves
@ 2018-05-28 10:41       ` Tom Tromey
  2018-05-28 10:41         ` Tom Tromey
  2018-05-28 19:37         ` Pedro Alves
  0 siblings, 2 replies; 21+ messages in thread
From: Tom Tromey @ 2018-05-28 10:41 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> What's happening here is that the SHORT_FIRST_MESSAGE stuff is printed
>> during the "Reading symbols...", and then once psymtabs are read, we hit
>> a call to clear_complaints.  Any subsequent complaints -- say, during
>> psymtab expansion -- are issued as ISOLATED_MESSAGE.

Pedro> Ah, OK.  I don't get those SHORT_FIRST_MESSAGE ones here, lucky me.

Curious.

Pedro> I do get them if I interrupt debug info reading with ctrl-c, eh:

Now that is even more curious.  I can't interrupt debug info reading at
all.  And, this is what I'd expect, because the only QUIT in
dwarf2read.c is in dw_expand_symtabs_matching_file_matcher, which is
only used during CU expansion, not the initial read.

So I wonder why this works for you.

Pedro> I wonder whether printing the module name first, maybe also a context
Pedro> prefix, before the complaint message would make it a little bit nicer.
Pedro> Something like:

Pedro> Reading symbols from ./gdb...
Pedro> DWARF reader: /home/tromey/gdb/build/gdb/gdb: DW_AT_low_pc 0x0 is zero for DIE at 0x1717ad8
Pedro> DWARF reader: /home/tromey/gdb/build/gdb/gdb: debug_line address at offset 0xa6284 is 0

I looked at this a bit.  There are two issues.

One is that the generic reader code (or whatever asks for psymtab
expansion, etc) does not know the name of the symbol reader it is
calling.  So, there's no convenient way to print "DWARF" there.

Second, in some cases the relevant module name isn't what is generically
available.  Consider read_comp_unit_head, which does:

  const char *filename = get_section_file_name (section);
...
	  complaint (_("debug type entry at offset %s is duplicate to"
		       " the entry at offset %s, signature %s"),
		     sect_offset_str (sect_off), sect_offset_str (dup_sect_off),
		     hex_string (header.signature));

Here, the file name might be the dwz file, or maybe some dwo file (I
don't know), depending on where the section originated.


So, for the time being, I plan to just tidy up the output a bit without
changing it too much.  Maybe one idea would be to remove the
SHORT_FIRST_MESSAGE case from complaints.c and just have every message
start "During symbol reading".  This would at least be explicit.


I do think it would be worthwhile to go through all the DWARF complaints
and fix them up to include the relevant locating information.

For example, bad call:

	  complaint (_("location description stack underflow"));

This is bad since there's no convenient way to find the offending DIE.
In the past I've debugged gdb to find these.

Good call:

	  complaint (_("compilation unit with DW_AT_GNU_dwo_name"
		       " has children (offset %s) [in module %s]"),
		     sect_offset_str (this_cu->sect_off),
		     bfd_get_filename (abfd));

Though, it occurs to me that going through all of them to include this
info would tend to work against the idea of some more generic fix.

Tom

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA 0/9] Radically simplify the complaint system
  2018-05-28 10:41       ` Tom Tromey
  2018-05-28 10:41         ` Tom Tromey
@ 2018-05-28 19:37         ` Pedro Alves
  2018-05-28 22:19           ` Tom Tromey
  1 sibling, 1 reply; 21+ messages in thread
From: Pedro Alves @ 2018-05-28 19:37 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 05/28/2018 04:04 AM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
>>> What's happening here is that the SHORT_FIRST_MESSAGE stuff is printed
>>> during the "Reading symbols...", and then once psymtabs are read, we hit
>>> a call to clear_complaints.  Any subsequent complaints -- say, during
>>> psymtab expansion -- are issued as ISOLATED_MESSAGE.
> 
> Pedro> Ah, OK.  I don't get those SHORT_FIRST_MESSAGE ones here, lucky me.
> 
> Curious.
> 
> Pedro> I do get them if I interrupt debug info reading with ctrl-c, eh:
> 
> Now that is even more curious.  I can't interrupt debug info reading at
> all.  And, this is what I'd expect, because the only QUIT in
> dwarf2read.c is in dw_expand_symtabs_matching_file_matcher, which is
> only used during CU expansion, not the initial read.
> 
> So I wonder why this works for you.


Yeah, turns out that the Ctrl-C remains pending until after
debug info reading:

$ ./gdb -q ./gdb
Reading symbols from ./gdb...^Cdone.   # a few seconds pass between ^C is printed and the "Quit".
Quit
Setting up the environment for debugging gdb.
unsupported tag: 'DW_TAG_unspecified_type'...debug info gives source 58 included from file at zero line 0...debug info gives command-line macro definition with non-zero line 19: _STDC_PREDEF_H 1...debug info gives command-line macro definition with non-zero line 38: __STDC_IEC_559__ 1...Breakpoint 1 at 0x638cb4: file /home/pedro/gdb/binutils-gdb-2/src/gdb/common/errors.c, line 54.
unsupported tag: 'DW_TAG_unspecified_type'...const value length mismatch for 'std::ratio<1, 1000000000>::num', got 8, expected 0...const value length mismatch for 'std::ratio<1, 1000000000>::den', got 8, expected 0...Member function "~_Sp_counted_base" (offset 0x42276f) is virtual but the vtable offset is not specified...cannot get low and high bounds for subprogram DIE at 0x42b720...cannot get low and high bounds for subprogram DIE at 0x42b7ce...Member function "~probe" (offset 0x43b527) is virtual but the vtable offset is not specified...Child DIE 0x443498 and its abstract origin 0x443434 have different parents...Child DIE 0x443598 and its abstract origin 0x443534 have different parents...Multiple children of DIE 0x445ca4 refer to DIE 0x445c93 as their abstract origin...Multiple children of DIE 0x44619d refer to DIE 0x44618c as their abstract origin...debug info gives source 156 included from file at zero line 0...Breakpoint 2 at 0x475caa: file /home/pedro/gdb/binutils-gdb-2/src/gdb/cli/cli-cmds.c, line 197.
(top-gdb) 

The quit comes from here:

(top-gdb) bt
#0  0x0000000000637a1f in throw_quit(char const*, ...) (fmt=0xc1b421 "Quit")
    at src/gdb/common/common-exceptions.c:403
#1  0x00000000008d0c96 in quit() () at src/gdb/utils.c:720
#2  0x0000000000709d2e in default_quit_handler() () at src/gdb/event-top.c:955
#3  0x00000000008d0cc6 in maybe_quit() () at src/gdb/utils.c:734
#4  0x000000000087829b in target_read(target_ops*, target_object, char const*, unsigned char*, unsigned long, long) (ops=0x1167ec0 <exec_ops>, object=TARGET_OBJECT_MEMORY, annex=0x0, buf=0x7fff81fbe620 "H\346\373\201\377\177", offset=10845696, len=1)
    at src/gdb/target.c:1543
#5  0x0000000000877cf7 in target_read_memory(unsigned long, unsigned char*, long) (memaddr=10845696, myaddr=0x7fff81fbe620 "H\346\373\201\377\177", len=1) at src/gdb/target.c:1335
#6  0x00000000005f2dc0 in program_breakpoint_here_p(gdbarch*, unsigned long) (gdbarch=0x1c83970, address=10845696)
    at src/gdb/breakpoint.c:8688
#7  0x00000000005f2ec4 in bp_loc_is_permanent(bp_location*) (loc=0x26310b0) at src/gdb/breakpoint.c:8712
#8  0x00000000005f2cf6 in add_location_to_breakpoint(breakpoint*, symtab_and_line const*) (b=0x1c3c220, sal=0x7fff81fbe780)
    at src/gdb/breakpoint.c:8656
#9  0x00000000005efd33 in init_raw_breakpoint(breakpoint*, gdbarch*, symtab_and_line, bptype, breakpoint_ops const*) (b=0x1c3c220, gdbarch=0x1c83970, sal=..., bptype=bp_std_terminate_master, ops=0x1168bc0 <internal_breakpoint_ops>)
    at src/gdb/breakpoint.c:7209
#10 0x00000000005efdf5 in set_raw_breakpoint(gdbarch*, symtab_and_line, bptype, breakpoint_ops const*) (gdbarch=0x1c83970, sal=..., bptype=bp_std_terminate_master, ops=0x1168bc0 <internal_breakpoint_ops>) at src/gdb/breakpoint.c:7243
#11 0x00000000005e7b27 in create_internal_breakpoint(gdbarch*, CORE_ADDR, bptype, breakpoint_ops const*) (gdbarch=0x1c83970, address=10845696, type=bp_std_terminate_master, ops=0x1168bc0 <internal_breakpoint_ops>) at src/gdb/breakpoint.c:3118
#12 0x00000000005e85a8 in create_std_terminate_master_breakpoint() () at src/gdb/breakpoint.c:3400
#13 0x00000000005fede1 in breakpoint_re_set() () at src/gdb/breakpoint.c:13907
#14 0x0000000000856dec in clear_symtab_users(enum_flags<symfile_add_flag>) (add_flags=...)
    at src/gdb/symfile.c:2774
#15 0x0000000000852911 in finish_new_objfile(objfile*, symfile_add_flags) (objfile=0x1c18d20, add_flags=...)
    at src/gdb/symfile.c:1028
#16 0x0000000000852d8f in symbol_file_add_with_addrs(bfd*, char const*, symfile_add_flags, section_addr_info*, objfile_flags, objfile*) (abfd=0x1473660, name=0x7fff81fc0c43 "./gdb", add_flags=..., addrs=0x0, flags=..., parent=0x0)
    at src/gdb/symfile.c:1162
#17 0x0000000000852ee7 in symbol_file_add_from_bfd(bfd*, char const*, enum_flags<symfile_add_flag>, std::vector<other_sections, std::allocator<other_sections> >*, enum_flags<objfile_flag>, objfile*) (abfd=0x1473660, name=0x7fff81fc0c43 "./gdb", add_flags=..., addrs=0x0, flags=..., parent=0x0) at src/gdb/symfile.c:1201
#18 0x0000000000852f41 in symbol_file_add(char const*, enum_flags<symfile_add_flag>, std::vector<other_sections, std::allocator<other_sections> >*, enum_flags<objfile_flag>) (name=0x7fff81fc0c43 "./gdb", add_flags=..., addrs=0x0, flags=...)
    at src/gdb/symfile.c:1214
#19 0x000000000085300f in symbol_file_add_main_1(char const*, symfile_add_flags, objfile_flags) (args=0x7fff81fc0c43 "./gdb", add_flags=..., flags=...) at src/gdb/symfile.c:1237
#20 0x0000000000852faa in symbol_file_add_main(char const*, enum_flags<symfile_add_flag>) (args=0x7fff81fc0c43 "./gdb", add_flags=...)
    at src/gdb/symfile.c:1228


And then when that happens, 'complaints.c'::series is not
restored back [because the clear_complaints call is skipped,
because it is not exception safe], so all the following
complaints are issued with SHORT_FIRST_MESSAGE:

 (top-gdb) p 'complaints.c'::series
 $2 = SHORT_FIRST_MESSAGE

> 
> Pedro> I wonder whether printing the module name first, maybe also a context
> Pedro> prefix, before the complaint message would make it a little bit nicer.
> Pedro> Something like:
> 
> Pedro> Reading symbols from ./gdb...
> Pedro> DWARF reader: /home/tromey/gdb/build/gdb/gdb: DW_AT_low_pc 0x0 is zero for DIE at 0x1717ad8
> Pedro> DWARF reader: /home/tromey/gdb/build/gdb/gdb: debug_line address at offset 0xa6284 is 0
> 
> I looked at this a bit.  There are two issues.
> 
> One is that the generic reader code (or whatever asks for psymtab
> expansion, etc) does not know the name of the symbol reader it is
> calling.  So, there's no convenient way to print "DWARF" there.

Not sure what you mean here.  I was just thinking of something like
simply making sure to include "DWARF reader:" in all complaint calls in
dwarf2read.c.  Similarly in the other files/modules/readers.
Or instead, throughout the dwarf2read.c file use a 

 static void dwarf_complaint (const char *fmt, ...);

wrapper function that would include the prefix.

I guess I just see complaint output similar to "set debug foo" output,
where I also wish we were more consistent in printing some leading
prefix for each debug knob, like, "set debug infrun 1" producing
output messages prefixed with "infrun:" or something like that.

> 
> Second, in some cases the relevant module name isn't what is generically
> available.  Consider read_comp_unit_head, which does:
> 
>   const char *filename = get_section_file_name (section);
> ...
> 	  complaint (_("debug type entry at offset %s is duplicate to"
> 		       " the entry at offset %s, signature %s"),
> 		     sect_offset_str (sect_off), sect_offset_str (dup_sect_off),
> 		     hex_string (header.signature));
> 
> Here, the file name might be the dwz file, or maybe some dwo file (I
> don't know), depending on where the section originated.

I'd think we could use those as module name.

> So, for the time being, I plan to just tidy up the output a bit without
> changing it too much.  

Yeah, just brainstorming.

> Maybe one idea would be to remove the
> SHORT_FIRST_MESSAGE case from complaints.c and just have every message
> start "During symbol reading".  This would at least be explicit.

Right.

> Good call:
> 
> 	  complaint (_("compilation unit with DW_AT_GNU_dwo_name"
> 		       " has children (offset %s) [in module %s]"),
> 		     sect_offset_str (this_cu->sect_off),
> 		     bfd_get_filename (abfd));
> 
> Though, it occurs to me that going through all of them to include this
> info would tend to work against the idea of some more generic fix.
I'm not sure I understand this last remark about a generic fix.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA 0/9] Radically simplify the complaint system
  2018-05-28 19:37         ` Pedro Alves
@ 2018-05-28 22:19           ` Tom Tromey
  2018-05-29 16:05             ` Pedro Alves
  0 siblings, 1 reply; 21+ messages in thread
From: Tom Tromey @ 2018-05-28 22:19 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

[ QUIT ]
Pedro> And then when that happens, 'complaints.c'::series is not
Pedro> restored back [because the clear_complaints call is skipped,
Pedro> because it is not exception safe], so all the following
Pedro> complaints are issued with SHORT_FIRST_MESSAGE:

Hah, oops.  I have a series now to remove SHORT_FIRST_MESSAGE.  It still
won't be perfect here -- there's no cleanup object still and so you
could in theory see too many complaints if you C-c at the wrong time.
I don't think that is super important though.

Pedro> I guess I just see complaint output similar to "set debug foo" output,
Pedro> where I also wish we were more consistent in printing some leading
Pedro> prefix for each debug knob, like, "set debug infrun 1" producing
Pedro> output messages prefixed with "infrun:" or something like that.

This makes sense to me too.  I was tempted to just remove it entirely,
but it is nice to be able to throttle the messages, since ordinarily
there are many of the same kind in a given objfile.

Pedro> Not sure what you mean here.  I was just thinking of something like
Pedro> simply making sure to include "DWARF reader:" in all complaint calls in
Pedro> dwarf2read.c.

Ok, I see.  I thought you meant something where symfile would tell the
complaints system about the module in question.

Tom

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFA 0/9] Radically simplify the complaint system
  2018-05-28 22:19           ` Tom Tromey
@ 2018-05-29 16:05             ` Pedro Alves
  0 siblings, 0 replies; 21+ messages in thread
From: Pedro Alves @ 2018-05-29 16:05 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 05/28/2018 11:06 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> [ QUIT ]
> Pedro> And then when that happens, 'complaints.c'::series is not
> Pedro> restored back [because the clear_complaints call is skipped,
> Pedro> because it is not exception safe], so all the following
> Pedro> complaints are issued with SHORT_FIRST_MESSAGE:
> 
> Hah, oops.  I have a series now to remove SHORT_FIRST_MESSAGE.  

Alright.

> It still
> won't be perfect here -- there's no cleanup object still and so you
> could in theory see too many complaints if you C-c at the wrong time.
> I don't think that is super important though.

Probably wouldn't be hard to fix I guess.

> I was tempted to just remove it entirely,
> but it is nice to be able to throttle the messages, since ordinarily
> there are many of the same kind in a given objfile.

Yeah, I don't think we want to lose that feature.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Possible regression on gdb.gdb/complaints.exp (was: Re: [RFA 0/9] Radically simplify the complaint system)
  2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
                   ` (9 preceding siblings ...)
  2018-05-23 14:49 ` [RFA 0/9] Radically simplify the complaint system Pedro Alves
@ 2018-06-04 20:25 ` Sergio Durigan Junior
  2018-06-04 21:38   ` Possible regression on gdb.gdb/complaints.exp Tom Tromey
  10 siblings, 1 reply; 21+ messages in thread
From: Sergio Durigan Junior @ 2018-06-04 20:25 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Tuesday, May 22 2018, Tom Tromey wrote:

> I must confess, I've long disliked the complaint system.  It got in
> the way a little bit, ages ago, when I tried to multi-thread the
> psymtab reader.  And, it got in the way a bit more during one of my
> attempts to format the "Reading symbols" output more nicely (spoiler:
> I have another approach to this in the works, but I took this detour
> first).  Aside from these things, the code also seemed unusually
> complex for the task it performed.
>
> This series radically simplifies the complaint system.  It removes
> most of the code -- which, I think, has never really been used.
>
> Tested by the buildbot.  I also locally tested complaints.exp with
> each patch in the series.

Hi Tom,

While preparing a Fedora GDB release for rawhide, I stumbled upon a
failure on gdb.gdb/complaints.exp.  Here's what I see here:

  (gdb) PASS: gdb.gdb/complaints.exp: run until breakpoint at captured_command_loop
  set stop_whining = 2
  (gdb) PASS: gdb.gdb/complaints.exp: set stop_whining = 2
  set var $cstr = "Register a complaint"
  (gdb) PASS: gdb.gdb/complaints.exp: set var $cstr = "Register a complaint"
  call complaint_internal ($cstr)
  free(): invalid pointer
  
  Thread 1 "xgdb" received signal SIGSEGV, Segmentation fault.
  0x00007ffff5c535ce in raise () from /lib64/libc.so.6
  The program being debugged was signaled while in a function called from GDB.
  GDB remains in the frame where the signal was received.
  To change this behavior use "set unwindonsignal on".
  Evaluation of the expression containing the function
  (complaint_internal(char const*, ...)) will be abandoned.
  When the function is done executing, GDB will silently stop.

While trying to reproduce it on my Fedora 27, I wasn't able to trigger
the failures.  Anyway, after a lot of time investigating this issue, I
found that you have to use a recent GCC (git HEAD as of 2018-06-04, for
example), and you have to compile GDB using -O2 -g.

I'm not sure if this is a regression introduced by your patch, so I also
ran a git-bisect on GCC and found the following possible culprit:

ea5d398198b93e37e9a343dfdb7660f71fdca404 is the first bad commit
commit ea5d398198b93e37e9a343dfdb7660f71fdca404
Author: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Oct 19 20:19:15 2017 +0000                                                         

Not sure if it makes sense...

Anyway, I'm reporting because I thought it was the right thing to do.
As per IRC discussions recently, I know gdb.gdb/ is fragile and one idea
(by Tom) is to replace it by selftests.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Possible regression on gdb.gdb/complaints.exp
  2018-06-04 20:25 ` Possible regression on gdb.gdb/complaints.exp (was: Re: [RFA 0/9] Radically simplify the complaint system) Sergio Durigan Junior
@ 2018-06-04 21:38   ` Tom Tromey
  2018-06-04 23:29     ` Sergio Durigan Junior
  0 siblings, 1 reply; 21+ messages in thread
From: Tom Tromey @ 2018-06-04 21:38 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: Tom Tromey, gdb-patches

>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio>   (gdb) PASS: gdb.gdb/complaints.exp: run until breakpoint at captured_command_loop
Sergio>   set stop_whining = 2
Sergio>   (gdb) PASS: gdb.gdb/complaints.exp: set stop_whining = 2
Sergio>   set var $cstr = "Register a complaint"
Sergio>   (gdb) PASS: gdb.gdb/complaints.exp: set var $cstr = "Register a complaint"
Sergio>   call complaint_internal ($cstr)
Sergio>   free(): invalid pointer

This seems fishy.  I wonder if debugging gdb running under valgrind
would show anything interesting.

Tom

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Possible regression on gdb.gdb/complaints.exp
  2018-06-04 21:38   ` Possible regression on gdb.gdb/complaints.exp Tom Tromey
@ 2018-06-04 23:29     ` Sergio Durigan Junior
  0 siblings, 0 replies; 21+ messages in thread
From: Sergio Durigan Junior @ 2018-06-04 23:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Monday, June 04 2018, Tom Tromey wrote:

>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
>
> Sergio>   (gdb) PASS: gdb.gdb/complaints.exp: run until breakpoint at captured_command_loop
> Sergio>   set stop_whining = 2
> Sergio>   (gdb) PASS: gdb.gdb/complaints.exp: set stop_whining = 2
> Sergio>   set var $cstr = "Register a complaint"
> Sergio>   (gdb) PASS: gdb.gdb/complaints.exp: set var $cstr = "Register a complaint"
> Sergio>   call complaint_internal ($cstr)
> Sergio>   free(): invalid pointer
>
> This seems fishy.  I wonder if debugging gdb running under valgrind
> would show anything interesting.

I did try that this weekend, but it hasn't gotten me very far.  What I
did was to start a valgrind gdbserver debugging ./gdb/gdb, and then
attach a GDB to it (also debugging ./gdb/gdb).  When the abort happens,
valgrind doesn't report something useful:

  ==6539== TO DEBUG THIS PROCESS USING GDB: start GDB like this                                  
  ==6539==   /path/to/gdb ./gdb/gdb              
  ==6539== and then give GDB the following command                                               
  ==6539==   target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=6539                       
  ==6539== --pid is optional if only one valgrind process is running                             
  ==6539==                                       
  ==6539== Jump to the invalid address stated on the next line                                   
  ==6539==    at 0x0: ???                        
  ==6539==  Address 0x0 is not stack'd, malloc'd or (recently) free'd                            

Strangely enough, I also tried doing some printf-debugging on
complaint_internal, but nothing is printed.

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-06-04 23:29 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
2018-05-22  5:07 ` [RFA 9/9] Remove struct complaints Tom Tromey
2018-05-22  5:07 ` [RFA 2/9] Remove elements from complaint_series Tom Tromey
2018-05-22  5:08 ` [RFA 6/9] Remove vcomplaint Tom Tromey
2018-05-22  5:08 ` [RFA 5/9] Remove struct explanation Tom Tromey
2018-05-22  5:09 ` [RFA 4/9] Remove symfile_complaints Tom Tromey
2018-05-22  5:09 ` [RFA 8/9] Remove struct complain Tom Tromey
2018-05-22  5:09 ` [RFA 1/9] Remove internal_complaint Tom Tromey
2018-05-22  5:50 ` [RFA 3/9] Remove "noisy" parameter from clear_complaints Tom Tromey
2018-05-22  7:01 ` [RFA 7/9] Remove file and line from struct complain Tom Tromey
2018-05-23 14:49 ` [RFA 0/9] Radically simplify the complaint system Pedro Alves
2018-05-23 15:08   ` Tom Tromey
2018-05-23 17:44     ` Pedro Alves
2018-05-28 10:41       ` Tom Tromey
2018-05-28 10:41         ` Tom Tromey
2018-05-28 19:37         ` Pedro Alves
2018-05-28 22:19           ` Tom Tromey
2018-05-29 16:05             ` Pedro Alves
2018-06-04 20:25 ` Possible regression on gdb.gdb/complaints.exp (was: Re: [RFA 0/9] Radically simplify the complaint system) Sergio Durigan Junior
2018-06-04 21:38   ` Possible regression on gdb.gdb/complaints.exp Tom Tromey
2018-06-04 23:29     ` Sergio Durigan Junior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).