1 /* Memory breakpoint interfaces for the remote server for GDB.
2 Copyright (C) 2002-2014 Free Software Foundation, Inc.
4 Contributed by MontaVista Software.
6 This file is part of GDB.
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.
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.
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/>. */
24 /* Breakpoints are opaque. */
26 struct fast_tracepoint_jump;
28 /* Locate a breakpoint placed at address WHERE and return a pointer
31 struct breakpoint *find_gdb_breakpoint_at (CORE_ADDR where);
33 /* Create a new GDB breakpoint at WHERE. Returns -1 if breakpoints
34 are not supported on this target, 0 otherwise. */
36 int set_gdb_breakpoint_at (CORE_ADDR where);
38 /* Returns TRUE if there's any breakpoint at ADDR in our tables,
41 int breakpoint_here (CORE_ADDR addr);
43 /* Returns TRUE if there's any inserted breakpoint set at ADDR. */
45 int breakpoint_inserted_here (CORE_ADDR addr);
47 /* Clear all breakpoint conditions associated with this address. */
49 void clear_gdb_breakpoint_conditions (CORE_ADDR addr);
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. */
55 int add_breakpoint_condition (CORE_ADDR addr, char **condition);
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. */
62 int add_breakpoint_commands (CORE_ADDR addr, char **commands, int persist);
64 int any_persistent_commands (void);
66 /* Evaluation condition (if any) at breakpoint BP. Return 1 if
67 true and 0 otherwise. */
69 int gdb_condition_true_at_breakpoint (CORE_ADDR where);
71 int gdb_no_commands_at_breakpoint (CORE_ADDR where);
73 void run_breakpoint_commands (CORE_ADDR where);
75 /* Returns TRUE if there's a GDB breakpoint set at ADDR. */
77 int gdb_breakpoint_here (CORE_ADDR where);
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. */
83 struct breakpoint *set_breakpoint_at (CORE_ADDR where,
84 int (*handler) (CORE_ADDR));
86 /* Delete a GDB breakpoint previously inserted at ADDR with
87 set_gdb_breakpoint_at. */
89 int delete_gdb_breakpoint_at (CORE_ADDR addr);
91 /* Delete a breakpoint. */
93 int delete_breakpoint (struct breakpoint *bkpt);
95 /* Set a reinsert breakpoint at STOP_AT. */
97 void set_reinsert_breakpoint (CORE_ADDR stop_at);
99 /* Delete all reinsert breakpoints. */
101 void delete_reinsert_breakpoints (void);
103 /* Reinsert breakpoints at WHERE (and change their status to
106 void reinsert_breakpoints_at (CORE_ADDR where);
108 /* Uninsert breakpoints at WHERE (and change their status to
109 uninserted). This still leaves the breakpoints in the table. */
111 void uninsert_breakpoints_at (CORE_ADDR where);
113 /* Reinsert all breakpoints of the current process (and change their
114 status to inserted). */
116 void reinsert_all_breakpoints (void);
118 /* Uninsert all breakpoints of the current process (and change their
119 status to uninserted). This still leaves the breakpoints in the
122 void uninsert_all_breakpoints (void);
124 /* See if any breakpoint claims ownership of STOP_PC. Call the handler for
125 the breakpoint, if found. */
127 void check_breakpoints (CORE_ADDR stop_pc);
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. */
133 void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
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. */
140 void check_mem_write (CORE_ADDR mem_addr,
141 unsigned char *buf, const unsigned char *myaddr, int mem_len);
143 /* Set the byte pattern to insert for memory breakpoints. This function
144 must be called before any breakpoints are set. */
146 void set_breakpoint_data (const unsigned char *bp_data, int bp_len);
148 /* Delete all breakpoints. */
150 void delete_all_breakpoints (void);
152 /* Clear the "inserted" flag in all breakpoints of PROC. */
154 void mark_breakpoints_out (struct process_info *proc);
156 /* Delete all breakpoints, but do not try to un-insert them from the
159 void free_all_breakpoints (struct process_info *proc);
161 /* Check if breakpoints still seem to be inserted in the inferior. */
163 void validate_breakpoints (void);
165 /* Insert a fast tracepoint jump at WHERE, using instruction INSN, of
168 struct fast_tracepoint_jump *set_fast_tracepoint_jump (CORE_ADDR where,
172 /* Increment reference counter of JP. */
173 void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp);
175 /* Delete fast tracepoint jump TODEL from our tables, and uninsert if
178 int delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel);
180 /* Returns true if there's fast tracepoint jump set at WHERE. */
182 int fast_tracepoint_jump_here (CORE_ADDR);
184 /* Uninsert fast tracepoint jumps at WHERE (and change their status to
185 uninserted). This still leaves the tracepoints in the table. */
187 void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc);
189 /* Reinsert fast tracepoint jumps at WHERE (and change their status to
192 void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where);
194 #endif /* MEM_BREAK_H */