gdb/testsuite/
[deliverable/binutils-gdb.git] / gdb / gdbcore.h
1 /* Machine independent variables that describe the core file under GDB.
2
3 Copyright (C) 1986-2013 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
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.
11
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.
16
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/>. */
19
20 /* Interface routines for core, executable, etc. */
21
22 #if !defined (GDBCORE_H)
23 #define GDBCORE_H 1
24
25 struct type;
26 struct regcache;
27
28 #include "bfd.h"
29 #include "exec.h"
30
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. */
34
35 extern char *get_exec_file (int err);
36
37 /* Nonzero if there is a core file. */
38
39 extern int have_core_file_p (void);
40
41 /* Report a memory error with error(). */
42
43 extern void memory_error (int status, CORE_ADDR memaddr);
44
45 /* Like target_read_memory, but report an error if can't read. */
46
47 extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
48
49 /* Like target_read_stack, but report an error if can't read. */
50
51 extern void read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
52
53 /* Read an integer from debugged memory, given address and number of
54 bytes. */
55
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);
61
62 /* Read an unsigned integer from debugged memory, given address and
63 number of bytes. */
64
65 extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
66 int len,
67 enum bfd_endian byte_order);
68
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
71 available space. */
72
73 extern void read_memory_string (CORE_ADDR, char *, int);
74
75 /* Read the pointer of type TYPE at ADDR, and return the address it
76 represents. */
77
78 CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type);
79
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,
83 etc. */
84
85 extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
86 ssize_t len);
87
88 /* Same as write_memory, but notify 'memory_changed' observers. */
89
90 extern void write_memory_with_notification (CORE_ADDR memaddr,
91 const bfd_byte *myaddr,
92 ssize_t len);
93
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,
97 ULONGEST value);
98
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,
102 LONGEST value);
103 \f
104 /* Hook for `exec_file_command' command to call. */
105
106 extern void (*deprecated_exec_file_display_hook) (char *filename);
107
108 /* Hook for "file_command", which is more useful than above
109 (because it is invoked AFTER symbols are read, not before). */
110
111 extern void (*deprecated_file_changed_hook) (char *filename);
112
113 extern void specify_exec_file_hook (void (*hook) (char *filename));
114
115 /* Binary File Diddler for the core file. */
116
117 extern bfd *core_bfd;
118
119 extern struct target_ops *core_target;
120
121 /* Whether to open exec and core files read-only or read-write. */
122
123 extern int write_files;
124
125 extern void core_file_command (char *filename, int from_tty);
126
127 extern void exec_file_attach (char *filename, int from_tty);
128
129 extern void exec_file_clear (int from_tty);
130
131 extern void validate_files (void);
132
133 /* The current default bfd target. */
134
135 extern char *gnutarget;
136
137 extern void set_gnutarget (char *);
138
139 /* Structure to keep track of core register reading functions for
140 various core file types. */
141
142 struct core_fns
143 {
144
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
148 flavour. */
149
150 enum bfd_flavour core_flavour;
151
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. */
158
159 int (*check_format) (bfd *);
160
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. */
164
165 int (*core_sniffer) (struct core_fns *, bfd *);
166
167 /* Extract the register values out of the core file and supply them
168 into REGCACHE.
169
170 CORE_REG_SECT points to the register values themselves, read into
171 memory.
172
173 CORE_REG_SIZE is the size of that area.
174
175 WHICH says which set of registers we are handling:
176 0 --- integer registers
177 2 --- floating-point registers, on machines where they are
178 discontiguous
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.)
182
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. */
187
188 void (*core_read_registers) (struct regcache *regcache,
189 char *core_reg_sect,
190 unsigned core_reg_size,
191 int which, CORE_ADDR reg_addr);
192
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
196 the global chain. */
197
198 struct core_fns *next;
199
200 };
201
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);
207
208 struct target_section *deprecated_core_resize_section_table (int num_added);
209
210 #endif /* !defined (GDBCORE_H) */
This page took 0.035198 seconds and 4 git commands to generate.