Conditional Z1 breakpoint hangs GDBserver.
[external/binutils.git] / gdb / gdbserver / mem-break.h
1 /* Memory breakpoint interfaces for the remote server for GDB.
2    Copyright (C) 2002-2014 Free Software Foundation, Inc.
3
4    Contributed by MontaVista Software.
5
6    This file is part of GDB.
7
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 3 of the License, or
11    (at your option) any later version.
12
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.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
21 #ifndef MEM_BREAK_H
22 #define MEM_BREAK_H
23
24 /* Breakpoints are opaque.  */
25 struct breakpoint;
26 struct fast_tracepoint_jump;
27
28 /* Locate a breakpoint placed at address WHERE and return a pointer
29    to its structure.  */
30
31 struct breakpoint *find_gdb_breakpoint_at (CORE_ADDR where);
32
33 /* Create a new GDB breakpoint at WHERE.  Returns -1 if breakpoints
34    are not supported on this target, 0 otherwise.  */
35
36 int set_gdb_breakpoint_at (CORE_ADDR where);
37
38 /* Returns TRUE if there's any breakpoint at ADDR in our tables,
39    inserted, or not.  */
40
41 int breakpoint_here (CORE_ADDR addr);
42
43 /* Returns TRUE if there's any inserted breakpoint set at ADDR.  */
44
45 int breakpoint_inserted_here (CORE_ADDR addr);
46
47 /* Clear all breakpoint conditions associated with this address.  */
48
49 void clear_gdb_breakpoint_conditions (CORE_ADDR addr);
50
51 /* Set target-side condition CONDITION to the breakpoint at ADDR.
52    Returns false on failure.  On success, advances CONDITION pointer
53    past the condition and returns true.  */
54
55 int add_breakpoint_condition (CORE_ADDR addr, char **condition);
56
57 /* Set target-side commands COMMANDS to the breakpoint at ADDR.
58    Returns false on failure.  On success, advances COMMANDS past the
59    commands and returns true.  If PERSIST, the commands should run
60    even while GDB is disconnected.  */
61
62 int add_breakpoint_commands (CORE_ADDR addr, char **commands, int persist);
63
64 int any_persistent_commands (void);
65
66 /* Evaluation condition (if any) at breakpoint BP.  Return 1 if
67    true and 0 otherwise.  */
68
69 int gdb_condition_true_at_breakpoint (CORE_ADDR where);
70
71 int gdb_no_commands_at_breakpoint (CORE_ADDR where);
72
73 void run_breakpoint_commands (CORE_ADDR where);
74
75 /* Returns TRUE if there's a GDB breakpoint set at ADDR.  */
76
77 int gdb_breakpoint_here (CORE_ADDR where);
78
79 /* Create a new breakpoint at WHERE, and call HANDLER when
80    it is hit.  HANDLER should return 1 if the breakpoint
81    should be deleted, 0 otherwise.  */
82
83 struct breakpoint *set_breakpoint_at (CORE_ADDR where,
84                                       int (*handler) (CORE_ADDR));
85
86 /* Delete a GDB breakpoint previously inserted at ADDR with
87    set_gdb_breakpoint_at.  */
88
89 int delete_gdb_breakpoint_at (CORE_ADDR addr);
90
91 /* Delete a breakpoint.  */
92
93 int delete_breakpoint (struct breakpoint *bkpt);
94
95 /* Set a reinsert breakpoint at STOP_AT.  */
96
97 void set_reinsert_breakpoint (CORE_ADDR stop_at);
98
99 /* Delete all reinsert breakpoints.  */
100
101 void delete_reinsert_breakpoints (void);
102
103 /* Reinsert breakpoints at WHERE (and change their status to
104    inserted).  */
105
106 void reinsert_breakpoints_at (CORE_ADDR where);
107
108 /* Uninsert breakpoints at WHERE (and change their status to
109    uninserted).  This still leaves the breakpoints in the table.  */
110
111 void uninsert_breakpoints_at (CORE_ADDR where);
112
113 /* Reinsert all breakpoints of the current process (and change their
114    status to inserted).  */
115
116 void reinsert_all_breakpoints (void);
117
118 /* Uninsert all breakpoints of the current process (and change their
119    status to uninserted).  This still leaves the breakpoints in the
120    table.  */
121
122 void uninsert_all_breakpoints (void);
123
124 /* See if any breakpoint claims ownership of STOP_PC.  Call the handler for
125    the breakpoint, if found.  */
126
127 void check_breakpoints (CORE_ADDR stop_pc);
128
129 /* See if any breakpoints shadow the target memory area from MEM_ADDR
130    to MEM_ADDR + MEM_LEN.  Update the data already read from the target
131    (in BUF) if necessary.  */
132
133 void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
134
135 /* See if any breakpoints shadow the target memory area from MEM_ADDR
136    to MEM_ADDR + MEM_LEN.  Update the data to be written to the target
137    (in BUF, a copy of MYADDR on entry) if necessary, as well as the
138    original data for any breakpoints.  */
139
140 void check_mem_write (CORE_ADDR mem_addr,
141                       unsigned char *buf, const unsigned char *myaddr, int mem_len);
142
143 /* Set the byte pattern to insert for memory breakpoints.  This function
144    must be called before any breakpoints are set.  */
145
146 void set_breakpoint_data (const unsigned char *bp_data, int bp_len);
147
148 /* Delete all breakpoints.  */
149
150 void delete_all_breakpoints (void);
151
152 /* Clear the "inserted" flag in all breakpoints of PROC.  */
153
154 void mark_breakpoints_out (struct process_info *proc);
155
156 /* Delete all breakpoints, but do not try to un-insert them from the
157    inferior.  */
158
159 void free_all_breakpoints (struct process_info *proc);
160
161 /* Check if breakpoints still seem to be inserted in the inferior.  */
162
163 void validate_breakpoints (void);
164
165 /* Insert a fast tracepoint jump at WHERE, using instruction INSN, of
166    LENGTH bytes.  */
167
168 struct fast_tracepoint_jump *set_fast_tracepoint_jump (CORE_ADDR where,
169                                                        unsigned char *insn,
170                                                        ULONGEST length);
171
172 /* Increment reference counter of JP.  */
173 void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp);
174
175 /* Delete fast tracepoint jump TODEL from our tables, and uninsert if
176    from memory.  */
177
178 int delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel);
179
180 /* Returns true if there's fast tracepoint jump set at WHERE.  */
181
182 int fast_tracepoint_jump_here (CORE_ADDR);
183
184 /* Uninsert fast tracepoint jumps at WHERE (and change their status to
185    uninserted).  This still leaves the tracepoints in the table.  */
186
187 void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc);
188
189 /* Reinsert fast tracepoint jumps at WHERE (and change their status to
190    inserted).  */
191
192 void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where);
193
194 #endif /* MEM_BREAK_H */