Commit | Line | Data |
---|---|---|
611cb4a5 | 1 | /* Memory breakpoint interfaces for the remote server for GDB. |
0b302171 | 2 | Copyright (C) 2002, 2005, 2007-2012 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 | ||
8b07ae33 PA |
42 | /* Returns TRUE if there's a GDB breakpoint set at ADDR. */ |
43 | ||
44 | int gdb_breakpoint_here (CORE_ADDR where); | |
45 | ||
611cb4a5 | 46 | /* Create a new breakpoint at WHERE, and call HANDLER when |
b65d95c5 DJ |
47 | it is hit. HANDLER should return 1 if the breakpoint |
48 | should be deleted, 0 otherwise. */ | |
611cb4a5 | 49 | |
414a389f PA |
50 | struct breakpoint *set_breakpoint_at (CORE_ADDR where, |
51 | int (*handler) (CORE_ADDR)); | |
611cb4a5 | 52 | |
8b07ae33 PA |
53 | /* Delete a GDB breakpoint previously inserted at ADDR with |
54 | set_gdb_breakpoint_at. */ | |
68070c10 | 55 | |
8b07ae33 | 56 | int delete_gdb_breakpoint_at (CORE_ADDR addr); |
68070c10 | 57 | |
219f2f23 PA |
58 | /* Delete a breakpoint. */ |
59 | ||
60 | int delete_breakpoint (struct breakpoint *bkpt); | |
61 | ||
d50171e4 PA |
62 | /* Set a reinsert breakpoint at STOP_AT. */ |
63 | ||
64 | void set_reinsert_breakpoint (CORE_ADDR stop_at); | |
65 | ||
66 | /* Delete all reinsert breakpoints. */ | |
611cb4a5 | 67 | |
d50171e4 | 68 | void delete_reinsert_breakpoints (void); |
611cb4a5 | 69 | |
d50171e4 PA |
70 | /* Reinsert breakpoints at WHERE (and change their status to |
71 | inserted). */ | |
611cb4a5 | 72 | |
d50171e4 | 73 | void reinsert_breakpoints_at (CORE_ADDR where); |
611cb4a5 | 74 | |
d50171e4 PA |
75 | /* Uninsert breakpoints at WHERE (and change their status to |
76 | uninserted). This still leaves the breakpoints in the table. */ | |
611cb4a5 | 77 | |
d50171e4 | 78 | void uninsert_breakpoints_at (CORE_ADDR where); |
611cb4a5 | 79 | |
0fb4aa4b PA |
80 | /* Reinsert all breakpoints of the current process (and change their |
81 | status to inserted). */ | |
82 | ||
83 | void reinsert_all_breakpoints (void); | |
84 | ||
85 | /* Uninsert all breakpoints of the current process (and change their | |
86 | status to uninserted). This still leaves the breakpoints in the | |
87 | table. */ | |
88 | ||
89 | void uninsert_all_breakpoints (void); | |
90 | ||
611cb4a5 DJ |
91 | /* See if any breakpoint claims ownership of STOP_PC. Call the handler for |
92 | the breakpoint, if found. */ | |
93 | ||
d50171e4 | 94 | void check_breakpoints (CORE_ADDR stop_pc); |
611cb4a5 DJ |
95 | |
96 | /* See if any breakpoints shadow the target memory area from MEM_ADDR | |
97 | to MEM_ADDR + MEM_LEN. Update the data already read from the target | |
98 | (in BUF) if necessary. */ | |
99 | ||
f450004a | 100 | void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len); |
611cb4a5 DJ |
101 | |
102 | /* See if any breakpoints shadow the target memory area from MEM_ADDR | |
103 | to MEM_ADDR + MEM_LEN. Update the data to be written to the target | |
b9fd1791 PA |
104 | (in BUF, a copy of MYADDR on entry) if necessary, as well as the |
105 | original data for any breakpoints. */ | |
611cb4a5 | 106 | |
b9fd1791 PA |
107 | void check_mem_write (CORE_ADDR mem_addr, |
108 | unsigned char *buf, const unsigned char *myaddr, int mem_len); | |
611cb4a5 DJ |
109 | |
110 | /* Set the byte pattern to insert for memory breakpoints. This function | |
111 | must be called before any breakpoints are set. */ | |
112 | ||
f450004a | 113 | void set_breakpoint_data (const unsigned char *bp_data, int bp_len); |
611cb4a5 | 114 | |
ae13219e DJ |
115 | /* Delete all breakpoints. */ |
116 | ||
117 | void delete_all_breakpoints (void); | |
118 | ||
f9e39928 PA |
119 | /* Clear the "inserted" flag in all breakpoints of PROC. */ |
120 | ||
121 | void mark_breakpoints_out (struct process_info *proc); | |
122 | ||
95954743 PA |
123 | /* Delete all breakpoints, but do not try to un-insert them from the |
124 | inferior. */ | |
125 | ||
126 | void free_all_breakpoints (struct process_info *proc); | |
127 | ||
d3bbe7a0 PA |
128 | /* Check if breakpoints still seem to be inserted in the inferior. */ |
129 | ||
130 | void validate_breakpoints (void); | |
131 | ||
fa593d66 PA |
132 | /* Insert a fast tracepoint jump at WHERE, using instruction INSN, of |
133 | LENGTH bytes. */ | |
134 | ||
135 | struct fast_tracepoint_jump *set_fast_tracepoint_jump (CORE_ADDR where, | |
136 | unsigned char *insn, | |
137 | ULONGEST length); | |
138 | ||
5c73ff4e YQ |
139 | /* Increment reference counter of JP. */ |
140 | void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp); | |
141 | ||
fa593d66 PA |
142 | /* Delete fast tracepoint jump TODEL from our tables, and uninsert if |
143 | from memory. */ | |
144 | ||
145 | int delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel); | |
146 | ||
147 | /* Returns true if there's fast tracepoint jump set at WHERE. */ | |
148 | ||
149 | int fast_tracepoint_jump_here (CORE_ADDR); | |
150 | ||
151 | /* Uninsert fast tracepoint jumps at WHERE (and change their status to | |
152 | uninserted). This still leaves the tracepoints in the table. */ | |
153 | ||
154 | void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc); | |
155 | ||
156 | /* Reinsert fast tracepoint jumps at WHERE (and change their status to | |
157 | inserted). */ | |
158 | ||
159 | void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where); | |
160 | ||
611cb4a5 | 161 | #endif /* MEM_BREAK_H */ |