gdb: defer commit resume until all available events are consumed
[deliverable/binutils-gdb.git] / gdb / gdbcore.h
1 /* Machine independent variables that describe the core file under GDB.
2
3 Copyright (C) 1986-2020 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 /* Nonzero if there is a core file. */
33
34 extern int have_core_file_p (void);
35
36 /* Report a memory error with error(). */
37
38 extern void memory_error (enum target_xfer_status status, CORE_ADDR memaddr);
39
40 /* The string 'memory_error' would use as exception message. */
41
42 extern std::string memory_error_message (enum target_xfer_status err,
43 struct gdbarch *gdbarch,
44 CORE_ADDR memaddr);
45
46 /* Like target_read_memory, but report an error if can't read. */
47
48 extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
49
50 /* Like target_read_stack, but report an error if can't read. */
51
52 extern void read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
53
54 /* Like target_read_code, but report an error if can't read. */
55
56 extern void read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
57
58 /* Read an integer from debugged memory, given address and number of
59 bytes. */
60
61 extern LONGEST read_memory_integer (CORE_ADDR memaddr,
62 int len, enum bfd_endian byte_order);
63 extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
64 enum bfd_endian byte_order,
65 LONGEST *return_value);
66
67 /* Read an unsigned integer from debugged memory, given address and
68 number of bytes. */
69
70 extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
71 int len,
72 enum bfd_endian byte_order);
73 extern int safe_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
74 enum bfd_endian byte_order,
75 ULONGEST *return_value);
76
77 /* Read an integer from debugged code memory, given address,
78 number of bytes, and byte order for code. */
79
80 extern LONGEST read_code_integer (CORE_ADDR memaddr, int len,
81 enum bfd_endian byte_order);
82
83 /* Read an unsigned integer from debugged code memory, given address,
84 number of bytes, and byte order for code. */
85
86 extern ULONGEST read_code_unsigned_integer (CORE_ADDR memaddr,
87 int len,
88 enum bfd_endian byte_order);
89
90 /* Read the pointer of type TYPE at ADDR, and return the address it
91 represents. */
92
93 CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type);
94
95 /* Same as target_write_memory, but report an error if can't
96 write. */
97
98 extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
99 ssize_t len);
100
101 /* Same as write_memory, but notify 'memory_changed' observers. */
102
103 extern void write_memory_with_notification (CORE_ADDR memaddr,
104 const bfd_byte *myaddr,
105 ssize_t len);
106
107 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
108 extern void write_memory_unsigned_integer (CORE_ADDR addr, int len,
109 enum bfd_endian byte_order,
110 ULONGEST value);
111
112 /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
113 extern void write_memory_signed_integer (CORE_ADDR addr, int len,
114 enum bfd_endian byte_order,
115 LONGEST value);
116 \f
117 /* Hook for `exec_file_command' command to call. */
118
119 extern void (*deprecated_exec_file_display_hook) (const char *filename);
120
121 /* Hook for "file_command", which is more useful than above
122 (because it is invoked AFTER symbols are read, not before). */
123
124 extern void (*deprecated_file_changed_hook) (const char *filename);
125
126 extern void specify_exec_file_hook (void (*hook) (const char *filename));
127
128 /* Binary File Diddler for the core file. */
129
130 #define core_bfd (current_program_space->cbfd.get ())
131
132 /* Whether to open exec and core files read-only or read-write. */
133
134 extern bool write_files;
135
136 /* Open and set up the core file bfd. */
137
138 extern void core_target_open (const char *arg, int from_tty);
139
140 extern void core_file_command (const char *filename, int from_tty);
141
142 extern void exec_file_attach (const char *filename, int from_tty);
143
144 /* If the filename of the main executable is unknown, attempt to
145 determine it. If a filename is determined, proceed as though
146 it was just specified with the "file" command. Do nothing if
147 the filename of the main executable is already known.
148 DEFER_BP_RESET uses SYMFILE_DEFER_BP_RESET for the main symbol file. */
149
150 extern void exec_file_locate_attach (int pid, int defer_bp_reset, int from_tty);
151
152 extern void validate_files (void);
153
154 /* Give the user a message if the current exec file does not match the exec
155 file determined from the target. In case of mismatch, ask the user
156 if the exec file determined from target must be loaded. */
157 extern void validate_exec_file (int from_tty);
158
159 /* The current default bfd target. */
160
161 extern const char *gnutarget;
162
163 extern void set_gnutarget (const char *);
164
165 /* Build either a single-thread or multi-threaded section name for
166 PTID.
167
168 If ptid's lwp member is zero, we want to do the single-threaded
169 thing: look for a section named NAME (as passed to the
170 constructor). If ptid's lwp member is non-zero, we'll want do the
171 multi-threaded thing: look for a section named "NAME/LWP", where
172 LWP is the shortest ASCII decimal representation of ptid's lwp
173 member. */
174
175 class thread_section_name
176 {
177 public:
178 /* NAME is the single-threaded section name. If PTID represents an
179 LWP, then the build section name is "NAME/LWP", otherwise it's
180 just "NAME" unmodified. */
181 thread_section_name (const char *name, ptid_t ptid)
182 {
183 if (ptid.lwp_p ())
184 {
185 m_storage = string_printf ("%s/%ld", name, ptid.lwp ());
186 m_section_name = m_storage.c_str ();
187 }
188 else
189 m_section_name = name;
190 }
191
192 /* Return the computed section name. The result is valid as long as
193 this thread_section_name object is live. */
194 const char *c_str () const
195 { return m_section_name; }
196
197 DISABLE_COPY_AND_ASSIGN (thread_section_name);
198
199 private:
200 /* Either a pointer into M_STORAGE, or a pointer to the name passed
201 as parameter to the constructor. */
202 const char *m_section_name;
203 /* If we need to build a new section name, this is where we store
204 it. */
205 std::string m_storage;
206 };
207
208 #endif /* !defined (GDBCORE_H) */
This page took 0.032695 seconds and 4 git commands to generate.