xref: /openbsd-src/gnu/usr.bin/binutils/gdb/gdbserver/mem-break.h (revision b725ae7711052a2233e31a66fefb8a752c388d7a)
1*b725ae77Skettenis /* Memory breakpoint interfaces for the remote server for GDB.
2*b725ae77Skettenis    Copyright 2002
3*b725ae77Skettenis    Free Software Foundation, Inc.
4*b725ae77Skettenis 
5*b725ae77Skettenis    Contributed by MontaVista Software.
6*b725ae77Skettenis 
7*b725ae77Skettenis    This file is part of GDB.
8*b725ae77Skettenis 
9*b725ae77Skettenis    This program is free software; you can redistribute it and/or modify
10*b725ae77Skettenis    it under the terms of the GNU General Public License as published by
11*b725ae77Skettenis    the Free Software Foundation; either version 2 of the License, or
12*b725ae77Skettenis    (at your option) any later version.
13*b725ae77Skettenis 
14*b725ae77Skettenis    This program is distributed in the hope that it will be useful,
15*b725ae77Skettenis    but WITHOUT ANY WARRANTY; without even the implied warranty of
16*b725ae77Skettenis    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*b725ae77Skettenis    GNU General Public License for more details.
18*b725ae77Skettenis 
19*b725ae77Skettenis    You should have received a copy of the GNU General Public License
20*b725ae77Skettenis    along with this program; if not, write to the Free Software
21*b725ae77Skettenis    Foundation, Inc., 59 Temple Place - Suite 330,
22*b725ae77Skettenis    Boston, MA 02111-1307, USA.  */
23*b725ae77Skettenis 
24*b725ae77Skettenis #ifndef MEM_BREAK_H
25*b725ae77Skettenis #define MEM_BREAK_H
26*b725ae77Skettenis 
27*b725ae77Skettenis /* Breakpoints are opaque.  */
28*b725ae77Skettenis 
29*b725ae77Skettenis /* Create a new breakpoint at WHERE, and call HANDLER when
30*b725ae77Skettenis    it is hit.  */
31*b725ae77Skettenis 
32*b725ae77Skettenis void set_breakpoint_at (CORE_ADDR where,
33*b725ae77Skettenis 			void (*handler) (CORE_ADDR));
34*b725ae77Skettenis 
35*b725ae77Skettenis /* Create a reinsertion breakpoint at STOP_AT for the breakpoint
36*b725ae77Skettenis    currently at STOP_PC (and temporarily remove the breakpoint at
37*b725ae77Skettenis    STOP_PC).  */
38*b725ae77Skettenis 
39*b725ae77Skettenis void reinsert_breakpoint_by_bp (CORE_ADDR stop_pc, CORE_ADDR stop_at);
40*b725ae77Skettenis 
41*b725ae77Skettenis /* Change the status of the breakpoint at WHERE to inserted.  */
42*b725ae77Skettenis 
43*b725ae77Skettenis void reinsert_breakpoint (CORE_ADDR where);
44*b725ae77Skettenis 
45*b725ae77Skettenis /* Change the status of the breakpoint at WHERE to uninserted.  */
46*b725ae77Skettenis 
47*b725ae77Skettenis void uninsert_breakpoint (CORE_ADDR where);
48*b725ae77Skettenis 
49*b725ae77Skettenis /* See if any breakpoint claims ownership of STOP_PC.  Call the handler for
50*b725ae77Skettenis    the breakpoint, if found.  */
51*b725ae77Skettenis 
52*b725ae77Skettenis int check_breakpoints (CORE_ADDR stop_pc);
53*b725ae77Skettenis 
54*b725ae77Skettenis /* See if any breakpoints shadow the target memory area from MEM_ADDR
55*b725ae77Skettenis    to MEM_ADDR + MEM_LEN.  Update the data already read from the target
56*b725ae77Skettenis    (in BUF) if necessary.  */
57*b725ae77Skettenis 
58*b725ae77Skettenis void check_mem_read (CORE_ADDR mem_addr, char *buf, int mem_len);
59*b725ae77Skettenis 
60*b725ae77Skettenis /* See if any breakpoints shadow the target memory area from MEM_ADDR
61*b725ae77Skettenis    to MEM_ADDR + MEM_LEN.  Update the data to be written to the target
62*b725ae77Skettenis    (in BUF) if necessary, as well as the original data for any breakpoints.  */
63*b725ae77Skettenis 
64*b725ae77Skettenis void check_mem_write (CORE_ADDR mem_addr, char *buf, int mem_len);
65*b725ae77Skettenis 
66*b725ae77Skettenis /* Set the byte pattern to insert for memory breakpoints.  This function
67*b725ae77Skettenis    must be called before any breakpoints are set.  */
68*b725ae77Skettenis 
69*b725ae77Skettenis void set_breakpoint_data (const char *bp_data, int bp_len);
70*b725ae77Skettenis 
71*b725ae77Skettenis #endif /* MEM_BREAK_H */
72