run copyright.sh for 2011.
[external/binutils.git] / gdb / gdbserver / mem-break.h
1 /* Memory breakpoint interfaces for the remote server for GDB.
2    Copyright (C) 2002, 2005, 2007, 2008, 2009, 2010, 2011
3    Free Software Foundation, Inc.
4
5    Contributed by MontaVista Software.
6
7    This file is part of GDB.
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
22 #ifndef MEM_BREAK_H
23 #define MEM_BREAK_H
24
25 /* Breakpoints are opaque.  */
26 struct breakpoint;
27 struct fast_tracepoint_jump;
28
29 /* Create a new GDB breakpoint at WHERE.  Returns -1 if breakpoints
30    are not supported on this target, 0 otherwise.  */
31
32 int set_gdb_breakpoint_at (CORE_ADDR where);
33
34 /* Returns TRUE if there's any breakpoint at ADDR in our tables,
35    inserted, or not.  */
36
37 int breakpoint_here (CORE_ADDR addr);
38
39 /* Returns TRUE if there's any inserted breakpoint set at ADDR.  */
40
41 int breakpoint_inserted_here (CORE_ADDR addr);
42
43 /* Returns TRUE if there's a GDB breakpoint set at ADDR.  */
44
45 int gdb_breakpoint_here (CORE_ADDR where);
46
47 /* Create a new breakpoint at WHERE, and call HANDLER when
48    it is hit.  HANDLER should return 1 if the breakpoint
49    should be deleted, 0 otherwise.  */
50
51 struct breakpoint *set_breakpoint_at (CORE_ADDR where,
52                                       int (*handler) (CORE_ADDR));
53
54 /* Delete a GDB breakpoint previously inserted at ADDR with
55    set_gdb_breakpoint_at.  */
56
57 int delete_gdb_breakpoint_at (CORE_ADDR addr);
58
59 /* Delete a breakpoint.  */
60
61 int delete_breakpoint (struct breakpoint *bkpt);
62
63 /* Set a reinsert breakpoint at STOP_AT.  */
64
65 void set_reinsert_breakpoint (CORE_ADDR stop_at);
66
67 /* Delete all reinsert breakpoints.  */
68
69 void delete_reinsert_breakpoints (void);
70
71 /* Reinsert breakpoints at WHERE (and change their status to
72    inserted).  */
73
74 void reinsert_breakpoints_at (CORE_ADDR where);
75
76 /* Uninsert breakpoints at WHERE (and change their status to
77    uninserted).  This still leaves the breakpoints in the table.  */
78
79 void uninsert_breakpoints_at (CORE_ADDR where);
80
81 /* Reinsert all breakpoints of the current process (and change their
82    status to inserted).  */
83
84 void reinsert_all_breakpoints (void);
85
86 /* Uninsert all breakpoints of the current process (and change their
87    status to uninserted).  This still leaves the breakpoints in the
88    table.  */
89
90 void uninsert_all_breakpoints (void);
91
92 /* See if any breakpoint claims ownership of STOP_PC.  Call the handler for
93    the breakpoint, if found.  */
94
95 void check_breakpoints (CORE_ADDR stop_pc);
96
97 /* See if any breakpoints shadow the target memory area from MEM_ADDR
98    to MEM_ADDR + MEM_LEN.  Update the data already read from the target
99    (in BUF) if necessary.  */
100
101 void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
102
103 /* See if any breakpoints shadow the target memory area from MEM_ADDR
104    to MEM_ADDR + MEM_LEN.  Update the data to be written to the target
105    (in BUF) if necessary, as well as the original data for any breakpoints.  */
106
107 void check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
108
109 /* Set the byte pattern to insert for memory breakpoints.  This function
110    must be called before any breakpoints are set.  */
111
112 void set_breakpoint_data (const unsigned char *bp_data, int bp_len);
113
114 /* Delete all breakpoints.  */
115
116 void delete_all_breakpoints (void);
117
118 /* Clear the "inserted" flag in all breakpoints of PROC.  */
119
120 void mark_breakpoints_out (struct process_info *proc);
121
122 /* Delete all breakpoints, but do not try to un-insert them from the
123    inferior.  */
124
125 void free_all_breakpoints (struct process_info *proc);
126
127 /* Check if breakpoints still seem to be inserted in the inferior.  */
128
129 void validate_breakpoints (void);
130
131 /* Insert a fast tracepoint jump at WHERE, using instruction INSN, of
132    LENGTH bytes.  */
133
134 struct fast_tracepoint_jump *set_fast_tracepoint_jump (CORE_ADDR where,
135                                                        unsigned char *insn,
136                                                        ULONGEST length);
137
138 /* Delete fast tracepoint jump TODEL from our tables, and uninsert if
139    from memory.  */
140
141 int delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel);
142
143 /* Returns true if there's fast tracepoint jump set at WHERE.  */
144
145 int fast_tracepoint_jump_here (CORE_ADDR);
146
147 /* Uninsert fast tracepoint jumps at WHERE (and change their status to
148    uninserted).  This still leaves the tracepoints in the table.  */
149
150 void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc);
151
152 /* Reinsert fast tracepoint jumps at WHERE (and change their status to
153    inserted).  */
154
155 void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where);
156
157 #endif /* MEM_BREAK_H */