2012-02-24 Luis Machado <lgustavo@codesourcery>
[external/binutils.git] / gdb / gdbserver / mem-break.h
1 /* Memory breakpoint interfaces for the remote server for GDB.
2    Copyright (C) 2002, 2005, 2007-2012 Free Software Foundation, Inc.
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
10    the Free Software Foundation; either version 3 of the License, or
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
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20
21 #ifndef MEM_BREAK_H
22 #define MEM_BREAK_H
23
24 /* Breakpoints are opaque.  */
25 struct breakpoint;
26 struct fast_tracepoint_jump;
27
28 /* Locate a breakpoint placed at address WHERE and return a pointer
29    to its structure.  */
30
31 struct breakpoint *find_gdb_breakpoint_at (CORE_ADDR where);
32
33 /* Create a new GDB breakpoint at WHERE.  Returns -1 if breakpoints
34    are not supported on this target, 0 otherwise.  */
35
36 int set_gdb_breakpoint_at (CORE_ADDR where);
37
38 /* Returns TRUE if there's any breakpoint at ADDR in our tables,
39    inserted, or not.  */
40
41 int breakpoint_here (CORE_ADDR addr);
42
43 /* Returns TRUE if there's any inserted breakpoint set at ADDR.  */
44
45 int breakpoint_inserted_here (CORE_ADDR addr);
46
47 /* Clear all breakpoint conditions associated with this address.  */
48
49 void clear_gdb_breakpoint_conditions (CORE_ADDR addr);
50
51 /* Set target-side condition CONDITION to the breakpoint at ADDR.  */
52
53 int add_breakpoint_condition (CORE_ADDR addr, char **condition);
54
55 /* Evaluation condition (if any) at breakpoint BP.  Return 1 if
56    true and 0 otherwise.  */
57
58 int gdb_condition_true_at_breakpoint (CORE_ADDR where);
59
60 /* Returns TRUE if there's a GDB breakpoint set at ADDR.  */
61
62 int gdb_breakpoint_here (CORE_ADDR where);
63
64 /* Create a new breakpoint at WHERE, and call HANDLER when
65    it is hit.  HANDLER should return 1 if the breakpoint
66    should be deleted, 0 otherwise.  */
67
68 struct breakpoint *set_breakpoint_at (CORE_ADDR where,
69                                       int (*handler) (CORE_ADDR));
70
71 /* Delete a GDB breakpoint previously inserted at ADDR with
72    set_gdb_breakpoint_at.  */
73
74 int delete_gdb_breakpoint_at (CORE_ADDR addr);
75
76 /* Delete a breakpoint.  */
77
78 int delete_breakpoint (struct breakpoint *bkpt);
79
80 /* Set a reinsert breakpoint at STOP_AT.  */
81
82 void set_reinsert_breakpoint (CORE_ADDR stop_at);
83
84 /* Delete all reinsert breakpoints.  */
85
86 void delete_reinsert_breakpoints (void);
87
88 /* Reinsert breakpoints at WHERE (and change their status to
89    inserted).  */
90
91 void reinsert_breakpoints_at (CORE_ADDR where);
92
93 /* Uninsert breakpoints at WHERE (and change their status to
94    uninserted).  This still leaves the breakpoints in the table.  */
95
96 void uninsert_breakpoints_at (CORE_ADDR where);
97
98 /* Reinsert all breakpoints of the current process (and change their
99    status to inserted).  */
100
101 void reinsert_all_breakpoints (void);
102
103 /* Uninsert all breakpoints of the current process (and change their
104    status to uninserted).  This still leaves the breakpoints in the
105    table.  */
106
107 void uninsert_all_breakpoints (void);
108
109 /* See if any breakpoint claims ownership of STOP_PC.  Call the handler for
110    the breakpoint, if found.  */
111
112 void check_breakpoints (CORE_ADDR stop_pc);
113
114 /* See if any breakpoints shadow the target memory area from MEM_ADDR
115    to MEM_ADDR + MEM_LEN.  Update the data already read from the target
116    (in BUF) if necessary.  */
117
118 void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
119
120 /* See if any breakpoints shadow the target memory area from MEM_ADDR
121    to MEM_ADDR + MEM_LEN.  Update the data to be written to the target
122    (in BUF, a copy of MYADDR on entry) if necessary, as well as the
123    original data for any breakpoints.  */
124
125 void check_mem_write (CORE_ADDR mem_addr,
126                       unsigned char *buf, const unsigned char *myaddr, int mem_len);
127
128 /* Set the byte pattern to insert for memory breakpoints.  This function
129    must be called before any breakpoints are set.  */
130
131 void set_breakpoint_data (const unsigned char *bp_data, int bp_len);
132
133 /* Delete all breakpoints.  */
134
135 void delete_all_breakpoints (void);
136
137 /* Clear the "inserted" flag in all breakpoints of PROC.  */
138
139 void mark_breakpoints_out (struct process_info *proc);
140
141 /* Delete all breakpoints, but do not try to un-insert them from the
142    inferior.  */
143
144 void free_all_breakpoints (struct process_info *proc);
145
146 /* Check if breakpoints still seem to be inserted in the inferior.  */
147
148 void validate_breakpoints (void);
149
150 /* Insert a fast tracepoint jump at WHERE, using instruction INSN, of
151    LENGTH bytes.  */
152
153 struct fast_tracepoint_jump *set_fast_tracepoint_jump (CORE_ADDR where,
154                                                        unsigned char *insn,
155                                                        ULONGEST length);
156
157 /* Increment reference counter of JP.  */
158 void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp);
159
160 /* Delete fast tracepoint jump TODEL from our tables, and uninsert if
161    from memory.  */
162
163 int delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel);
164
165 /* Returns true if there's fast tracepoint jump set at WHERE.  */
166
167 int fast_tracepoint_jump_here (CORE_ADDR);
168
169 /* Uninsert fast tracepoint jumps at WHERE (and change their status to
170    uninserted).  This still leaves the tracepoints in the table.  */
171
172 void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc);
173
174 /* Reinsert fast tracepoint jumps at WHERE (and change their status to
175    inserted).  */
176
177 void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where);
178
179 #endif /* MEM_BREAK_H */