| 1 | /* Memory breakpoint interfaces for the remote server for GDB. |
| 2 | Copyright (C) 2002, 2005, 2007, 2008, 2009, 2010 |
| 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 | |
| 28 | /* Returns TRUE if breakpoints are supported on this target. */ |
| 29 | |
| 30 | int breakpoints_supported (void); |
| 31 | |
| 32 | /* Returns TRUE if there's any breakpoint at ADDR in our tables, |
| 33 | inserted, or not. */ |
| 34 | |
| 35 | int breakpoint_here (CORE_ADDR addr); |
| 36 | |
| 37 | /* Returns TRUE if there's any inserted breakpoint set at ADDR. */ |
| 38 | |
| 39 | int breakpoint_inserted_here (CORE_ADDR addr); |
| 40 | |
| 41 | /* Create a new breakpoint at WHERE, and call HANDLER when |
| 42 | it is hit. HANDLER should return 1 if the breakpoint |
| 43 | should be deleted, 0 otherwise. */ |
| 44 | |
| 45 | struct breakpoint *set_breakpoint_at (CORE_ADDR where, |
| 46 | int (*handler) (CORE_ADDR)); |
| 47 | |
| 48 | /* Delete a breakpoint previously inserted at ADDR with |
| 49 | set_breakpoint_at. */ |
| 50 | |
| 51 | void delete_breakpoint_at (CORE_ADDR addr); |
| 52 | |
| 53 | /* Set a reinsert breakpoint at STOP_AT. */ |
| 54 | |
| 55 | void set_reinsert_breakpoint (CORE_ADDR stop_at); |
| 56 | |
| 57 | /* Delete all reinsert breakpoints. */ |
| 58 | |
| 59 | void delete_reinsert_breakpoints (void); |
| 60 | |
| 61 | /* Reinsert breakpoints at WHERE (and change their status to |
| 62 | inserted). */ |
| 63 | |
| 64 | void reinsert_breakpoints_at (CORE_ADDR where); |
| 65 | |
| 66 | /* Uninsert breakpoints at WHERE (and change their status to |
| 67 | uninserted). This still leaves the breakpoints in the table. */ |
| 68 | |
| 69 | void uninsert_breakpoints_at (CORE_ADDR where); |
| 70 | |
| 71 | /* See if any breakpoint claims ownership of STOP_PC. Call the handler for |
| 72 | the breakpoint, if found. */ |
| 73 | |
| 74 | void check_breakpoints (CORE_ADDR stop_pc); |
| 75 | |
| 76 | /* See if any breakpoints shadow the target memory area from MEM_ADDR |
| 77 | to MEM_ADDR + MEM_LEN. Update the data already read from the target |
| 78 | (in BUF) if necessary. */ |
| 79 | |
| 80 | void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len); |
| 81 | |
| 82 | /* See if any breakpoints shadow the target memory area from MEM_ADDR |
| 83 | to MEM_ADDR + MEM_LEN. Update the data to be written to the target |
| 84 | (in BUF) if necessary, as well as the original data for any breakpoints. */ |
| 85 | |
| 86 | void check_mem_write (CORE_ADDR mem_addr, unsigned char *buf, int mem_len); |
| 87 | |
| 88 | /* Set the byte pattern to insert for memory breakpoints. This function |
| 89 | must be called before any breakpoints are set. */ |
| 90 | |
| 91 | void set_breakpoint_data (const unsigned char *bp_data, int bp_len); |
| 92 | |
| 93 | /* Delete all breakpoints. */ |
| 94 | |
| 95 | void delete_all_breakpoints (void); |
| 96 | |
| 97 | /* Delete all breakpoints, but do not try to un-insert them from the |
| 98 | inferior. */ |
| 99 | |
| 100 | void free_all_breakpoints (struct process_info *proc); |
| 101 | |
| 102 | #endif /* MEM_BREAK_H */ |