Invalidate target cache before starting to handle event.
[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 #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_error 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_error 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 /* Read an integer from debugged memory, given address and number of
61 bytes. */
62
63 extern LONGEST read_memory_integer (CORE_ADDR memaddr,
64 int len, enum bfd_endian byte_order);
65 extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
66 enum bfd_endian byte_order,
67 LONGEST *return_value);
68
69 /* Read an unsigned integer from debugged memory, given address and
70 number of bytes. */
71
72 extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
73 int len,
74 enum bfd_endian byte_order);
75
76 /* Read a null-terminated string from the debuggee's memory, given
77 address, a buffer into which to place the string, and the maximum
78 available space. */
79
80 extern void read_memory_string (CORE_ADDR, char *, int);
81
82 /* Read the pointer of type TYPE at ADDR, and return the address it
83 represents. */
84
85 CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type);
86
87 /* This takes a char *, not void *. This is probably right, because
88 passing in an int * or whatever is wrong with respect to
89 byteswapping, alignment, different sizes for host vs. target types,
90 etc. */
91
92 extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
93 ssize_t len);
94
95 /* Same as write_memory, but notify 'memory_changed' observers. */
96
97 extern void write_memory_with_notification (CORE_ADDR memaddr,
98 const bfd_byte *myaddr,
99 ssize_t len);
100
101 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
102 extern void write_memory_unsigned_integer (CORE_ADDR addr, int len,
103 enum bfd_endian byte_order,
104 ULONGEST value);
105
106 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
107 extern void write_memory_signed_integer (CORE_ADDR addr, int len,
108 enum bfd_endian byte_order,
109 LONGEST value);
110 \f
111 /* Hook for `exec_file_command' command to call. */
112
113 extern void (*deprecated_exec_file_display_hook) (char *filename);
114
115 /* Hook for "file_command", which is more useful than above
116 (because it is invoked AFTER symbols are read, not before). */
117
118 extern void (*deprecated_file_changed_hook) (char *filename);
119
120 extern void specify_exec_file_hook (void (*hook) (char *filename));
121
122 /* Binary File Diddler for the core file. */
123
124 extern bfd *core_bfd;
125
126 extern struct target_ops *core_target;
127
128 /* Whether to open exec and core files read-only or read-write. */
129
130 extern int write_files;
131
132 extern void core_file_command (char *filename, int from_tty);
133
134 extern void exec_file_attach (char *filename, int from_tty);
135
136 extern void exec_file_clear (int from_tty);
137
138 extern void validate_files (void);
139
140 /* The current default bfd target. */
141
142 extern char *gnutarget;
143
144 extern void set_gnutarget (char *);
145
146 /* Structure to keep track of core register reading functions for
147 various core file types. */
148
149 struct core_fns
150 {
151
152 /* BFD flavour that a core file handler is prepared to read. This
153 can be used by the handler's core tasting function as a first
154 level filter to reject BFD's that don't have the right
155 flavour. */
156
157 enum bfd_flavour core_flavour;
158
159 /* Core file handler function to call to recognize corefile
160 formats that BFD rejects. Some core file format just don't fit
161 into the BFD model, or may require other resources to identify
162 them, that simply aren't available to BFD (such as symbols from
163 another file). Returns nonzero if the handler recognizes the
164 format, zero otherwise. */
165
166 int (*check_format) (bfd *);
167
168 /* Core file handler function to call to ask if it can handle a
169 given core file format or not. Returns zero if it can't,
170 nonzero otherwise. */
171
172 int (*core_sniffer) (struct core_fns *, bfd *);
173
174 /* Extract the register values out of the core file and supply them
175 into REGCACHE.
176
177 CORE_REG_SECT points to the register values themselves, read into
178 memory.
179
180 CORE_REG_SIZE is the size of that area.
181
182 WHICH says which set of registers we are handling:
183 0 --- integer registers
184 2 --- floating-point registers, on machines where they are
185 discontiguous
186 3 --- extended floating-point registers, on machines where
187 these are present in yet a third area. (GNU/Linux uses
188 this to get at the SSE registers.)
189
190 REG_ADDR is the offset from u.u_ar0 to the register values relative to
191 core_reg_sect. This is used with old-fashioned core files to locate the
192 registers in a large upage-plus-stack ".reg" section. Original upage
193 address X is at location core_reg_sect+x+reg_addr. */
194
195 void (*core_read_registers) (struct regcache *regcache,
196 char *core_reg_sect,
197 unsigned core_reg_size,
198 int which, CORE_ADDR reg_addr);
199
200 /* Finds the next struct core_fns. They are allocated and
201 initialized in whatever module implements the functions pointed
202 to; an initializer calls deprecated_add_core_fns to add them to
203 the global chain. */
204
205 struct core_fns *next;
206
207 };
208
209 /* NOTE: cagney/2004-04-05: Replaced by "regset.h" and
210 regset_from_core_section(). */
211 extern void deprecated_add_core_fns (struct core_fns *cf);
212 extern int default_core_sniffer (struct core_fns *cf, bfd * abfd);
213 extern int default_check_format (bfd * abfd);
214
215 struct target_section *deprecated_core_resize_section_table (int num_added);
216
217 #endif /* !defined (GDBCORE_H) */
This page took 0.035665 seconds and 5 git commands to generate.