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