GDBserver
/home/stan/gdb/src/gdb/gdbserver/mem-break.h
Go to the documentation of this file.
00001 /* Memory breakpoint interfaces for the remote server for GDB.
00002    Copyright (C) 2002-2013 Free Software Foundation, Inc.
00003 
00004    Contributed by MontaVista Software.
00005 
00006    This file is part of GDB.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 3 of the License, or
00011    (at your option) any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00020 
00021 #ifndef MEM_BREAK_H
00022 #define MEM_BREAK_H
00023 
00024 /* Breakpoints are opaque.  */
00025 struct breakpoint;
00026 struct fast_tracepoint_jump;
00027 
00028 /* Locate a breakpoint placed at address WHERE and return a pointer
00029    to its structure.  */
00030 
00031 struct breakpoint *find_gdb_breakpoint_at (CORE_ADDR where);
00032 
00033 /* Create a new GDB breakpoint at WHERE.  Returns -1 if breakpoints
00034    are not supported on this target, 0 otherwise.  */
00035 
00036 int set_gdb_breakpoint_at (CORE_ADDR where);
00037 
00038 /* Returns TRUE if there's any breakpoint at ADDR in our tables,
00039    inserted, or not.  */
00040 
00041 int breakpoint_here (CORE_ADDR addr);
00042 
00043 /* Returns TRUE if there's any inserted breakpoint set at ADDR.  */
00044 
00045 int breakpoint_inserted_here (CORE_ADDR addr);
00046 
00047 /* Clear all breakpoint conditions associated with this address.  */
00048 
00049 void clear_gdb_breakpoint_conditions (CORE_ADDR addr);
00050 
00051 /* Set target-side condition CONDITION to the breakpoint at ADDR.  */
00052 
00053 int add_breakpoint_condition (CORE_ADDR addr, char **condition);
00054 
00055 int add_breakpoint_commands (CORE_ADDR addr, char **commands, int persist);
00056 
00057 int any_persistent_commands (void);
00058 
00059 /* Evaluation condition (if any) at breakpoint BP.  Return 1 if
00060    true and 0 otherwise.  */
00061 
00062 int gdb_condition_true_at_breakpoint (CORE_ADDR where);
00063 
00064 int gdb_no_commands_at_breakpoint (CORE_ADDR where);
00065 
00066 void run_breakpoint_commands (CORE_ADDR where);
00067 
00068 /* Returns TRUE if there's a GDB breakpoint set at ADDR.  */
00069 
00070 int gdb_breakpoint_here (CORE_ADDR where);
00071 
00072 /* Create a new breakpoint at WHERE, and call HANDLER when
00073    it is hit.  HANDLER should return 1 if the breakpoint
00074    should be deleted, 0 otherwise.  */
00075 
00076 struct breakpoint *set_breakpoint_at (CORE_ADDR where,
00077                                       int (*handler) (CORE_ADDR));
00078 
00079 /* Delete a GDB breakpoint previously inserted at ADDR with
00080    set_gdb_breakpoint_at.  */
00081 
00082 int delete_gdb_breakpoint_at (CORE_ADDR addr);
00083 
00084 /* Delete a breakpoint.  */
00085 
00086 int delete_breakpoint (struct breakpoint *bkpt);
00087 
00088 /* Set a reinsert breakpoint at STOP_AT.  */
00089 
00090 void set_reinsert_breakpoint (CORE_ADDR stop_at);
00091 
00092 /* Delete all reinsert breakpoints.  */
00093 
00094 void delete_reinsert_breakpoints (void);
00095 
00096 /* Reinsert breakpoints at WHERE (and change their status to
00097    inserted).  */
00098 
00099 void reinsert_breakpoints_at (CORE_ADDR where);
00100 
00101 /* Uninsert breakpoints at WHERE (and change their status to
00102    uninserted).  This still leaves the breakpoints in the table.  */
00103 
00104 void uninsert_breakpoints_at (CORE_ADDR where);
00105 
00106 /* Reinsert all breakpoints of the current process (and change their
00107    status to inserted).  */
00108 
00109 void reinsert_all_breakpoints (void);
00110 
00111 /* Uninsert all breakpoints of the current process (and change their
00112    status to uninserted).  This still leaves the breakpoints in the
00113    table.  */
00114 
00115 void uninsert_all_breakpoints (void);
00116 
00117 /* See if any breakpoint claims ownership of STOP_PC.  Call the handler for
00118    the breakpoint, if found.  */
00119 
00120 void check_breakpoints (CORE_ADDR stop_pc);
00121 
00122 /* See if any breakpoints shadow the target memory area from MEM_ADDR
00123    to MEM_ADDR + MEM_LEN.  Update the data already read from the target
00124    (in BUF) if necessary.  */
00125 
00126 void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
00127 
00128 /* See if any breakpoints shadow the target memory area from MEM_ADDR
00129    to MEM_ADDR + MEM_LEN.  Update the data to be written to the target
00130    (in BUF, a copy of MYADDR on entry) if necessary, as well as the
00131    original data for any breakpoints.  */
00132 
00133 void check_mem_write (CORE_ADDR mem_addr,
00134                       unsigned char *buf, const unsigned char *myaddr, int mem_len);
00135 
00136 /* Set the byte pattern to insert for memory breakpoints.  This function
00137    must be called before any breakpoints are set.  */
00138 
00139 void set_breakpoint_data (const unsigned char *bp_data, int bp_len);
00140 
00141 /* Delete all breakpoints.  */
00142 
00143 void delete_all_breakpoints (void);
00144 
00145 /* Clear the "inserted" flag in all breakpoints of PROC.  */
00146 
00147 void mark_breakpoints_out (struct process_info *proc);
00148 
00149 /* Delete all breakpoints, but do not try to un-insert them from the
00150    inferior.  */
00151 
00152 void free_all_breakpoints (struct process_info *proc);
00153 
00154 /* Check if breakpoints still seem to be inserted in the inferior.  */
00155 
00156 void validate_breakpoints (void);
00157 
00158 /* Insert a fast tracepoint jump at WHERE, using instruction INSN, of
00159    LENGTH bytes.  */
00160 
00161 struct fast_tracepoint_jump *set_fast_tracepoint_jump (CORE_ADDR where,
00162                                                        unsigned char *insn,
00163                                                        ULONGEST length);
00164 
00165 /* Increment reference counter of JP.  */
00166 void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp);
00167 
00168 /* Delete fast tracepoint jump TODEL from our tables, and uninsert if
00169    from memory.  */
00170 
00171 int delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel);
00172 
00173 /* Returns true if there's fast tracepoint jump set at WHERE.  */
00174 
00175 int fast_tracepoint_jump_here (CORE_ADDR);
00176 
00177 /* Uninsert fast tracepoint jumps at WHERE (and change their status to
00178    uninserted).  This still leaves the tracepoints in the table.  */
00179 
00180 void uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc);
00181 
00182 /* Reinsert fast tracepoint jumps at WHERE (and change their status to
00183    inserted).  */
00184 
00185 void reinsert_fast_tracepoint_jumps_at (CORE_ADDR where);
00186 
00187 #endif /* MEM_BREAK_H */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines