GDB (API)
|
00001 /* Machine independent variables that describe the core file under GDB. 00002 00003 Copyright (C) 1986-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 /* Interface routines for core, executable, etc. */ 00021 00022 #if !defined (GDBCORE_H) 00023 #define GDBCORE_H 1 00024 00025 struct type; 00026 struct regcache; 00027 00028 #include "bfd.h" 00029 #include "exec.h" 00030 #include "target.h" 00031 00032 /* Return the name of the executable file as a string. 00033 ERR nonzero means get error if there is none specified; 00034 otherwise return 0 in that case. */ 00035 00036 extern char *get_exec_file (int err); 00037 00038 /* Nonzero if there is a core file. */ 00039 00040 extern int have_core_file_p (void); 00041 00042 /* Report a memory error with error(). */ 00043 00044 extern void memory_error (enum target_xfer_error status, CORE_ADDR memaddr); 00045 00046 /* The string 'memory_error' would use as exception message. Space 00047 for the result is malloc'd, caller must free. */ 00048 00049 extern char *memory_error_message (enum target_xfer_error err, 00050 struct gdbarch *gdbarch, CORE_ADDR memaddr); 00051 00052 /* Like target_read_memory, but report an error if can't read. */ 00053 00054 extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len); 00055 00056 /* Like target_read_stack, but report an error if can't read. */ 00057 00058 extern void read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len); 00059 00060 /* Read an integer from debugged memory, given address and number of 00061 bytes. */ 00062 00063 extern LONGEST read_memory_integer (CORE_ADDR memaddr, 00064 int len, enum bfd_endian byte_order); 00065 extern int safe_read_memory_integer (CORE_ADDR memaddr, int len, 00066 enum bfd_endian byte_order, 00067 LONGEST *return_value); 00068 00069 /* Read an unsigned integer from debugged memory, given address and 00070 number of bytes. */ 00071 00072 extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr, 00073 int len, 00074 enum bfd_endian byte_order); 00075 00076 /* Read a null-terminated string from the debuggee's memory, given 00077 address, a buffer into which to place the string, and the maximum 00078 available space. */ 00079 00080 extern void read_memory_string (CORE_ADDR, char *, int); 00081 00082 /* Read the pointer of type TYPE at ADDR, and return the address it 00083 represents. */ 00084 00085 CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type); 00086 00087 /* This takes a char *, not void *. This is probably right, because 00088 passing in an int * or whatever is wrong with respect to 00089 byteswapping, alignment, different sizes for host vs. target types, 00090 etc. */ 00091 00092 extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, 00093 ssize_t len); 00094 00095 /* Same as write_memory, but notify 'memory_changed' observers. */ 00096 00097 extern void write_memory_with_notification (CORE_ADDR memaddr, 00098 const bfd_byte *myaddr, 00099 ssize_t len); 00100 00101 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */ 00102 extern void write_memory_unsigned_integer (CORE_ADDR addr, int len, 00103 enum bfd_endian byte_order, 00104 ULONGEST value); 00105 00106 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */ 00107 extern void write_memory_signed_integer (CORE_ADDR addr, int len, 00108 enum bfd_endian byte_order, 00109 LONGEST value); 00110 00111 /* Hook for `exec_file_command' command to call. */ 00112 00113 extern void (*deprecated_exec_file_display_hook) (char *filename); 00114 00115 /* Hook for "file_command", which is more useful than above 00116 (because it is invoked AFTER symbols are read, not before). */ 00117 00118 extern void (*deprecated_file_changed_hook) (char *filename); 00119 00120 extern void specify_exec_file_hook (void (*hook) (char *filename)); 00121 00122 /* Binary File Diddler for the core file. */ 00123 00124 extern bfd *core_bfd; 00125 00126 extern struct target_ops *core_target; 00127 00128 /* Whether to open exec and core files read-only or read-write. */ 00129 00130 extern int write_files; 00131 00132 extern void core_file_command (char *filename, int from_tty); 00133 00134 extern void exec_file_attach (char *filename, int from_tty); 00135 00136 extern void exec_file_clear (int from_tty); 00137 00138 extern void validate_files (void); 00139 00140 /* The current default bfd target. */ 00141 00142 extern char *gnutarget; 00143 00144 extern void set_gnutarget (char *); 00145 00146 /* Structure to keep track of core register reading functions for 00147 various core file types. */ 00148 00149 struct core_fns 00150 { 00151 00152 /* BFD flavour that a core file handler is prepared to read. This 00153 can be used by the handler's core tasting function as a first 00154 level filter to reject BFD's that don't have the right 00155 flavour. */ 00156 00157 enum bfd_flavour core_flavour; 00158 00159 /* Core file handler function to call to recognize corefile 00160 formats that BFD rejects. Some core file format just don't fit 00161 into the BFD model, or may require other resources to identify 00162 them, that simply aren't available to BFD (such as symbols from 00163 another file). Returns nonzero if the handler recognizes the 00164 format, zero otherwise. */ 00165 00166 int (*check_format) (bfd *); 00167 00168 /* Core file handler function to call to ask if it can handle a 00169 given core file format or not. Returns zero if it can't, 00170 nonzero otherwise. */ 00171 00172 int (*core_sniffer) (struct core_fns *, bfd *); 00173 00174 /* Extract the register values out of the core file and supply them 00175 into REGCACHE. 00176 00177 CORE_REG_SECT points to the register values themselves, read into 00178 memory. 00179 00180 CORE_REG_SIZE is the size of that area. 00181 00182 WHICH says which set of registers we are handling: 00183 0 --- integer registers 00184 2 --- floating-point registers, on machines where they are 00185 discontiguous 00186 3 --- extended floating-point registers, on machines where 00187 these are present in yet a third area. (GNU/Linux uses 00188 this to get at the SSE registers.) 00189 00190 REG_ADDR is the offset from u.u_ar0 to the register values relative to 00191 core_reg_sect. This is used with old-fashioned core files to locate the 00192 registers in a large upage-plus-stack ".reg" section. Original upage 00193 address X is at location core_reg_sect+x+reg_addr. */ 00194 00195 void (*core_read_registers) (struct regcache *regcache, 00196 char *core_reg_sect, 00197 unsigned core_reg_size, 00198 int which, CORE_ADDR reg_addr); 00199 00200 /* Finds the next struct core_fns. They are allocated and 00201 initialized in whatever module implements the functions pointed 00202 to; an initializer calls deprecated_add_core_fns to add them to 00203 the global chain. */ 00204 00205 struct core_fns *next; 00206 00207 }; 00208 00209 /* NOTE: cagney/2004-04-05: Replaced by "regset.h" and 00210 regset_from_core_section(). */ 00211 extern void deprecated_add_core_fns (struct core_fns *cf); 00212 extern int default_core_sniffer (struct core_fns *cf, bfd * abfd); 00213 extern int default_check_format (bfd * abfd); 00214 00215 struct target_section *deprecated_core_resize_section_table (int num_added); 00216 00217 #endif /* !defined (GDBCORE_H) */