gdb/rs6000: Read backchain as unsigned.
[deliverable/binutils-gdb.git] / gdb / gdbcore.h
1 /* Machine independent variables that describe the core file under GDB.
2
3 Copyright (C) 1986-2016 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 #include "target.h"
31
32 /* Return the name of the executable file as a string.
33 ERR nonzero means get error if there is none specified;
34 otherwise return 0 in that case. */
35
36 extern char *get_exec_file (int err);
37
38 /* Nonzero if there is a core file. */
39
40 extern int have_core_file_p (void);
41
42 /* Report a memory error with error(). */
43
44 extern void memory_error (enum target_xfer_status status, CORE_ADDR memaddr);
45
46 /* The string 'memory_error' would use as exception message. Space
47 for the result is malloc'd, caller must free. */
48
49 extern char *memory_error_message (enum target_xfer_status err,
50 struct gdbarch *gdbarch, CORE_ADDR memaddr);
51
52 /* Like target_read_memory, but report an error if can't read. */
53
54 extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
55
56 /* Like target_read_stack, but report an error if can't read. */
57
58 extern void read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
59
60 /* Like target_read_code, but report an error if can't read. */
61
62 extern void read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
63
64 /* Read an integer from debugged memory, given address and number of
65 bytes. */
66
67 extern LONGEST read_memory_integer (CORE_ADDR memaddr,
68 int len, enum bfd_endian byte_order);
69 extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
70 enum bfd_endian byte_order,
71 LONGEST *return_value);
72
73 /* Read an unsigned integer from debugged memory, given address and
74 number of bytes. */
75
76 extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
77 int len,
78 enum bfd_endian byte_order);
79 extern int safe_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
80 enum bfd_endian byte_order,
81 ULONGEST *return_value);
82
83 /* Read an integer from debugged code memory, given address,
84 number of bytes, and byte order for code. */
85
86 extern LONGEST read_code_integer (CORE_ADDR memaddr, int len,
87 enum bfd_endian byte_order);
88
89 /* Read an unsigned integer from debugged code memory, given address,
90 number of bytes, and byte order for code. */
91
92 extern ULONGEST read_code_unsigned_integer (CORE_ADDR memaddr,
93 int len,
94 enum bfd_endian byte_order);
95
96 /* Read a null-terminated string from the debuggee's memory, given
97 address, a buffer into which to place the string, and the maximum
98 available space. */
99
100 extern void read_memory_string (CORE_ADDR, char *, int);
101
102 /* Read the pointer of type TYPE at ADDR, and return the address it
103 represents. */
104
105 CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type);
106
107 /* Same as target_write_memory, but report an error if can't
108 write. */
109
110 extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
111 ssize_t len);
112
113 /* Same as write_memory, but notify 'memory_changed' observers. */
114
115 extern void write_memory_with_notification (CORE_ADDR memaddr,
116 const bfd_byte *myaddr,
117 ssize_t len);
118
119 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
120 extern void write_memory_unsigned_integer (CORE_ADDR addr, int len,
121 enum bfd_endian byte_order,
122 ULONGEST value);
123
124 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
125 extern void write_memory_signed_integer (CORE_ADDR addr, int len,
126 enum bfd_endian byte_order,
127 LONGEST value);
128 \f
129 /* Hook for `exec_file_command' command to call. */
130
131 extern void (*deprecated_exec_file_display_hook) (const char *filename);
132
133 /* Hook for "file_command", which is more useful than above
134 (because it is invoked AFTER symbols are read, not before). */
135
136 extern void (*deprecated_file_changed_hook) (char *filename);
137
138 extern void specify_exec_file_hook (void (*hook) (const char *filename));
139
140 /* Binary File Diddler for the core file. */
141
142 extern bfd *core_bfd;
143
144 extern struct target_ops *core_target;
145
146 /* Whether to open exec and core files read-only or read-write. */
147
148 extern int write_files;
149
150 extern void core_file_command (char *filename, int from_tty);
151
152 extern void exec_file_attach (const char *filename, int from_tty);
153
154 /* If the filename of the main executable is unknown, attempt to
155 determine it. If a filename is determined, proceed as though
156 it was just specified with the "file" command. Do nothing if
157 the filename of the main executable is already known. */
158
159 extern void exec_file_locate_attach (int pid, int from_tty);
160
161 extern void exec_file_clear (int from_tty);
162
163 extern void validate_files (void);
164
165 /* The current default bfd target. */
166
167 extern char *gnutarget;
168
169 extern void set_gnutarget (char *);
170
171 /* Structure to keep track of core register reading functions for
172 various core file types. */
173
174 struct core_fns
175 {
176
177 /* BFD flavour that a core file handler is prepared to read. This
178 can be used by the handler's core tasting function as a first
179 level filter to reject BFD's that don't have the right
180 flavour. */
181
182 enum bfd_flavour core_flavour;
183
184 /* Core file handler function to call to recognize corefile
185 formats that BFD rejects. Some core file format just don't fit
186 into the BFD model, or may require other resources to identify
187 them, that simply aren't available to BFD (such as symbols from
188 another file). Returns nonzero if the handler recognizes the
189 format, zero otherwise. */
190
191 int (*check_format) (bfd *);
192
193 /* Core file handler function to call to ask if it can handle a
194 given core file format or not. Returns zero if it can't,
195 nonzero otherwise. */
196
197 int (*core_sniffer) (struct core_fns *, bfd *);
198
199 /* Extract the register values out of the core file and supply them
200 into REGCACHE.
201
202 CORE_REG_SECT points to the register values themselves, read into
203 memory.
204
205 CORE_REG_SIZE is the size of that area.
206
207 WHICH says which set of registers we are handling:
208 0 --- integer registers
209 2 --- floating-point registers, on machines where they are
210 discontiguous
211 3 --- extended floating-point registers, on machines where
212 these are present in yet a third area. (GNU/Linux uses
213 this to get at the SSE registers.)
214
215 REG_ADDR is the offset from u.u_ar0 to the register values relative to
216 core_reg_sect. This is used with old-fashioned core files to locate the
217 registers in a large upage-plus-stack ".reg" section. Original upage
218 address X is at location core_reg_sect+x+reg_addr. */
219
220 void (*core_read_registers) (struct regcache *regcache,
221 char *core_reg_sect,
222 unsigned core_reg_size,
223 int which, CORE_ADDR reg_addr);
224
225 /* Finds the next struct core_fns. They are allocated and
226 initialized in whatever module implements the functions pointed
227 to; an initializer calls deprecated_add_core_fns to add them to
228 the global chain. */
229
230 struct core_fns *next;
231
232 };
233
234 /* NOTE: cagney/2004-04-05: Replaced by "regset.h" and
235 regset_from_core_section(). */
236 extern void deprecated_add_core_fns (struct core_fns *cf);
237 extern int default_core_sniffer (struct core_fns *cf, bfd * abfd);
238 extern int default_check_format (bfd * abfd);
239
240 #endif /* !defined (GDBCORE_H) */
This page took 0.042041 seconds and 5 git commands to generate.