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