Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Definitions for complaint handling during symbol reading in GDB. |
b9caf505 AC |
2 | |
3 | Copyright 1990, 1991, 1992, 1995, 1998, 2000, 2002 Free Software | |
4 | Foundation, Inc. | |
c906108c | 5 | |
c5aa993b | 6 | This file is part of GDB. |
c906108c | 7 | |
c5aa993b JM |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
c906108c | 12 | |
c5aa993b JM |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
c906108c | 17 | |
c5aa993b JM |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, | |
21 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
22 | |
23 | ||
24 | #if !defined (COMPLAINTS_H) | |
25 | #define COMPLAINTS_H | |
26 | ||
b9caf505 AC |
27 | /* Opaque object used to track the number of complaints of a |
28 | particular category. */ | |
29 | struct complaints; | |
30 | ||
31 | /* Predefined categories. */ | |
32 | extern struct complaints *symfile_complaints; | |
33 | ||
34 | /* Register a complaint. */ | |
35 | extern void complaint (struct complaints **complaints, const char *fmt, | |
36 | ...) ATTR_FORMAT (printf, 2, 3); | |
37 | extern void internal_complaint (struct complaints **complaints, | |
38 | const char *file, int line, const char *fmt, | |
39 | ...) ATTR_FORMAT (printf, 4, 5); | |
40 | ||
41 | /* Clear out / initialize all complaint counters that have ever been | |
42 | incremented. If LESS_VERBOSE is 1, be less verbose about | |
43 | successive complaints, since the messages are appearing all | |
44 | together during a command that is reporting a contiguous block of | |
45 | complaints (rather than being interleaved with other messages). If | |
46 | noisy is 1, we are in a noisy command, and our caller will print | |
47 | enough context for the user to figure it out. */ | |
48 | ||
49 | extern void clear_complaints (struct complaints **complaints, | |
50 | int less_verbose, int noisy); | |
51 | ||
c906108c | 52 | |
72367fb4 AC |
53 | /* Deprecated interfaces to keep the old code working (until it is all |
54 | converted to the above). Existing code such as: | |
55 | ||
d741b867 AC |
56 | struct deprecated_complaint msg = { "msg 0x%08x[sic]", 0, 0 }; |
57 | deprecated_complain (&msg, addr); | |
72367fb4 | 58 | |
d741b867 | 59 | should be replaced by either the new call (for the singular case): |
72367fb4 | 60 | |
d741b867 AC |
61 | complaint (&symtab_complaints, "msg 0x%s", paddr (addr)); |
62 | ||
63 | or with a wrapper function (for the many-of case): | |
64 | ||
65 | msg_complaint (CORE_ADDR addr) | |
66 | { complaint (&symtab_complaints, "msg 0x%s", paddr (addr)); } | |
67 | ... | |
68 | msg_complaint (addr); | |
69 | ||
70 | Yes, the typo is intentional. The motivation behind this interface | |
71 | change is to eliminate all possability of this problem re-occuring | |
72 | (it has occured in the past and no one is sure that it isn't | |
73 | present now). | |
b9caf505 AC |
74 | |
75 | Support for complaining about things in the symbol file that aren't | |
c906108c SS |
76 | catastrophic. |
77 | ||
78 | Each such thing gets a counter. The first time we have the problem, | |
79 | during a symbol read, we report it. At the end of symbol reading, | |
80 | if verbose, we report how many of each problem we had. */ | |
81 | ||
72367fb4 | 82 | struct deprecated_complaint |
b9caf505 AC |
83 | { |
84 | const char *message; | |
85 | unsigned counter_ignored; | |
72367fb4 | 86 | struct deprecated_complaint *next_ignored; |
b9caf505 | 87 | }; |
c906108c | 88 | |
72367fb4 | 89 | extern void complain (struct deprecated_complaint *, ...); |
c906108c | 90 | |
c5aa993b | 91 | #endif /* !defined (COMPLAINTS_H) */ |