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