* config/ho-irix.h: New file; if not gcc, define BROKEN_ASSERT.
[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
RP
52
53/* Nonzero if we should print the frame. */
54#define bpstat_should_print(bs) ((bs) != NULL && (bs)->print)
55
56/* Nonzero if we should stop. */
57#define bpstat_stop(bs) ((bs) != NULL && (bs)->stop)
58
30875e1c
SG
59/* Find the bpstat associated with a breakpoint. NULL otherwise. */
60bpstat bpstat_find_breakpoint(/* bpstat, breakpoint */);
61
bd5635a1
RP
62/* Nonzero if we hit a momentary breakpoint. */
63#define bpstat_momentary_breakpoint(bs) ((bs) != NULL && (bs)->momentary)
64
65/* Nonzero if a signal that we got in wait() was due to circumstances
66 explained by the BS. */
67/* Currently that is true iff we have hit a breakpoint. */
68#define bpstat_explains_signal(bs) ((bs) != NULL)
69
70/* Nonzero if we should step constantly (e.g. watchpoints on machines
71 without hardware support). This isn't related to a specific bpstat,
72 just to things like whether watchpoints are set. */
30875e1c 73extern int bpstat_should_step PARAMS ((void));
bd5635a1
RP
74
75/* Print a message indicating what happened. Returns nonzero to
76 say that only the source line should be printed after this (zero
77 return means print the frame as well as the source line). */
30875e1c 78extern int bpstat_print PARAMS ((bpstat));
bd5635a1
RP
79
80/* Return the breakpoint number of the first breakpoint we are stopped
81 at. *BSP upon return is a bpstat which points to the remaining
82 breakpoints stopped at (but which is not guaranteed to be good for
83 anything but further calls to bpstat_num).
84 Return 0 if passed a bpstat which does not indicate any breakpoints. */
30875e1c 85extern int bpstat_num PARAMS ((bpstat *));
bd5635a1
RP
86
87/* Perform actions associated with having stopped at *BSP. */
30875e1c 88extern void bpstat_do_actions PARAMS ((bpstat *));
bd5635a1
RP
89
90/* Modify BS so that the actions will not be performed. */
30875e1c 91extern void bpstat_clear_actions PARAMS ((bpstat));
bd5635a1
RP
92
93/* Implementation: */
0eaaa46a 94struct bpstat
bd5635a1
RP
95{
96 /* Linked list because there can be two breakpoints at the
97 same place, and a bpstat reflects the fact that both have been hit. */
98 bpstat next;
99 /* Breakpoint that we are at. */
100 struct breakpoint *breakpoint_at;
101 /* Commands left to be done. */
102 struct command_line *commands;
103 /* Old value associated with a watchpoint. */
104 value old_val;
105 /* Nonzero if we should print the frame. Only significant for the first
106 bpstat in the chain. */
107 char print;
108 /* Nonzero if we should stop. Only significant for the first bpstat in
109 the chain. */
110 char stop;
111 /* Nonzero if we hit a momentary breakpoint. Only significant for the
112 first bpstat in the chain. */
113 char momentary;
114};
30875e1c
SG
115\f
116/* Type of breakpoint. */
117/* FIXME In the future, we should fold all other breakpoint-like things into
118 here. This includes:
119
120 1) single-step (for machines where we have to simulate single stepping),
121 2) step-resume (for 'next'ing over subroutine calls),
122 3) call-dummy (the breakpoint at the end of a subroutine stub that gdb
123 uses to call functions in the target).
124*/
125
126enum bptype {
127 bp_breakpoint, /* Normal breakpoint */
128 bp_until, /* used by until command */
129 bp_finish, /* used by finish command */
130 bp_watchpoint, /* Watchpoint */
131 bp_longjmp, /* secret breakpoint to find longjmp() */
0eaaa46a 132 bp_longjmp_resume /* secret breakpoint to escape longjmp() */
30875e1c
SG
133};
134
135/* States of enablement of breakpoint. */
136
137enum enable { disabled, enabled};
138
139/* Disposition of breakpoint. Ie: what to do after hitting it. */
140
141enum bpdisp {
142 delete, /* Delete it */
143 disable, /* Disable it */
0eaaa46a 144 donttouch /* Leave it alone */
30875e1c
SG
145};
146
147/* Note that the ->silent field is not currently used by any commands
148 (though the code is in there if it was to be, and set_raw_breakpoint
149 does set it to 0). I implemented it because I thought it would be
150 useful for a hack I had to put in; I'm going to leave it in because
151 I can see how there might be times when it would indeed be useful */
152
153/* This is for a breakpoint or a watchpoint. */
154
155struct breakpoint
156{
157 struct breakpoint *next;
158 /* Type of breakpoint. */
159 enum bptype type;
160 /* Zero means disabled; remember the info but don't break here. */
161 enum enable enable;
162 /* What to do with this breakpoint after we hit it. */
163 enum bpdisp disposition;
164 /* Number assigned to distinguish breakpoints. */
165 int number;
166 /* Address to break at, or NULL if not a breakpoint. */
167 CORE_ADDR address;
168 /* Line number of this address. Redundant. Only matters if address
169 is non-NULL. */
170 int line_number;
171 /* Symtab of file of this address. Redundant. Only matters if address
172 is non-NULL. */
173 struct symtab *symtab;
174 /* Non-zero means a silent breakpoint (don't print frame info
175 if we stop here). */
176 unsigned char silent;
177 /* Number of stops at this breakpoint that should
178 be continued automatically before really stopping. */
179 int ignore_count;
180 /* "Real" contents of byte where breakpoint has been inserted.
181 Valid only when breakpoints are in the program. Under the complete
182 control of the target insert_breakpoint and remove_breakpoint routines.
183 No other code should assume anything about the value(s) here. */
184 char shadow_contents[BREAKPOINT_MAX];
185 /* Nonzero if this breakpoint is now inserted. Only matters if address
186 is non-NULL. */
187 char inserted;
188 /* Nonzero if this is not the first breakpoint in the list
189 for the given address. Only matters if address is non-NULL. */
190 char duplicate;
191 /* Chain of command lines to execute when this breakpoint is hit. */
192 struct command_line *commands;
193 /* Stack depth (address of frame). If nonzero, break only if fp
194 equals this. */
195 FRAME_ADDR frame;
196 /* Conditional. Break only if this expression's value is nonzero. */
197 struct expression *cond;
198
199 /* String we used to set the breakpoint (malloc'd). Only matters if
200 address is non-NULL. */
201 char *addr_string;
202 /* String form of the breakpoint condition (malloc'd), or NULL if there
203 is no condition. */
204 char *cond_string;
0eaaa46a
JK
205 /* String form of exp (malloc'd), or NULL if none. */
206 char *exp_string;
30875e1c
SG
207
208 /* The expression we are watching, or NULL if not a watchpoint. */
209 struct expression *exp;
210 /* The largest block within which it is valid, or NULL if it is
211 valid anywhere (e.g. consists just of global symbols). */
212 struct block *exp_valid_block;
213 /* Value of the watchpoint the last time we checked it. */
214 value val;
215};
0eaaa46a
JK
216\f
217/* Prototypes for breakpoint-related functions. */
218
219#ifdef __STDC__ /* Forward declarations for prototypes */
220struct frame_info;
221#endif
222
223extern int
224breakpoint_here_p PARAMS ((CORE_ADDR));
225
226extern void
227until_break_command PARAMS ((char *, int));
228
229extern void
230breakpoint_re_set PARAMS ((void));
231
232extern void
233clear_momentary_breakpoints PARAMS ((void));
234
235/* FIXME: Prototype uses equivalence of "struct frame_info *" and FRAME */
236extern struct breakpoint *
237set_momentary_breakpoint PARAMS ((struct symtab_and_line,
238 struct frame_info *,
239 enum bptype));
240
241extern void
242set_ignore_count PARAMS ((int, int, int));
243
244extern void
245set_default_breakpoint PARAMS ((int, CORE_ADDR, struct symtab *, int));
246
247extern void
248mark_breakpoints_out PARAMS ((void));
249
250extern void
251delete_breakpoint PARAMS ((struct breakpoint *));
252
253extern void
254breakpoint_auto_delete PARAMS ((bpstat));
255
256extern void
257breakpoint_clear_ignore_counts PARAMS ((void));
258
259extern void
260break_command PARAMS ((char *, int));
261
262extern int
263insert_breakpoints PARAMS ((void));
264
265extern int
266remove_breakpoints PARAMS ((void));
267
268extern void
269enable_longjmp_breakpoint PARAMS ((void));
270
271extern void
272disable_longjmp_breakpoint PARAMS ((void));
273
274extern void
275set_longjmp_resume_breakpoint PARAMS ((CORE_ADDR, FRAME));
276
277/* The following are for displays, which aren't really breakpoints, but
278 here is as good a place as any for them. */
279
280extern void
281disable_current_display PARAMS ((void));
282
283extern void
284do_displays PARAMS ((void));
285
286extern void
287disable_display PARAMS ((int));
288
289extern void
290clear_displays PARAMS ((void));
30875e1c
SG
291
292#endif /* !defined (BREAKPOINT_H) */
This page took 0.108459 seconds and 4 git commands to generate.