1 /* Memory breakpoint interfaces for the remote server for GDB.
2 Copyright (C) 2002-2013 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. */
53 int add_breakpoint_condition (CORE_ADDR addr
, char **condition
);
55 int add_breakpoint_commands (CORE_ADDR addr
, char **commands
, int persist
);
57 int any_persistent_commands (void);
59 /* Evaluation condition (if any) at breakpoint BP. Return 1 if
60 true and 0 otherwise. */
62 int gdb_condition_true_at_breakpoint (CORE_ADDR where
);
64 int gdb_no_commands_at_breakpoint (CORE_ADDR where
);
66 void run_breakpoint_commands (CORE_ADDR where
);
68 /* Returns TRUE if there's a GDB breakpoint set at ADDR. */
70 int gdb_breakpoint_here (CORE_ADDR where
);
72 /* Create a new breakpoint at WHERE, and call HANDLER when
73 it is hit. HANDLER should return 1 if the breakpoint
74 should be deleted, 0 otherwise. */
76 struct breakpoint
*set_breakpoint_at (CORE_ADDR where
,
77 int (*handler
) (CORE_ADDR
));
79 /* Delete a GDB breakpoint previously inserted at ADDR with
80 set_gdb_breakpoint_at. */
82 int delete_gdb_breakpoint_at (CORE_ADDR addr
);
84 /* Delete a breakpoint. */
86 int delete_breakpoint (struct breakpoint
*bkpt
);
88 /* Set a reinsert breakpoint at STOP_AT. */
90 void set_reinsert_breakpoint (CORE_ADDR stop_at
);
92 /* Delete all reinsert breakpoints. */
94 void delete_reinsert_breakpoints (void);
96 /* Reinsert breakpoints at WHERE (and change their status to
99 void reinsert_breakpoints_at (CORE_ADDR where
);
101 /* Uninsert breakpoints at WHERE (and change their status to
102 uninserted). This still leaves the breakpoints in the table. */
104 void uninsert_breakpoints_at (CORE_ADDR where
);
106 /* Reinsert all breakpoints of the current process (and change their
107 status to inserted). */
109 void reinsert_all_breakpoints (void);
111 /* Uninsert all breakpoints of the current process (and change their
112 status to uninserted). This still leaves the breakpoints in the
115 void uninsert_all_breakpoints (void);
117 /* See if any breakpoint claims ownership of STOP_PC. Call the handler for
118 the breakpoint, if found. */
120 void check_breakpoints (CORE_ADDR stop_pc
);
122 /* See if any breakpoints shadow the target memory area from MEM_ADDR
123 to MEM_ADDR + MEM_LEN. Update the data already read from the target
124 (in BUF) if necessary. */
126 void check_mem_read (CORE_ADDR mem_addr
, unsigned char *buf
, int mem_len
);
128 /* See if any breakpoints shadow the target memory area from MEM_ADDR
129 to MEM_ADDR + MEM_LEN. Update the data to be written to the target
130 (in BUF, a copy of MYADDR on entry) if necessary, as well as the
131 original data for any breakpoints. */
133 void check_mem_write (CORE_ADDR mem_addr
,
134 unsigned char *buf
, const unsigned char *myaddr
, int mem_len
);
136 /* Set the byte pattern to insert for memory breakpoints. This function
137 must be called before any breakpoints are set. */
139 void set_breakpoint_data (const unsigned char *bp_data
, int bp_len
);
141 /* Delete all breakpoints. */
143 void delete_all_breakpoints (void);
145 /* Clear the "inserted" flag in all breakpoints of PROC. */
147 void mark_breakpoints_out (struct process_info
*proc
);
149 /* Delete all breakpoints, but do not try to un-insert them from the
152 void free_all_breakpoints (struct process_info
*proc
);
154 /* Check if breakpoints still seem to be inserted in the inferior. */
156 void validate_breakpoints (void);
158 /* Insert a fast tracepoint jump at WHERE, using instruction INSN, of
161 struct fast_tracepoint_jump
*set_fast_tracepoint_jump (CORE_ADDR where
,
165 /* Increment reference counter of JP. */
166 void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump
*jp
);
168 /* Delete fast tracepoint jump TODEL from our tables, and uninsert if
171 int delete_fast_tracepoint_jump (struct fast_tracepoint_jump
*todel
);
173 /* Returns true if there's fast tracepoint jump set at WHERE. */
175 int fast_tracepoint_jump_here (CORE_ADDR
);
177 /* Uninsert fast tracepoint jumps at WHERE (and change their status to
178 uninserted). This still leaves the tracepoints in the table. */
180 void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc
);
182 /* Reinsert fast tracepoint jumps at WHERE (and change their status to
185 void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where
);
187 #endif /* MEM_BREAK_H */