PR ld/21334: Always call `_bfd_elf_link_renumber_dynsyms' if required
[deliverable/binutils-gdb.git] / gdb / gdbcore.h
CommitLineData
c906108c 1/* Machine independent variables that describe the core file under GDB.
00e32a35 2
61baf725 3 Copyright (C) 1986-2017 Free Software Foundation, Inc.
c906108c 4
c5aa993b 5 This file is part of GDB.
c906108c 6
c5aa993b
JM
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
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
c5aa993b 10 (at your option) any later version.
c906108c 11
c5aa993b
JM
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.
c906108c 16
c5aa993b 17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
19
20/* Interface routines for core, executable, etc. */
21
22#if !defined (GDBCORE_H)
23#define GDBCORE_H 1
24
da3331ec 25struct type;
9eefc95f 26struct regcache;
da3331ec 27
c906108c 28#include "bfd.h"
6c95b8df 29#include "exec.h"
578d3588 30#include "target.h"
c906108c
SS
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
a14ed312 36extern char *get_exec_file (int err);
c906108c
SS
37
38/* Nonzero if there is a core file. */
39
a14ed312 40extern int have_core_file_p (void);
c906108c 41
c906108c
SS
42/* Report a memory error with error(). */
43
9b409511 44extern void memory_error (enum target_xfer_status status, CORE_ADDR memaddr);
578d3588
PA
45
46/* The string 'memory_error' would use as exception message. Space
47 for the result is malloc'd, caller must free. */
48
9b409511 49extern char *memory_error_message (enum target_xfer_status err,
578d3588 50 struct gdbarch *gdbarch, CORE_ADDR memaddr);
c906108c
SS
51
52/* Like target_read_memory, but report an error if can't read. */
53
45aa4659 54extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
c906108c 55
4e5d721f
DE
56/* Like target_read_stack, but report an error if can't read. */
57
45aa4659 58extern void read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
4e5d721f 59
0865b04a
YQ
60/* Like target_read_code, but report an error if can't read. */
61
62extern void read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
63
c906108c
SS
64/* Read an integer from debugged memory, given address and number of
65 bytes. */
66
e17a4113
UW
67extern LONGEST read_memory_integer (CORE_ADDR memaddr,
68 int len, enum bfd_endian byte_order);
69extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
3e43a32a
MS
70 enum bfd_endian byte_order,
71 LONGEST *return_value);
c906108c
SS
72
73/* Read an unsigned integer from debugged memory, given address and
74 number of bytes. */
75
e17a4113 76extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
3e43a32a
MS
77 int len,
78 enum bfd_endian byte_order);
cc2c4da8
MK
79extern int safe_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
80 enum bfd_endian byte_order,
81 ULONGEST *return_value);
c906108c 82
0865b04a
YQ
83/* Read an integer from debugged code memory, given address,
84 number of bytes, and byte order for code. */
85
86extern 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
92extern ULONGEST read_code_unsigned_integer (CORE_ADDR memaddr,
93 int len,
94 enum bfd_endian byte_order);
95
0963b4bd
MS
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. */
0d540cdf 99
a14ed312 100extern void read_memory_string (CORE_ADDR, char *, int);
c906108c 101
0d540cdf 102/* Read the pointer of type TYPE at ADDR, and return the address it
0963b4bd 103 represents. */
0d540cdf 104
570b8f7c 105CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type);
0d540cdf 106
cb6f16cf
SM
107/* Same as target_write_memory, but report an error if can't
108 write. */
c906108c 109
45aa4659
JK
110extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
111 ssize_t len);
c906108c 112
972daa01
YQ
113/* Same as write_memory, but notify 'memory_changed' observers. */
114
115extern void write_memory_with_notification (CORE_ADDR memaddr,
116 const bfd_byte *myaddr,
117 ssize_t len);
118
c26e4683
JB
119/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
120extern void write_memory_unsigned_integer (CORE_ADDR addr, int len,
e17a4113
UW
121 enum bfd_endian byte_order,
122 ULONGEST value);
c26e4683
JB
123
124/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
125extern void write_memory_signed_integer (CORE_ADDR addr, int len,
e17a4113 126 enum bfd_endian byte_order,
c26e4683 127 LONGEST value);
c906108c
SS
128\f
129/* Hook for `exec_file_command' command to call. */
130
5f08566b 131extern void (*deprecated_exec_file_display_hook) (const char *filename);
c906108c
SS
132
133/* Hook for "file_command", which is more useful than above
3a9a986f 134 (because it is invoked AFTER symbols are read, not before). */
c906108c 135
9a4105ab 136extern void (*deprecated_file_changed_hook) (char *filename);
c906108c 137
5f08566b 138extern void specify_exec_file_hook (void (*hook) (const char *filename));
c906108c 139
6c95b8df 140/* Binary File Diddler for the core file. */
c906108c
SS
141
142extern bfd *core_bfd;
c04ea773 143
c0edd9ed
JK
144extern struct target_ops *core_target;
145
c906108c
SS
146/* Whether to open exec and core files read-only or read-write. */
147
148extern int write_files;
149
a14ed312 150extern void core_file_command (char *filename, int from_tty);
c906108c 151
5f08566b 152extern void exec_file_attach (const char *filename, int from_tty);
c906108c 153
a10de604
GB
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
bb805577
JK
157 the filename of the main executable is already known.
158 DEFER_BP_RESET uses SYMFILE_DEFER_BP_RESET for the main symbol file. */
a10de604 159
bb805577 160extern void exec_file_locate_attach (int pid, int defer_bp_reset, int from_tty);
a10de604 161
1adeb98a 162extern void exec_file_clear (int from_tty);
c906108c 163
a14ed312 164extern void validate_files (void);
c906108c 165
c906108c
SS
166/* The current default bfd target. */
167
168extern char *gnutarget;
169
a121b7c1 170extern void set_gnutarget (const char *);
c906108c
SS
171
172/* Structure to keep track of core register reading functions for
173 various core file types. */
174
c5aa993b
JM
175struct core_fns
176 {
c906108c 177
2acceee2
JM
178 /* BFD flavour that a core file handler is prepared to read. This
179 can be used by the handler's core tasting function as a first
180 level filter to reject BFD's that don't have the right
0963b4bd 181 flavour. */
c906108c 182
c5aa993b 183 enum bfd_flavour core_flavour;
c906108c 184
2acceee2
JM
185 /* Core file handler function to call to recognize corefile
186 formats that BFD rejects. Some core file format just don't fit
187 into the BFD model, or may require other resources to identify
188 them, that simply aren't available to BFD (such as symbols from
189 another file). Returns nonzero if the handler recognizes the
0963b4bd 190 format, zero otherwise. */
2acceee2 191
507f3c78 192 int (*check_format) (bfd *);
2acceee2
JM
193
194 /* Core file handler function to call to ask if it can handle a
195 given core file format or not. Returns zero if it can't,
0963b4bd 196 nonzero otherwise. */
2acceee2 197
507f3c78 198 int (*core_sniffer) (struct core_fns *, bfd *);
2acceee2 199
9eefc95f
UW
200 /* Extract the register values out of the core file and supply them
201 into REGCACHE.
c906108c 202
c5aa993b
JM
203 CORE_REG_SECT points to the register values themselves, read into
204 memory.
c906108c 205
c5aa993b 206 CORE_REG_SIZE is the size of that area.
c906108c 207
de57eccd
JM
208 WHICH says which set of registers we are handling:
209 0 --- integer registers
210 2 --- floating-point registers, on machines where they are
211 discontiguous
212 3 --- extended floating-point registers, on machines where
213 these are present in yet a third area. (GNU/Linux uses
214 this to get at the SSE registers.)
c906108c 215
c5aa993b
JM
216 REG_ADDR is the offset from u.u_ar0 to the register values relative to
217 core_reg_sect. This is used with old-fashioned core files to locate the
218 registers in a large upage-plus-stack ".reg" section. Original upage
0963b4bd 219 address X is at location core_reg_sect+x+reg_addr. */
c906108c 220
9eefc95f
UW
221 void (*core_read_registers) (struct regcache *regcache,
222 char *core_reg_sect,
507f3c78
KB
223 unsigned core_reg_size,
224 int which, CORE_ADDR reg_addr);
c906108c 225
00e32a35
AC
226 /* Finds the next struct core_fns. They are allocated and
227 initialized in whatever module implements the functions pointed
228 to; an initializer calls deprecated_add_core_fns to add them to
229 the global chain. */
c906108c 230
c5aa993b 231 struct core_fns *next;
c906108c 232
c5aa993b 233 };
c906108c 234
00e32a35
AC
235/* NOTE: cagney/2004-04-05: Replaced by "regset.h" and
236 regset_from_core_section(). */
237extern void deprecated_add_core_fns (struct core_fns *cf);
a14ed312
KB
238extern int default_core_sniffer (struct core_fns *cf, bfd * abfd);
239extern int default_check_format (bfd * abfd);
c906108c 240
c5aa993b 241#endif /* !defined (GDBCORE_H) */
This page took 1.341119 seconds and 4 git commands to generate.