* stabs.texinfo: Express disapproval of 'D' symbol descriptor
[deliverable/binutils-gdb.git] / gdb / breakpoint.h
CommitLineData
0eaaa46a
JK
1/* Data structures associated with breakpoints in GDB.
2 Copyright (C) 1992 Free Software Foundation, Inc.
bd5635a1
RP
3
4This file is part of GDB.
5
30875e1c 6This program is free software; you can redistribute it and/or modify
bd5635a1 7it under the terms of the GNU General Public License as published by
30875e1c
SG
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
bd5635a1 10
30875e1c 11This program is distributed in the hope that it will be useful,
bd5635a1
RP
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
30875e1c
SG
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
bd5635a1
RP
19
20#if !defined (BREAKPOINT_H)
21#define BREAKPOINT_H 1
22
30875e1c
SG
23#include "frame.h"
24#include "value.h"
25
bd5635a1
RP
26/* This is the maximum number of bytes a breakpoint instruction can take.
27 Feel free to increase it. It's just used in a few places to size
28 arrays that should be independent of the target architecture. */
29
0eaaa46a 30#define BREAKPOINT_MAX 16
bd5635a1
RP
31\f
32/* The follow stuff is an abstract data type "bpstat" ("breakpoint status").
33 This provides the ability to determine whether we have stopped at a
34 breakpoint, and what we should do about it. */
35
0eaaa46a
JK
36typedef struct bpstat *bpstat;
37
bd5635a1 38/* Interface: */
bd5635a1
RP
39/* Clear a bpstat so that it says we are not at any breakpoint.
40 Also free any storage that is part of a bpstat. */
30875e1c 41extern void bpstat_clear PARAMS ((bpstat *));
bd5635a1
RP
42
43/* Return a copy of a bpstat. Like "bs1 = bs2" but all storage that
44 is part of the bpstat is copied as well. */
30875e1c 45extern bpstat bpstat_copy PARAMS ((bpstat));
bd5635a1
RP
46
47/* Get a bpstat associated with having just stopped at address *PC
48 and frame address FRAME_ADDRESS. Update *PC to point at the
49 breakpoint (if we hit a breakpoint). */
30875e1c
SG
50/* FIXME: prototypes uses equivalence between FRAME_ADDR and CORE_ADDR */
51extern bpstat bpstat_stop_status PARAMS ((CORE_ADDR *, CORE_ADDR));
bd5635a1 52
cabd4da6
JK
53/* Return values from bpstat_what. */
54enum bpstat_what {
55 /* Perform various other tests; that is, this bpstat does not
56 say to perform any action (e.g. failed watchpoint and nothing
57 else). */
58 BPSTAT_WHAT_KEEP_CHECKING,
59
60 /* Rather than distinguish between noisy and silent stops here, it
61 might be cleaner to have bpstat_print make that decision (also
62 taking into account stop_print_frame and source_only). But the
63 implications are a bit scary (interaction with auto-displays, etc.),
64 so I won't try it. */
65
66 /* Stop silently. */
67 BPSTAT_WHAT_STOP_SILENT,
68
69 /* Stop and print. */
70 BPSTAT_WHAT_STOP_NOISY,
71
72 /* Remove breakpoints, single step once, then put them back in and
73 go back to what we were doing. */
74 BPSTAT_WHAT_SINGLE,
75
76 /* Set longjmp_resume breakpoint, remove all other breakpoints,
77 and continue. The "remove all other breakpoints" part is required
78 if we are also stepping over another breakpoint as well as doing
79 the longjmp handling. */
80 BPSTAT_WHAT_SET_LONGJMP_RESUME,
81
82 /* Clear longjmp_resume breakpoint, then handle as
83 BPSTAT_WHAT_KEEP_CHECKING. */
84 BPSTAT_WHAT_CLEAR_LONGJMP_RESUME,
85
86 /* Clear longjmp_resume breakpoint, then handle as BPSTAT_WHAT_SINGLE. */
87 BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE,
88
89 /* This is just used to keep track of how many enums there are. */
90 BPSTAT_WHAT_LAST
91};
bd5635a1 92
cabd4da6
JK
93/* Tell what to do about this bpstat. */
94enum bpstat_what bpstat_what PARAMS ((bpstat));
bd5635a1 95
30875e1c 96/* Find the bpstat associated with a breakpoint. NULL otherwise. */
cabd4da6 97bpstat bpstat_find_breakpoint PARAMS ((bpstat, struct breakpoint *));
bd5635a1
RP
98
99/* Nonzero if a signal that we got in wait() was due to circumstances
100 explained by the BS. */
cabd4da6
JK
101/* Currently that is true if we have hit a breakpoint, or if there is
102 a watchpoint enabled. */
bd5635a1
RP
103#define bpstat_explains_signal(bs) ((bs) != NULL)
104
105/* Nonzero if we should step constantly (e.g. watchpoints on machines
106 without hardware support). This isn't related to a specific bpstat,
107 just to things like whether watchpoints are set. */
30875e1c 108extern int bpstat_should_step PARAMS ((void));
bd5635a1
RP
109
110/* Print a message indicating what happened. Returns nonzero to
111 say that only the source line should be printed after this (zero
112 return means print the frame as well as the source line). */
30875e1c 113extern int bpstat_print PARAMS ((bpstat));
bd5635a1
RP
114
115/* Return the breakpoint number of the first breakpoint we are stopped
116 at. *BSP upon return is a bpstat which points to the remaining
117 breakpoints stopped at (but which is not guaranteed to be good for
118 anything but further calls to bpstat_num).
119 Return 0 if passed a bpstat which does not indicate any breakpoints. */
30875e1c 120extern int bpstat_num PARAMS ((bpstat *));
bd5635a1
RP
121
122/* Perform actions associated with having stopped at *BSP. */
30875e1c 123extern void bpstat_do_actions PARAMS ((bpstat *));
bd5635a1
RP
124
125/* Modify BS so that the actions will not be performed. */
30875e1c 126extern void bpstat_clear_actions PARAMS ((bpstat));
bd5635a1
RP
127
128/* Implementation: */
0eaaa46a 129struct bpstat
bd5635a1
RP
130{
131 /* Linked list because there can be two breakpoints at the
132 same place, and a bpstat reflects the fact that both have been hit. */
133 bpstat next;
134 /* Breakpoint that we are at. */
135 struct breakpoint *breakpoint_at;
136 /* Commands left to be done. */
137 struct command_line *commands;
138 /* Old value associated with a watchpoint. */
139 value old_val;
cabd4da6
JK
140
141 /* Nonzero if this breakpoint tells us to print the frame. */
bd5635a1 142 char print;
cabd4da6
JK
143
144 /* Nonzero if this breakpoint tells us to stop. */
bd5635a1 145 char stop;
cabd4da6
JK
146
147 /* Function called by bpstat_print to print stuff associated with
148 this element of the bpstat chain. Returns 0 or 1 just like
149 bpstat_print, or -1 if it can't deal with it. */
150 int (*print_it) PARAMS((bpstat bs));
bd5635a1 151};
30875e1c
SG
152\f
153/* Type of breakpoint. */
154/* FIXME In the future, we should fold all other breakpoint-like things into
155 here. This includes:
156
157 1) single-step (for machines where we have to simulate single stepping),
158 2) step-resume (for 'next'ing over subroutine calls),
159 3) call-dummy (the breakpoint at the end of a subroutine stub that gdb
160 uses to call functions in the target).
cabd4da6
JK
161
162 I definately agree with (2) and (3); I'm not as sure about (1)
163 (it is a low-level thing, perhaps the best thing is that it looks
164 as much as possible like a single-step to wait_for_inferior)
165 -kingdon, 8 Apr 93.
30875e1c
SG
166*/
167
168enum bptype {
169 bp_breakpoint, /* Normal breakpoint */
170 bp_until, /* used by until command */
171 bp_finish, /* used by finish command */
172 bp_watchpoint, /* Watchpoint */
173 bp_longjmp, /* secret breakpoint to find longjmp() */
0eaaa46a 174 bp_longjmp_resume /* secret breakpoint to escape longjmp() */
30875e1c
SG
175};
176
177/* States of enablement of breakpoint. */
178
179enum enable { disabled, enabled};
180
181/* Disposition of breakpoint. Ie: what to do after hitting it. */
182
183enum bpdisp {
184 delete, /* Delete it */
185 disable, /* Disable it */
0eaaa46a 186 donttouch /* Leave it alone */
30875e1c
SG
187};
188
189/* Note that the ->silent field is not currently used by any commands
190 (though the code is in there if it was to be, and set_raw_breakpoint
191 does set it to 0). I implemented it because I thought it would be
192 useful for a hack I had to put in; I'm going to leave it in because
193 I can see how there might be times when it would indeed be useful */
194
195/* This is for a breakpoint or a watchpoint. */
196
197struct breakpoint
198{
199 struct breakpoint *next;
200 /* Type of breakpoint. */
201 enum bptype type;
202 /* Zero means disabled; remember the info but don't break here. */
203 enum enable enable;
204 /* What to do with this breakpoint after we hit it. */
205 enum bpdisp disposition;
206 /* Number assigned to distinguish breakpoints. */
207 int number;
208 /* Address to break at, or NULL if not a breakpoint. */
209 CORE_ADDR address;
210 /* Line number of this address. Redundant. Only matters if address
211 is non-NULL. */
212 int line_number;
213 /* Symtab of file of this address. Redundant. Only matters if address
214 is non-NULL. */
215 struct symtab *symtab;
216 /* Non-zero means a silent breakpoint (don't print frame info
217 if we stop here). */
218 unsigned char silent;
219 /* Number of stops at this breakpoint that should
220 be continued automatically before really stopping. */
221 int ignore_count;
222 /* "Real" contents of byte where breakpoint has been inserted.
223 Valid only when breakpoints are in the program. Under the complete
224 control of the target insert_breakpoint and remove_breakpoint routines.
225 No other code should assume anything about the value(s) here. */
226 char shadow_contents[BREAKPOINT_MAX];
227 /* Nonzero if this breakpoint is now inserted. Only matters if address
228 is non-NULL. */
229 char inserted;
230 /* Nonzero if this is not the first breakpoint in the list
231 for the given address. Only matters if address is non-NULL. */
232 char duplicate;
233 /* Chain of command lines to execute when this breakpoint is hit. */
234 struct command_line *commands;
235 /* Stack depth (address of frame). If nonzero, break only if fp
236 equals this. */
237 FRAME_ADDR frame;
238 /* Conditional. Break only if this expression's value is nonzero. */
239 struct expression *cond;
240
241 /* String we used to set the breakpoint (malloc'd). Only matters if
242 address is non-NULL. */
243 char *addr_string;
244 /* String form of the breakpoint condition (malloc'd), or NULL if there
245 is no condition. */
246 char *cond_string;
0eaaa46a
JK
247 /* String form of exp (malloc'd), or NULL if none. */
248 char *exp_string;
30875e1c
SG
249
250 /* The expression we are watching, or NULL if not a watchpoint. */
251 struct expression *exp;
252 /* The largest block within which it is valid, or NULL if it is
253 valid anywhere (e.g. consists just of global symbols). */
254 struct block *exp_valid_block;
255 /* Value of the watchpoint the last time we checked it. */
256 value val;
257};
0eaaa46a
JK
258\f
259/* Prototypes for breakpoint-related functions. */
260
261#ifdef __STDC__ /* Forward declarations for prototypes */
262struct frame_info;
263#endif
264
265extern int
266breakpoint_here_p PARAMS ((CORE_ADDR));
267
268extern void
269until_break_command PARAMS ((char *, int));
270
271extern void
272breakpoint_re_set PARAMS ((void));
273
274extern void
275clear_momentary_breakpoints PARAMS ((void));
276
277/* FIXME: Prototype uses equivalence of "struct frame_info *" and FRAME */
278extern struct breakpoint *
279set_momentary_breakpoint PARAMS ((struct symtab_and_line,
280 struct frame_info *,
281 enum bptype));
282
283extern void
284set_ignore_count PARAMS ((int, int, int));
285
286extern void
287set_default_breakpoint PARAMS ((int, CORE_ADDR, struct symtab *, int));
288
289extern void
290mark_breakpoints_out PARAMS ((void));
291
292extern void
293delete_breakpoint PARAMS ((struct breakpoint *));
294
295extern void
296breakpoint_auto_delete PARAMS ((bpstat));
297
298extern void
299breakpoint_clear_ignore_counts PARAMS ((void));
300
301extern void
302break_command PARAMS ((char *, int));
303
304extern int
305insert_breakpoints PARAMS ((void));
306
307extern int
308remove_breakpoints PARAMS ((void));
309
310extern void
311enable_longjmp_breakpoint PARAMS ((void));
312
313extern void
314disable_longjmp_breakpoint PARAMS ((void));
315
316extern void
317set_longjmp_resume_breakpoint PARAMS ((CORE_ADDR, FRAME));
318
319/* The following are for displays, which aren't really breakpoints, but
320 here is as good a place as any for them. */
321
322extern void
323disable_current_display PARAMS ((void));
324
325extern void
326do_displays PARAMS ((void));
327
328extern void
329disable_display PARAMS ((int));
330
331extern void
332clear_displays PARAMS ((void));
30875e1c
SG
333
334#endif /* !defined (BREAKPOINT_H) */
This page took 0.10691 seconds and 4 git commands to generate.