Make reinsert_breakpoint thread specific
[deliverable/binutils-gdb.git] / gdb / gdbserver / mem-break.h
CommitLineData
611cb4a5 1/* Memory breakpoint interfaces for the remote server for GDB.
618f726f 2 Copyright (C) 2002-2016 Free Software Foundation, Inc.
611cb4a5
DJ
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
a9762ec7 10 the Free Software Foundation; either version 3 of the License, or
611cb4a5
DJ
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
a9762ec7 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
611cb4a5
DJ
20
21#ifndef MEM_BREAK_H
22#define MEM_BREAK_H
23
932539e3
PA
24#include "break-common.h"
25
611cb4a5 26/* Breakpoints are opaque. */
414a389f 27struct breakpoint;
9aa76cd0 28struct gdb_breakpoint;
fa593d66 29struct fast_tracepoint_jump;
802e8e6d
PA
30struct raw_breakpoint;
31struct process_info;
611cb4a5 32
932539e3
PA
33#define Z_PACKET_SW_BP '0'
34#define Z_PACKET_HW_BP '1'
35#define Z_PACKET_WRITE_WP '2'
36#define Z_PACKET_READ_WP '3'
37#define Z_PACKET_ACCESS_WP '4'
38
802e8e6d 39/* The low level breakpoint types. */
932539e3 40
802e8e6d
PA
41enum raw_bkpt_type
42 {
43 /* Software/memory breakpoint. */
44 raw_bkpt_type_sw,
932539e3 45
802e8e6d
PA
46 /* Hardware-assisted breakpoint. */
47 raw_bkpt_type_hw,
d50171e4 48
802e8e6d
PA
49 /* Hardware-assisted write watchpoint. */
50 raw_bkpt_type_write_wp,
d50171e4 51
802e8e6d
PA
52 /* Hardware-assisted read watchpoint. */
53 raw_bkpt_type_read_wp,
54
55 /* Hardware-assisted access watchpoint. */
56 raw_bkpt_type_access_wp
57 };
58
59/* Map the protocol breakpoint/watchpoint type Z_TYPE to the internal
60 raw breakpoint type. */
61
62enum raw_bkpt_type Z_packet_to_raw_bkpt_type (char z_type);
63
64/* Map a raw breakpoint type to an enum target_hw_bp_type. */
65
66enum target_hw_bp_type raw_bkpt_type_to_target_hw_bp_type
67 (enum raw_bkpt_type raw_type);
68
27165294 69/* Create a new GDB breakpoint of type Z_TYPE at ADDR with kind KIND.
802e8e6d
PA
70 Returns a pointer to the newly created breakpoint on success. On
71 failure returns NULL and sets *ERR to either -1 for error, or 1 if
72 Z_TYPE breakpoints are not supported on this target. */
73
9aa76cd0
YQ
74struct gdb_breakpoint *set_gdb_breakpoint (char z_type, CORE_ADDR addr,
75 int kind, int *err);
802e8e6d 76
27165294 77/* Delete a GDB breakpoint of type Z_TYPE and kind KIND previously
802e8e6d
PA
78 inserted at ADDR with set_gdb_breakpoint_at. Returns 0 on success,
79 -1 on error, and 1 if Z_TYPE breakpoints are not supported on this
80 target. */
81
27165294 82int delete_gdb_breakpoint (char z_type, CORE_ADDR addr, int kind);
802e8e6d
PA
83
84/* Returns TRUE if there's a software or hardware (code) breakpoint at
85 ADDR in our tables, inserted, or not. */
d50171e4
PA
86
87int breakpoint_here (CORE_ADDR addr);
88
802e8e6d
PA
89/* Returns TRUE if there's any inserted software or hardware (code)
90 breakpoint set at ADDR. */
d50171e4
PA
91
92int breakpoint_inserted_here (CORE_ADDR addr);
93
582511be
PA
94/* Returns TRUE if there's any inserted software breakpoint at
95 ADDR. */
96
97int software_breakpoint_inserted_here (CORE_ADDR addr);
98
99/* Returns TRUE if there's any inserted hardware (code) breakpoint at
100 ADDR. */
101
102int hardware_breakpoint_inserted_here (CORE_ADDR addr);
103
2d97cd35
AT
104/* Returns TRUE if there's any reinsert breakpoint at ADDR. */
105
106int reinsert_breakpoint_inserted_here (CORE_ADDR addr);
107
0a261ed8
PA
108/* Clear all breakpoint conditions and commands associated with a
109 breakpoint. */
9f3a5c85 110
9aa76cd0 111void clear_breakpoint_conditions_and_commands (struct gdb_breakpoint *bp);
9f3a5c85 112
d708bcd1
PA
113/* Set target-side condition CONDITION to the breakpoint at ADDR.
114 Returns false on failure. On success, advances CONDITION pointer
115 past the condition and returns true. */
9f3a5c85 116
9aa76cd0 117int add_breakpoint_condition (struct gdb_breakpoint *bp, char **condition);
9f3a5c85 118
d708bcd1
PA
119/* Set target-side commands COMMANDS to the breakpoint at ADDR.
120 Returns false on failure. On success, advances COMMANDS past the
121 commands and returns true. If PERSIST, the commands should run
122 even while GDB is disconnected. */
123
9aa76cd0 124int add_breakpoint_commands (struct gdb_breakpoint *bp, char **commands,
802e8e6d 125 int persist);
d3ce09f5
SS
126
127int any_persistent_commands (void);
128
9f3a5c85
LM
129/* Evaluation condition (if any) at breakpoint BP. Return 1 if
130 true and 0 otherwise. */
131
132int gdb_condition_true_at_breakpoint (CORE_ADDR where);
133
d3ce09f5
SS
134int gdb_no_commands_at_breakpoint (CORE_ADDR where);
135
136void run_breakpoint_commands (CORE_ADDR where);
137
802e8e6d
PA
138/* Returns TRUE if there's a GDB breakpoint (Z0 or Z1) set at
139 WHERE. */
8b07ae33
PA
140
141int gdb_breakpoint_here (CORE_ADDR where);
142
611cb4a5 143/* Create a new breakpoint at WHERE, and call HANDLER when
b65d95c5 144 it is hit. HANDLER should return 1 if the breakpoint
811f8301
YQ
145 should be deleted, 0 otherwise. The type of the created
146 breakpoint is other_breakpoint. */
611cb4a5 147
414a389f
PA
148struct breakpoint *set_breakpoint_at (CORE_ADDR where,
149 int (*handler) (CORE_ADDR));
611cb4a5 150
219f2f23
PA
151/* Delete a breakpoint. */
152
153int delete_breakpoint (struct breakpoint *bkpt);
154
bec903c9
YQ
155/* Set a reinsert breakpoint at STOP_AT for thread represented by
156 PTID. */
d50171e4 157
bec903c9 158void set_reinsert_breakpoint (CORE_ADDR stop_at, ptid_t ptid);
d50171e4 159
bec903c9 160/* Delete all reinsert breakpoints of THREAD. */
611cb4a5 161
bec903c9 162void delete_reinsert_breakpoints (struct thread_info *thread);
611cb4a5 163
bec903c9 164/* Reinsert all reinsert breakpoints of THREAD. */
2e7b624b 165
bec903c9 166void reinsert_reinsert_breakpoints (struct thread_info *thread);
2e7b624b 167
bec903c9
YQ
168/* Uninsert all reinsert breakpoints of THREAD. This still leaves
169 the reinsert breakpoints in the table. */
2e7b624b 170
bec903c9 171void uninsert_reinsert_breakpoints (struct thread_info *thread);
2e7b624b 172
d50171e4
PA
173/* Reinsert breakpoints at WHERE (and change their status to
174 inserted). */
611cb4a5 175
d50171e4 176void reinsert_breakpoints_at (CORE_ADDR where);
611cb4a5 177
bec903c9 178/* The THREAD has reinsert breakpoints or not. */
f79b145d 179
bec903c9 180int has_reinsert_breakpoints (struct thread_info *thread);
f79b145d 181
d50171e4
PA
182/* Uninsert breakpoints at WHERE (and change their status to
183 uninserted). This still leaves the breakpoints in the table. */
611cb4a5 184
d50171e4 185void uninsert_breakpoints_at (CORE_ADDR where);
611cb4a5 186
0fb4aa4b
PA
187/* Reinsert all breakpoints of the current process (and change their
188 status to inserted). */
189
190void reinsert_all_breakpoints (void);
191
192/* Uninsert all breakpoints of the current process (and change their
193 status to uninserted). This still leaves the breakpoints in the
194 table. */
195
196void uninsert_all_breakpoints (void);
197
611cb4a5
DJ
198/* See if any breakpoint claims ownership of STOP_PC. Call the handler for
199 the breakpoint, if found. */
200
d50171e4 201void check_breakpoints (CORE_ADDR stop_pc);
611cb4a5
DJ
202
203/* See if any breakpoints shadow the target memory area from MEM_ADDR
204 to MEM_ADDR + MEM_LEN. Update the data already read from the target
205 (in BUF) if necessary. */
206
f450004a 207void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
611cb4a5
DJ
208
209/* See if any breakpoints shadow the target memory area from MEM_ADDR
210 to MEM_ADDR + MEM_LEN. Update the data to be written to the target
b9fd1791
PA
211 (in BUF, a copy of MYADDR on entry) if necessary, as well as the
212 original data for any breakpoints. */
611cb4a5 213
b9fd1791
PA
214void check_mem_write (CORE_ADDR mem_addr,
215 unsigned char *buf, const unsigned char *myaddr, int mem_len);
611cb4a5 216
ae13219e
DJ
217/* Delete all breakpoints. */
218
219void delete_all_breakpoints (void);
220
f9e39928
PA
221/* Clear the "inserted" flag in all breakpoints of PROC. */
222
223void mark_breakpoints_out (struct process_info *proc);
224
95954743
PA
225/* Delete all breakpoints, but do not try to un-insert them from the
226 inferior. */
227
228void free_all_breakpoints (struct process_info *proc);
229
d3bbe7a0
PA
230/* Check if breakpoints still seem to be inserted in the inferior. */
231
232void validate_breakpoints (void);
233
fa593d66
PA
234/* Insert a fast tracepoint jump at WHERE, using instruction INSN, of
235 LENGTH bytes. */
236
237struct fast_tracepoint_jump *set_fast_tracepoint_jump (CORE_ADDR where,
238 unsigned char *insn,
239 ULONGEST length);
240
5c73ff4e
YQ
241/* Increment reference counter of JP. */
242void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp);
243
fa593d66
PA
244/* Delete fast tracepoint jump TODEL from our tables, and uninsert if
245 from memory. */
246
247int delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel);
248
249/* Returns true if there's fast tracepoint jump set at WHERE. */
250
251int fast_tracepoint_jump_here (CORE_ADDR);
252
253/* Uninsert fast tracepoint jumps at WHERE (and change their status to
254 uninserted). This still leaves the tracepoints in the table. */
255
256void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc);
257
258/* Reinsert fast tracepoint jumps at WHERE (and change their status to
259 inserted). */
260
261void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where);
262
802e8e6d
PA
263/* Insert a memory breakpoint. */
264
265int insert_memory_breakpoint (struct raw_breakpoint *bp);
266
267/* Remove a previously inserted memory breakpoint. */
268
269int remove_memory_breakpoint (struct raw_breakpoint *bp);
270
63c40ec7
YQ
271/* Create a new breakpoint list in CHILD_THREAD's process that is a
272 copy of breakpoint list in PARENT_THREAD's process. */
ddcbc397 273
63c40ec7
YQ
274void clone_all_breakpoints (struct thread_info *child_thread,
275 const struct thread_info *parent_thread);
ddcbc397 276
611cb4a5 277#endif /* MEM_BREAK_H */
This page took 1.295484 seconds and 4 git commands to generate.