1 /* Machine independent variables that describe the core file under GDB.
3 Copyright (C) 1986-2013 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* Interface routines for core, executable, etc. */
22 #if !defined (GDBCORE_H)
31 /* Return the name of the executable file as a string.
32 ERR nonzero means get error if there is none specified;
33 otherwise return 0 in that case. */
35 extern char *get_exec_file (int err
);
37 /* Nonzero if there is a core file. */
39 extern int have_core_file_p (void);
41 /* Report a memory error with error(). */
43 extern void memory_error (int status
, CORE_ADDR memaddr
);
45 /* Like target_read_memory, but report an error if can't read. */
47 extern void read_memory (CORE_ADDR memaddr
, gdb_byte
*myaddr
, ssize_t len
);
49 /* Like target_read_stack, but report an error if can't read. */
51 extern void read_stack (CORE_ADDR memaddr
, gdb_byte
*myaddr
, ssize_t len
);
53 /* Read an integer from debugged memory, given address and number of
56 extern LONGEST
read_memory_integer (CORE_ADDR memaddr
,
57 int len
, enum bfd_endian byte_order
);
58 extern int safe_read_memory_integer (CORE_ADDR memaddr
, int len
,
59 enum bfd_endian byte_order
,
60 LONGEST
*return_value
);
62 /* Read an unsigned integer from debugged memory, given address and
65 extern ULONGEST
read_memory_unsigned_integer (CORE_ADDR memaddr
,
67 enum bfd_endian byte_order
);
69 /* Read a null-terminated string from the debuggee's memory, given
70 address, a buffer into which to place the string, and the maximum
73 extern void read_memory_string (CORE_ADDR
, char *, int);
75 /* Read the pointer of type TYPE at ADDR, and return the address it
78 CORE_ADDR
read_memory_typed_address (CORE_ADDR addr
, struct type
*type
);
80 /* This takes a char *, not void *. This is probably right, because
81 passing in an int * or whatever is wrong with respect to
82 byteswapping, alignment, different sizes for host vs. target types,
85 extern void write_memory (CORE_ADDR memaddr
, const gdb_byte
*myaddr
,
88 /* Same as write_memory, but notify 'memory_changed' observers. */
90 extern void write_memory_with_notification (CORE_ADDR memaddr
,
91 const bfd_byte
*myaddr
,
94 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
95 extern void write_memory_unsigned_integer (CORE_ADDR addr
, int len
,
96 enum bfd_endian byte_order
,
99 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
100 extern void write_memory_signed_integer (CORE_ADDR addr
, int len
,
101 enum bfd_endian byte_order
,
104 /* Hook for `exec_file_command' command to call. */
106 extern void (*deprecated_exec_file_display_hook
) (char *filename
);
108 /* Hook for "file_command", which is more useful than above
109 (because it is invoked AFTER symbols are read, not before). */
111 extern void (*deprecated_file_changed_hook
) (char *filename
);
113 extern void specify_exec_file_hook (void (*hook
) (char *filename
));
115 /* Binary File Diddler for the core file. */
117 extern bfd
*core_bfd
;
119 extern struct target_ops
*core_target
;
121 /* Whether to open exec and core files read-only or read-write. */
123 extern int write_files
;
125 extern void core_file_command (char *filename
, int from_tty
);
127 extern void exec_file_attach (char *filename
, int from_tty
);
129 extern void exec_file_clear (int from_tty
);
131 extern void validate_files (void);
133 /* The current default bfd target. */
135 extern char *gnutarget
;
137 extern void set_gnutarget (char *);
139 /* Structure to keep track of core register reading functions for
140 various core file types. */
145 /* BFD flavour that a core file handler is prepared to read. This
146 can be used by the handler's core tasting function as a first
147 level filter to reject BFD's that don't have the right
150 enum bfd_flavour core_flavour
;
152 /* Core file handler function to call to recognize corefile
153 formats that BFD rejects. Some core file format just don't fit
154 into the BFD model, or may require other resources to identify
155 them, that simply aren't available to BFD (such as symbols from
156 another file). Returns nonzero if the handler recognizes the
157 format, zero otherwise. */
159 int (*check_format
) (bfd
*);
161 /* Core file handler function to call to ask if it can handle a
162 given core file format or not. Returns zero if it can't,
163 nonzero otherwise. */
165 int (*core_sniffer
) (struct core_fns
*, bfd
*);
167 /* Extract the register values out of the core file and supply them
170 CORE_REG_SECT points to the register values themselves, read into
173 CORE_REG_SIZE is the size of that area.
175 WHICH says which set of registers we are handling:
176 0 --- integer registers
177 2 --- floating-point registers, on machines where they are
179 3 --- extended floating-point registers, on machines where
180 these are present in yet a third area. (GNU/Linux uses
181 this to get at the SSE registers.)
183 REG_ADDR is the offset from u.u_ar0 to the register values relative to
184 core_reg_sect. This is used with old-fashioned core files to locate the
185 registers in a large upage-plus-stack ".reg" section. Original upage
186 address X is at location core_reg_sect+x+reg_addr. */
188 void (*core_read_registers
) (struct regcache
*regcache
,
190 unsigned core_reg_size
,
191 int which
, CORE_ADDR reg_addr
);
193 /* Finds the next struct core_fns. They are allocated and
194 initialized in whatever module implements the functions pointed
195 to; an initializer calls deprecated_add_core_fns to add them to
198 struct core_fns
*next
;
202 /* NOTE: cagney/2004-04-05: Replaced by "regset.h" and
203 regset_from_core_section(). */
204 extern void deprecated_add_core_fns (struct core_fns
*cf
);
205 extern int default_core_sniffer (struct core_fns
*cf
, bfd
* abfd
);
206 extern int default_check_format (bfd
* abfd
);
208 struct target_section
*deprecated_core_resize_section_table (int num_added
);
210 #endif /* !defined (GDBCORE_H) */