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/>. */
23 #include "gdbsupport/observable.h"
24 #include "target/waitstatus.h"
31 struct process_stratum_target
;
33 struct trace_state_variable
;
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
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
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 target's register contents have changed. */
61 extern observable
<struct target_ops */
* target */
> target_changed
;
63 /* The executable being debugged by GDB has changed: The user
64 decided to debug a different program, or the program he was
65 debugging has been modified since being loaded by the debugger
66 (by being recompiled, for instance). */
67 extern observable
<> executable_changed
;
69 /* gdb has just connected to an inferior. For 'run', gdb calls this
70 observer while the inferior is still stopped at the entry-point
71 instruction. For 'attach' and 'core', gdb calls this observer
72 immediately after connecting to the inferior, and before any
73 information on the inferior has been printed. */
74 extern observable
<inferior */
* inferior */
> inferior_created
;
76 /* The inferior EXEC_INF has exec'ed a new executable file.
78 Execution continues in FOLLOW_INF, which may or may not be the same as
79 EXEC_INF, depending on "set follow-exec-mode". */
80 extern observable
<inferior */
* exec_inf */
, inferior */
* follow_inf */
>
83 /* The inferior PARENT_INF has forked. If we are setting up an inferior for
84 the child (because we follow only the child or we follow both), CHILD_INF
85 is the child inferior. Otherwise, CHILD_INF is nullptr.
87 FORK_KIND is TARGET_WAITKIND_FORKED or TARGET_WAITKIND_VFORKED. */
88 extern observable
<inferior */
* parent_inf */
, inferior */
* child_inf */
,
89 target_waitkind
/* fork_kind */> inferior_forked
;
91 /* The shared library specified by SOLIB has been loaded. Note that
92 when gdb calls this observer, the library's symbols probably
93 haven't been loaded yet. */
94 extern observable
<struct so_list */
* solib */
> solib_loaded
;
96 /* The shared library specified by SOLIB has been unloaded. Note
97 that when gdb calls this observer, the library's symbols have not
98 been unloaded yet, and thus are still available. */
99 extern observable
<struct so_list */
* solib */
> solib_unloaded
;
101 /* The symbol file specified by OBJFILE has been loaded. Called
102 with OBJFILE equal to NULL to indicate previously loaded symbol
103 table data has now been invalidated. */
104 extern observable
<struct objfile */
* objfile */
> new_objfile
;
106 /* The object file specified by OBJFILE is about to be freed. */
107 extern observable
<struct objfile */
* objfile */
> free_objfile
;
109 /* The thread specified by T has been created. */
110 extern observable
<struct thread_info */
* t */
> new_thread
;
112 /* The thread specified by T has exited. The SILENT argument
113 indicates that gdb is removing the thread from its tables without
114 wanting to notify the user about it. */
115 extern observable
<struct thread_info */
* t */
, int /* silent */> thread_exit
;
117 /* An explicit stop request was issued to PTID. If PTID equals
118 minus_one_ptid, the request applied to all threads. If
119 ptid_is_pid(PTID) returns true, the request applied to all
120 threads of the process pointed at by PTID. Otherwise, the
121 request applied to the single thread pointed at by PTID. */
122 extern observable
<ptid_t
/* ptid */> thread_stop_requested
;
124 /* The target was resumed. The PTID parameter specifies which
125 thread was resume, and may be RESUME_ALL if all threads are
127 extern observable
<ptid_t
/* ptid */> target_resumed
;
129 /* The target is about to be proceeded. */
130 extern observable
<> about_to_proceed
;
132 /* A new breakpoint B has been created. */
133 extern observable
<struct breakpoint */
* b */
> breakpoint_created
;
135 /* A breakpoint has been destroyed. The argument B is the
136 pointer to the destroyed breakpoint. */
137 extern observable
<struct breakpoint */
* b */
> breakpoint_deleted
;
139 /* A breakpoint has been modified in some way. The argument B
140 is the modified breakpoint. */
141 extern observable
<struct breakpoint */
* b */
> breakpoint_modified
;
143 /* The current architecture has changed. The argument NEWARCH is a
144 pointer to the new architecture. */
145 extern observable
<struct gdbarch */
* newarch */
> architecture_changed
;
147 /* The thread's ptid has changed. The OLD_PTID parameter specifies
148 the old value, and NEW_PTID specifies the new value. */
149 extern observable
<process_stratum_target
* /* target */,
150 ptid_t
/* old_ptid */, ptid_t
/* new_ptid */>
153 /* The inferior INF has been added to the list of inferiors. At
154 this point, it might not be associated with any process. */
155 extern observable
<struct inferior */
* inf */
> inferior_added
;
157 /* The inferior identified by INF has been attached to a
159 extern observable
<struct inferior */
* inf */
> inferior_appeared
;
161 /* Inferior INF is about to be detached. */
162 extern observable
<struct inferior */
* inf */
> inferior_pre_detach
;
164 /* Either the inferior associated with INF has been detached from
165 the process, or the process has exited. */
166 extern observable
<struct inferior */
* inf */
> inferior_exit
;
168 /* The inferior INF has been removed from the list of inferiors.
169 This method is called immediately before freeing INF. */
170 extern observable
<struct inferior */
* inf */
> inferior_removed
;
172 /* Bytes from DATA to DATA + LEN have been written to the inferior
174 extern observable
<struct inferior */
* inferior */
, CORE_ADDR
/* addr */,
175 ssize_t
/* len */, const bfd_byte */
* data */
>
178 /* Called before a top-level prompt is displayed. CURRENT_PROMPT is
179 the current top-level prompt. */
180 extern observable
<const char */
* current_prompt */
> before_prompt
;
182 /* Variable gdb_datadir has been set. The value may not necessarily
184 extern observable
<> gdb_datadir_changed
;
186 /* An inferior function at ADDRESS is about to be called in thread
188 extern observable
<ptid_t
/* thread */, CORE_ADDR
/* address */>
191 /* The inferior function at ADDRESS has just been called. This
192 observer is called even if the inferior exits during the call.
193 THREAD is the thread in which the function was called, which may
194 be different from the current thread. */
195 extern observable
<ptid_t
/* thread */, CORE_ADDR
/* address */>
198 /* A register in the inferior has been modified by the gdb user. */
199 extern observable
<frame_info_ptr
/* frame */, int /* regnum */>
202 /* The user-selected inferior, thread and/or frame has changed. The
203 user_select_what flag specifies if the inferior, thread and/or
204 frame has changed. */
205 extern observable
<user_selected_what
/* selection */>
206 user_selected_context_changed
;
208 /* This is notified when a styling setting has changed, content may need
209 to be updated based on the new settings. */
210 extern observable
<> styling_changed
;
212 /* The CLI's notion of the current source has changed. This differs
213 from user_selected_context_changed in that it is also set by the
215 extern observable
<> current_source_symtab_and_line_changed
;
217 /* Called when GDB is about to exit. */
218 extern observable
<int> gdb_exiting
;
220 /* When a connection is removed. */
221 extern observable
<process_stratum_target */
* target */
> connection_removed
;
223 /* About to enter target_wait (). */
224 extern observable
<ptid_t
/* ptid */> target_pre_wait
;
226 /* About to leave target_wait (). */
227 extern observable
<ptid_t
/* event_ptid */> target_post_wait
;
229 } /* namespace observers */
231 } /* namespace gdb */
233 #endif /* OBSERVABLE_H */