1 /* Simulate breakpoints by patching locations in the target system, for GDB.
3 Copyright 1990, 1991, 1992, 1993, 1995, 1997, 1998, 1999, 2000,
4 2002 Free Software Foundation, Inc.
6 Contributed by Cygnus Support. Written by John Gilmore.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
27 /* This file is only useful if BREAKPOINT_FROM_PC is set. If not, we
31 #include "breakpoint.h"
36 /* Insert a breakpoint on targets that don't have any better breakpoint
37 support. We read the contents of the target location and stash it,
38 then overwrite it with a breakpoint instruction. ADDR is the target
39 location in the target machine. CONTENTS_CACHE is a pointer to
40 memory allocated for saving the target contents. It is guaranteed
41 by the caller to be long enough to save BREAKPOINT_LEN bytes (this
42 is accomplished via BREAKPOINT_MAX). */
45 default_memory_insert_breakpoint (CORE_ADDR addr
, char *contents_cache
)
48 const unsigned char *bp
;
51 /* Determine appropriate breakpoint contents and size for this address. */
52 bp
= BREAKPOINT_FROM_PC (&addr
, &bplen
);
54 error (_("Software breakpoints not implemented for this target."));
56 /* Save the memory contents. */
57 val
= target_read_memory (addr
, contents_cache
, bplen
);
59 /* Write the breakpoint. */
61 val
= target_write_memory (addr
, (char *) bp
, bplen
);
68 default_memory_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
70 const unsigned char *bp
;
73 /* Determine appropriate breakpoint contents and size for this address. */
74 bp
= BREAKPOINT_FROM_PC (&addr
, &bplen
);
76 error (_("Software breakpoints not implemented for this target."));
78 return target_write_memory (addr
, contents_cache
, bplen
);
83 memory_insert_breakpoint (CORE_ADDR addr
, char *contents_cache
)
85 return MEMORY_INSERT_BREAKPOINT(addr
, contents_cache
);
89 memory_remove_breakpoint (CORE_ADDR addr
, char *contents_cache
)
91 return MEMORY_REMOVE_BREAKPOINT(addr
, contents_cache
);
This page took 0.031051 seconds and 4 git commands to generate.