Initial revision
[platform/upstream/binutils.git] / gdb / breakpoint.h
1 /* Copyright (C) 1990 Free Software Foundation, Inc.
2
3 This file is part of GDB.
4
5 GDB is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 1, or (at your option)
8 any later version.
9
10 GDB is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GDB; see the file COPYING.  If not, write to
17 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
18
19 #if !defined (BREAKPOINT_H)
20 #define BREAKPOINT_H 1
21
22 /* This is the maximum number of bytes a breakpoint instruction can take.
23    Feel free to increase it.  It's just used in a few places to size
24    arrays that should be independent of the target architecture.  */
25
26 #define BREAKPOINT_MAX  10
27
28 extern void breakpoint_re_set ();
29 extern void clear_momentary_breakpoints ();
30 extern void set_momentary_breakpoint ();
31 extern void set_ignore_count ();
32 extern void set_default_breakpoint ();
33
34 extern void mark_breakpoints_out ();
35 extern void breakpoint_auto_delete ();
36 extern void breakpoint_clear_ignore_counts ();
37
38 /* The following are for displays, which aren't really breakpoints, but
39    here is as good a place as any for them.  */
40
41 extern void disable_current_display ();
42 extern void do_displays ();
43 extern void disable_display ();
44 extern void clear_displays ();
45
46 \f
47 /* The follow stuff is an abstract data type "bpstat" ("breakpoint status").
48    This provides the ability to determine whether we have stopped at a
49    breakpoint, and what we should do about it.  */
50
51 typedef struct bpstat__struct *bpstat;
52
53 /* Interface:  */
54
55 /* Clear a bpstat so that it says we are not at any breakpoint.
56    Also free any storage that is part of a bpstat.  */
57 void bpstat_clear();
58
59 /* Return a copy of a bpstat.  Like "bs1 = bs2" but all storage that
60    is part of the bpstat is copied as well.  */
61 bpstat bpstat_copy();
62
63 /* Get a bpstat associated with having just stopped at address *PC
64    and frame address FRAME_ADDRESS.  Update *PC to point at the
65    breakpoint (if we hit a breakpoint).  */
66 bpstat bpstat_stop_status (/* CORE_ADDR *pc; FRAME_ADDR frame_address */);
67
68 /* Nonzero if we should print the frame.  */
69 #define bpstat_should_print(bs) ((bs) != NULL && (bs)->print)
70
71 /* Nonzero if we should stop.  */
72 #define bpstat_stop(bs) ((bs) != NULL && (bs)->stop)
73
74 /* Nonzero if we hit a momentary breakpoint.  */
75 #define bpstat_momentary_breakpoint(bs) ((bs) != NULL && (bs)->momentary)
76
77 /* Nonzero if a signal that we got in wait() was due to circumstances
78    explained by the BS.  */
79 /* Currently that is true iff we have hit a breakpoint.  */
80 #define bpstat_explains_signal(bs) ((bs) != NULL)
81
82 /* Nonzero if we should step constantly (e.g. watchpoints on machines
83    without hardware support).  This isn't related to a specific bpstat,
84    just to things like whether watchpoints are set.  */
85 int bpstat_should_step (/* void */);
86
87 /* Print a message indicating what happened.  Returns nonzero to
88    say that only the source line should be printed after this (zero
89    return means print the frame as well as the source line).  */
90 int bpstat_print (/* bpstat bs */);
91
92 /* Return the breakpoint number of the first breakpoint we are stopped
93    at.  *BSP upon return is a bpstat which points to the remaining
94    breakpoints stopped at (but which is not guaranteed to be good for
95    anything but further calls to bpstat_num).
96    Return 0 if passed a bpstat which does not indicate any breakpoints.  */
97 int bpstat_num (/* bpstat *bsp; */);
98
99 /* Perform actions associated with having stopped at *BSP.  */
100 void bpstat_do_actions (/* bpstat bs; */);
101
102 /* Modify BS so that the actions will not be performed.  */
103 void bpstat_clear_actions (/* bpstat bs; */);
104
105
106 /* Implementation:  */
107 #include "value.h"
108 struct bpstat__struct
109 {
110   /* Linked list because there can be two breakpoints at the
111      same place, and a bpstat reflects the fact that both have been hit.  */
112   bpstat next;
113   /* Breakpoint that we are at.  */
114   struct breakpoint *breakpoint_at;
115   /* Commands left to be done.  */
116   struct command_line *commands;
117   /* Old value associated with a watchpoint.  */
118   value old_val;
119   /* Nonzero if we should print the frame.  Only significant for the first
120      bpstat in the chain.  */
121   char print;
122   /* Nonzero if we should stop.  Only significant for the first bpstat in
123      the chain.  */
124   char stop;
125   /* Nonzero if we hit a momentary breakpoint.  Only significant for the
126      first bpstat in the chain.  */
127   char momentary;
128 };
129 #endif /* breakpoint.h not already included.  */