Updated Swedish translation for the opcodes directory
[binutils-gdb.git] / gdb / observable.h
blobe4e6f021f1a980617fc2827029052bac4f476003
1 /* Observers
3 Copyright (C) 2016-2023 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #ifndef OBSERVABLE_H
21 #define OBSERVABLE_H
23 #include "gdbsupport/observable.h"
24 #include "target/waitstatus.h"
26 struct bpstat;
27 struct so_list;
28 struct objfile;
29 struct thread_info;
30 struct inferior;
31 struct process_stratum_target;
32 struct target_ops;
33 struct trace_state_variable;
35 namespace gdb
38 namespace observers
41 /* The inferior has stopped for real. The BS argument describes the
42 breakpoints were are stopped at, if any. Second argument
43 PRINT_FRAME non-zero means display the location where the
44 inferior has stopped.
46 gdb notifies all normal_stop observers when the inferior execution
47 has just stopped, the associated messages and annotations have been
48 printed, and the control is about to be returned to the user.
50 Note that the normal_stop notification is not emitted when the
51 execution stops due to a breakpoint, and this breakpoint has a
52 condition that is not met. If the breakpoint has any associated
53 commands list, the commands are executed after the notification is
54 emitted. */
55 extern observable<struct bpstat */* bs */, int /* print_frame */> normal_stop;
57 /* The inferior was stopped by a signal. */
58 extern observable<enum gdb_signal /* siggnal */> signal_received;
60 /* The inferior was terminated by a signal. */
61 extern observable<enum gdb_signal /* siggnal */> signal_exited;
63 /* The inferior program is finished. */
64 extern observable<int /* exitstatus */> exited;
66 /* Reverse execution: target ran out of history info. */
67 extern observable<> no_history;
69 /* A synchronous command finished. */
70 extern observable<> sync_execution_done;
72 /* An error was caught while executing a command. */
73 extern observable<> command_error;
75 /* The target's register contents have changed. */
76 extern observable<struct target_ops */* target */> target_changed;
78 /* The executable being debugged by GDB has changed: The user
79 decided to debug a different program, or the program he was
80 debugging has been modified since being loaded by the debugger
81 (by being recompiled, for instance). */
82 extern observable<> executable_changed;
84 /* gdb has just connected to an inferior. For 'run', gdb calls this
85 observer while the inferior is still stopped at the entry-point
86 instruction. For 'attach' and 'core', gdb calls this observer
87 immediately after connecting to the inferior, and before any
88 information on the inferior has been printed. */
89 extern observable<inferior */* inferior */> inferior_created;
91 /* The inferior EXEC_INF has exec'ed a new executable file.
93 Execution continues in FOLLOW_INF, which may or may not be the same as
94 EXEC_INF, depending on "set follow-exec-mode". */
95 extern observable<inferior */* exec_inf */, inferior */* follow_inf */>
96 inferior_execd;
98 /* The inferior PARENT_INF has forked. If we are setting up an inferior for
99 the child (because we follow only the child or we follow both), CHILD_INF
100 is the child inferior. Otherwise, CHILD_INF is nullptr.
102 FORK_KIND is TARGET_WAITKIND_FORKED or TARGET_WAITKIND_VFORKED. */
103 extern observable<inferior */* parent_inf */, inferior */* child_inf */,
104 target_waitkind /* fork_kind */> inferior_forked;
106 /* The status of process record for inferior inferior in gdb has
107 changed. The process record is started if STARTED is true, and
108 the process record is stopped if STARTED is false.
110 When STARTED is true, METHOD indicates the short name of the
111 method used for recording. If the method supports multiple
112 formats, FORMAT indicates which one is being used, otherwise it
113 is NULL. When STARTED is false, they are both NULL. */
114 extern observable<struct inferior */* inferior */, int /* started */,
115 const char */* method */, const char */* format */>
116 record_changed;
118 /* The shared library specified by SOLIB has been loaded. Note that
119 when gdb calls this observer, the library's symbols probably
120 haven't been loaded yet. */
121 extern observable<struct so_list */* solib */> solib_loaded;
123 /* The shared library specified by SOLIB has been unloaded. Note
124 that when gdb calls this observer, the library's symbols have not
125 been unloaded yet, and thus are still available. */
126 extern observable<struct so_list */* solib */> solib_unloaded;
128 /* The symbol file specified by OBJFILE has been loaded. Called
129 with OBJFILE equal to NULL to indicate previously loaded symbol
130 table data has now been invalidated. */
131 extern observable<struct objfile */* objfile */> new_objfile;
133 /* The object file specified by OBJFILE is about to be freed. */
134 extern observable<struct objfile */* objfile */> free_objfile;
136 /* The thread specified by T has been created. */
137 extern observable<struct thread_info */* t */> new_thread;
139 /* The thread specified by T has exited. The SILENT argument
140 indicates that gdb is removing the thread from its tables without
141 wanting to notify the user about it. */
142 extern observable<struct thread_info */* t */, int /* silent */> thread_exit;
144 /* An explicit stop request was issued to PTID. If PTID equals
145 minus_one_ptid, the request applied to all threads. If
146 ptid_is_pid(PTID) returns true, the request applied to all
147 threads of the process pointed at by PTID. Otherwise, the
148 request applied to the single thread pointed at by PTID. */
149 extern observable<ptid_t /* ptid */> thread_stop_requested;
151 /* The target was resumed. The PTID parameter specifies which
152 thread was resume, and may be RESUME_ALL if all threads are
153 resumed. */
154 extern observable<ptid_t /* ptid */> target_resumed;
156 /* The target is about to be proceeded. */
157 extern observable<> about_to_proceed;
159 /* A new breakpoint B has been created. */
160 extern observable<struct breakpoint */* b */> breakpoint_created;
162 /* A breakpoint has been destroyed. The argument B is the
163 pointer to the destroyed breakpoint. */
164 extern observable<struct breakpoint */* b */> breakpoint_deleted;
166 /* A breakpoint has been modified in some way. The argument B
167 is the modified breakpoint. */
168 extern observable<struct breakpoint */* b */> breakpoint_modified;
170 /* The trace frame is changed to TFNUM (e.g., by using the 'tfind'
171 command). If TFNUM is negative, it means gdb resumes live
172 debugging. The number of the tracepoint associated with this
173 traceframe is TPNUM. */
174 extern observable<int /* tfnum */, int /* tpnum */> traceframe_changed;
176 /* The current architecture has changed. The argument NEWARCH is a
177 pointer to the new architecture. */
178 extern observable<struct gdbarch */* newarch */> architecture_changed;
180 /* The thread's ptid has changed. The OLD_PTID parameter specifies
181 the old value, and NEW_PTID specifies the new value. */
182 extern observable<process_stratum_target * /* target */,
183 ptid_t /* old_ptid */, ptid_t /* new_ptid */>
184 thread_ptid_changed;
186 /* The inferior INF has been added to the list of inferiors. At
187 this point, it might not be associated with any process. */
188 extern observable<struct inferior */* inf */> inferior_added;
190 /* The inferior identified by INF has been attached to a
191 process. */
192 extern observable<struct inferior */* inf */> inferior_appeared;
194 /* Inferior INF is about to be detached. */
195 extern observable<struct inferior */* inf */> inferior_pre_detach;
197 /* Either the inferior associated with INF has been detached from
198 the process, or the process has exited. */
199 extern observable<struct inferior */* inf */> inferior_exit;
201 /* The inferior INF has been removed from the list of inferiors.
202 This method is called immediately before freeing INF. */
203 extern observable<struct inferior */* inf */> inferior_removed;
205 /* Bytes from DATA to DATA + LEN have been written to the inferior
206 at ADDR. */
207 extern observable<struct inferior */* inferior */, CORE_ADDR /* addr */,
208 ssize_t /* len */, const bfd_byte */* data */>
209 memory_changed;
211 /* Called before a top-level prompt is displayed. CURRENT_PROMPT is
212 the current top-level prompt. */
213 extern observable<const char */* current_prompt */> before_prompt;
215 /* Variable gdb_datadir has been set. The value may not necessarily
216 change. */
217 extern observable<> gdb_datadir_changed;
219 /* The parameter of some 'set' commands in console are changed.
220 This method is called after a command 'set param value'. PARAM
221 is the parameter of 'set' command, and VALUE is the value of
222 changed parameter. */
223 extern observable<const char */* param */, const char */* value */>
224 command_param_changed;
226 /* The new trace state variable TSV is created. */
227 extern observable<const struct trace_state_variable */* tsv */> tsv_created;
229 /* The trace state variable TSV is deleted. If TSV is NULL, all
230 trace state variables are deleted. */
231 extern observable<const struct trace_state_variable */* tsv */> tsv_deleted;
233 /* The trace state value TSV is modified. */
234 extern observable<const struct trace_state_variable */* tsv */> tsv_modified;
236 /* An inferior function at ADDRESS is about to be called in thread
237 THREAD. */
238 extern observable<ptid_t /* thread */, CORE_ADDR /* address */>
239 inferior_call_pre;
241 /* The inferior function at ADDRESS has just been called. This
242 observer is called even if the inferior exits during the call.
243 THREAD is the thread in which the function was called, which may
244 be different from the current thread. */
245 extern observable<ptid_t /* thread */, CORE_ADDR /* address */>
246 inferior_call_post;
248 /* A register in the inferior has been modified by the gdb user. */
249 extern observable<frame_info_ptr /* frame */, int /* regnum */>
250 register_changed;
252 /* The user-selected inferior, thread and/or frame has changed. The
253 user_select_what flag specifies if the inferior, thread and/or
254 frame has changed. */
255 extern observable<user_selected_what /* selection */>
256 user_selected_context_changed;
258 /* This is notified when a styling setting has changed, content may need
259 to be updated based on the new settings. */
260 extern observable<> styling_changed;
262 /* The CLI's notion of the current source has changed. This differs
263 from user_selected_context_changed in that it is also set by the
264 "list" command. */
265 extern observable<> current_source_symtab_and_line_changed;
267 /* Called when GDB is about to exit. */
268 extern observable<int> gdb_exiting;
270 /* When a connection is removed. */
271 extern observable<process_stratum_target */* target */> connection_removed;
273 /* About to enter target_wait (). */
274 extern observable <ptid_t /* ptid */> target_pre_wait;
276 /* About to leave target_wait (). */
277 extern observable <ptid_t /* event_ptid */> target_post_wait;
279 } /* namespace observers */
281 } /* namespace gdb */
283 #endif /* OBSERVABLE_H */