1 /* Support for complaint handling during symbol reading in GDB.
2 Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 #include "complaints.h"
25 extern void _initialize_complaints (void);
27 /* Structure to manage complaints about symbol file contents. */
29 struct complaint complaint_root
[1] =
32 (char *) NULL
, /* Complaint message */
33 0, /* Complaint counter */
34 complaint_root
/* Next complaint. */
38 /* How many complaints about a particular thing should be printed before
39 we stop whining about it? Default is no whining at all, since so many
40 systems have ill-constructed symbol files. */
42 static unsigned int stop_whining
= 0;
44 /* Should each complaint be self explanatory, or should we assume that
45 a series of complaints is being produced?
46 case 0: self explanatory message.
47 case 1: First message of a series that must start off with explanation.
48 case 2: Subsequent message, when user already knows we are reading
49 symbols and we can just state our piece. */
51 static int complaint_series
= 0;
53 /* External variables and functions referenced. */
55 extern int info_verbose
;
58 /* Functions to handle complaints during symbol reading. */
60 /* Print a complaint about the input symbols, and link the complaint block
61 into a chain for later handling. */
64 complain (struct complaint
*complaint
,...)
67 va_start (args
, complaint
);
70 if (complaint
->next
== NULL
)
72 complaint
->next
= complaint_root
->next
;
73 complaint_root
->next
= complaint
;
75 if (complaint
->counter
> stop_whining
)
81 switch (complaint_series
+ (info_verbose
<< 1))
84 /* Isolated messages, must be self-explanatory. */
87 fputs_filtered ("During symbol reading, ", gdb_stderr
);
89 vfprintf_filtered (gdb_stderr
, complaint
->message
, args
);
90 fputs_filtered (".\n", gdb_stderr
);
93 /* First of a series, without `set verbose'. */
96 fputs_filtered ("During symbol reading...", gdb_stderr
);
97 vfprintf_filtered (gdb_stderr
, complaint
->message
, args
);
98 fputs_filtered ("...", gdb_stderr
);
103 /* Subsequent messages of a series, or messages under `set verbose'.
104 (We'll already have produced a "Reading in symbols for XXX..."
105 message and will clean up at the end with a newline.) */
107 vfprintf_filtered (gdb_stderr
, complaint
->message
, args
);
108 fputs_filtered ("...", gdb_stderr
);
111 /* If GDB dumps core, we'd like to see the complaints first. Presumably
112 GDB will not be sending so many complaints that this becomes a
114 gdb_flush (gdb_stderr
);
118 /* Clear out all complaint counters that have ever been incremented.
119 If sym_reading is 1, be less verbose about successive complaints,
120 since the messages are appearing all together during a command that
121 reads symbols (rather than scattered around as psymtabs get fleshed
122 out into symtabs at random times). If noisy is 1, we are in a
123 noisy symbol reading command, and our caller will print enough
124 context for the user to figure it out. */
127 clear_complaints (int sym_reading
, int noisy
)
131 for (p
= complaint_root
->next
; p
!= complaint_root
; p
= p
->next
)
136 if (!sym_reading
&& !noisy
&& complaint_series
> 1)
138 /* Terminate previous series, since caller won't. */
139 puts_filtered ("\n");
142 complaint_series
= sym_reading
? 1 + noisy
: 0;
146 _initialize_complaints (void)
149 (add_set_cmd ("complaints", class_support
, var_zinteger
,
150 (char *) &stop_whining
,
151 "Set max number of complaints about incorrect symbols.",
This page took 0.043033 seconds and 4 git commands to generate.