Upgrade GDB from 7.4.1 to 7.6.1 on the vendor branch
[dragonfly.git] / contrib / gdb-7 / gdb / gdbcore.h
CommitLineData
5796c8dc
SS
1/* Machine independent variables that describe the core file under GDB.
2
ef5ccd6c 3 Copyright (C) 1986-2013 Free Software Foundation, Inc.
5796c8dc
SS
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
25struct type;
26struct regcache;
27
28#include "bfd.h"
cf7f2e2d 29#include "exec.h"
5796c8dc
SS
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
35extern char *get_exec_file (int err);
36
37/* Nonzero if there is a core file. */
38
39extern int have_core_file_p (void);
40
41/* Report a memory error with error(). */
42
43extern void memory_error (int status, CORE_ADDR memaddr);
44
45/* Like target_read_memory, but report an error if can't read. */
46
ef5ccd6c 47extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
5796c8dc
SS
48
49/* Like target_read_stack, but report an error if can't read. */
50
ef5ccd6c 51extern void read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
5796c8dc
SS
52
53/* Read an integer from debugged memory, given address and number of
54 bytes. */
55
56extern LONGEST read_memory_integer (CORE_ADDR memaddr,
57 int len, enum bfd_endian byte_order);
58extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
c50c785c
JM
59 enum bfd_endian byte_order,
60 LONGEST *return_value);
5796c8dc
SS
61
62/* Read an unsigned integer from debugged memory, given address and
63 number of bytes. */
64
65extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
c50c785c
JM
66 int len,
67 enum bfd_endian byte_order);
5796c8dc 68
c50c785c
JM
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. */
5796c8dc
SS
72
73extern void read_memory_string (CORE_ADDR, char *, int);
74
75/* Read the pointer of type TYPE at ADDR, and return the address it
c50c785c 76 represents. */
5796c8dc
SS
77
78CORE_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
ef5ccd6c
JM
85extern 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
90extern void write_memory_with_notification (CORE_ADDR memaddr,
91 const bfd_byte *myaddr,
92 ssize_t len);
5796c8dc
SS
93
94/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
95extern 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. */
100extern 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
106extern 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
111extern void (*deprecated_file_changed_hook) (char *filename);
112
113extern void specify_exec_file_hook (void (*hook) (char *filename));
114
cf7f2e2d 115/* Binary File Diddler for the core file. */
5796c8dc
SS
116
117extern bfd *core_bfd;
5796c8dc 118
c50c785c
JM
119extern struct target_ops *core_target;
120
5796c8dc
SS
121/* Whether to open exec and core files read-only or read-write. */
122
123extern int write_files;
124
125extern void core_file_command (char *filename, int from_tty);
126
127extern void exec_file_attach (char *filename, int from_tty);
128
129extern void exec_file_clear (int from_tty);
130
131extern void validate_files (void);
132
133/* The current default bfd target. */
134
135extern char *gnutarget;
136
137extern void set_gnutarget (char *);
138
139/* Structure to keep track of core register reading functions for
140 various core file types. */
141
142struct 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
c50c785c 148 flavour. */
5796c8dc
SS
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
c50c785c 157 format, zero otherwise. */
5796c8dc
SS
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,
c50c785c 163 nonzero otherwise. */
5796c8dc
SS
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
c50c785c 186 address X is at location core_reg_sect+x+reg_addr. */
5796c8dc
SS
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(). */
204extern void deprecated_add_core_fns (struct core_fns *cf);
205extern int default_core_sniffer (struct core_fns *cf, bfd * abfd);
206extern int default_check_format (bfd * abfd);
207
208struct target_section *deprecated_core_resize_section_table (int num_added);
209
210#endif /* !defined (GDBCORE_H) */