3 Copyright (C) 2016-2022 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"
30 struct process_stratum_target
;
31 struct trace_state_variable
;
39 /* The inferior has stopped for real. The BS argument describes the
40 breakpoints were are stopped at, if any. Second argument
41 PRINT_FRAME non-zero means display the location where the
44 gdb notifies all normal_stop observers when the inferior execution
45 has just stopped, the associated messages and annotations have been
46 printed, and the control is about to be returned to the user.
48 Note that the normal_stop notification is not emitted when the
49 execution stops due to a breakpoint, and this breakpoint has a
50 condition that is not met. If the breakpoint has any associated
51 commands list, the commands are executed after the notification is
53 extern observable
<struct bpstat */
* bs */
, int /* print_frame */> normal_stop
;
55 /* The inferior was stopped by a signal. */
56 extern observable
<enum gdb_signal
/* siggnal */> signal_received
;
58 /* We are done with a step/next/si/ni command. */
59 extern observable
<> end_stepping_range
;
61 /* The inferior was terminated by a signal. */
62 extern observable
<enum gdb_signal
/* siggnal */> signal_exited
;
64 /* The inferior program is finished. */
65 extern observable
<int /* exitstatus */> exited
;
67 /* Reverse execution: target ran out of history info. */
68 extern observable
<> no_history
;
70 /* A synchronous command finished. */
71 extern observable
<> sync_execution_done
;
73 /* An error was caught while executing a command. */
74 extern observable
<> command_error
;
76 /* The target's register contents have changed. */
77 extern observable
<struct target_ops */
* target */
> target_changed
;
79 /* The executable being debugged by GDB has changed: The user
80 decided to debug a different program, or the program he was
81 debugging has been modified since being loaded by the debugger
82 (by being recompiled, for instance). */
83 extern observable
<> executable_changed
;
85 /* gdb has just connected to an inferior. For 'run', gdb calls this
86 observer while the inferior is still stopped at the entry-point
87 instruction. For 'attach' and 'core', gdb calls this observer
88 immediately after connecting to the inferior, and before any
89 information on the inferior has been printed. */
90 extern observable
<inferior */
* inferior */
> inferior_created
;
92 /* The inferior INF has exec'ed a new executable file. */
93 extern observable
<struct inferior */
* inf */
> inferior_execd
;
95 /* The status of process record for inferior inferior in gdb has
96 changed. The process record is started if STARTED is true, and
97 the process record is stopped if STARTED is false.
99 When STARTED is true, METHOD indicates the short name of the
100 method used for recording. If the method supports multiple
101 formats, FORMAT indicates which one is being used, otherwise it
102 is NULL. When STARTED is false, they are both NULL. */
103 extern observable
<struct inferior */
* inferior */
, int /* started */,
104 const char */
* method */
, const char */
* format */
>
107 /* The shared library specified by SOLIB has been loaded. Note that
108 when gdb calls this observer, the library's symbols probably
109 haven't been loaded yet. */
110 extern observable
<struct so_list */
* solib */
> solib_loaded
;
112 /* The shared library specified by SOLIB has been unloaded. Note
113 that when gdb calls this observer, the library's symbols have not
114 been unloaded yet, and thus are still available. */
115 extern observable
<struct so_list */
* solib */
> solib_unloaded
;
117 /* The symbol file specified by OBJFILE has been loaded. Called
118 with OBJFILE equal to NULL to indicate previously loaded symbol
119 table data has now been invalidated. */
120 extern observable
<struct objfile */
* objfile */
> new_objfile
;
122 /* The object file specified by OBJFILE is about to be freed. */
123 extern observable
<struct objfile */
* objfile */
> free_objfile
;
125 /* The thread specified by T has been created. */
126 extern observable
<struct thread_info */
* t */
> new_thread
;
128 /* The thread specified by T has exited. The SILENT argument
129 indicates that gdb is removing the thread from its tables without
130 wanting to notify the user about it. */
131 extern observable
<struct thread_info */
* t */
, int /* silent */> thread_exit
;
133 /* An explicit stop request was issued to PTID. If PTID equals
134 minus_one_ptid, the request applied to all threads. If
135 ptid_is_pid(PTID) returns true, the request applied to all
136 threads of the process pointed at by PTID. Otherwise, the
137 request applied to the single thread pointed at by PTID. */
138 extern observable
<ptid_t
/* ptid */> thread_stop_requested
;
140 /* The target was resumed. The PTID parameter specifies which
141 thread was resume, and may be RESUME_ALL if all threads are
143 extern observable
<ptid_t
/* ptid */> target_resumed
;
145 /* The target is about to be proceeded. */
146 extern observable
<> about_to_proceed
;
148 /* A new breakpoint B has been created. */
149 extern observable
<struct breakpoint */
* b */
> breakpoint_created
;
151 /* A breakpoint has been destroyed. The argument B is the
152 pointer to the destroyed breakpoint. */
153 extern observable
<struct breakpoint */
* b */
> breakpoint_deleted
;
155 /* A breakpoint has been modified in some way. The argument B
156 is the modified breakpoint. */
157 extern observable
<struct breakpoint */
* b */
> breakpoint_modified
;
159 /* The trace frame is changed to TFNUM (e.g., by using the 'tfind'
160 command). If TFNUM is negative, it means gdb resumes live
161 debugging. The number of the tracepoint associated with this
162 traceframe is TPNUM. */
163 extern observable
<int /* tfnum */, int /* tpnum */> traceframe_changed
;
165 /* The current architecture has changed. The argument NEWARCH is a
166 pointer to the new architecture. */
167 extern observable
<struct gdbarch */
* newarch */
> architecture_changed
;
169 /* The thread's ptid has changed. The OLD_PTID parameter specifies
170 the old value, and NEW_PTID specifies the new value. */
171 extern observable
<process_stratum_target
* /* target */,
172 ptid_t
/* old_ptid */, ptid_t
/* new_ptid */>
175 /* The inferior INF has been added to the list of inferiors. At
176 this point, it might not be associated with any process. */
177 extern observable
<struct inferior */
* inf */
> inferior_added
;
179 /* The inferior identified by INF has been attached to a
181 extern observable
<struct inferior */
* inf */
> inferior_appeared
;
183 /* Either the inferior associated with INF has been detached from
184 the process, or the process has exited. */
185 extern observable
<struct inferior */
* inf */
> inferior_exit
;
187 /* The inferior INF has been removed from the list of inferiors.
188 This method is called immediately before freeing INF. */
189 extern observable
<struct inferior */
* inf */
> inferior_removed
;
191 /* Bytes from DATA to DATA + LEN have been written to the inferior
193 extern observable
<struct inferior */
* inferior */
, CORE_ADDR
/* addr */,
194 ssize_t
/* len */, const bfd_byte */
* data */
>
197 /* Called before a top-level prompt is displayed. CURRENT_PROMPT is
198 the current top-level prompt. */
199 extern observable
<const char */
* current_prompt */
> before_prompt
;
201 /* Variable gdb_datadir has been set. The value may not necessarily
203 extern observable
<> gdb_datadir_changed
;
205 /* The parameter of some 'set' commands in console are changed.
206 This method is called after a command 'set param value'. PARAM
207 is the parameter of 'set' command, and VALUE is the value of
208 changed parameter. */
209 extern observable
<const char */
* param */
, const char */
* value */
>
210 command_param_changed
;
212 /* The new trace state variable TSV is created. */
213 extern observable
<const struct trace_state_variable */
* tsv */
> tsv_created
;
215 /* The trace state variable TSV is deleted. If TSV is NULL, all
216 trace state variables are deleted. */
217 extern observable
<const struct trace_state_variable */
* tsv */
> tsv_deleted
;
219 /* The trace state value TSV is modified. */
220 extern observable
<const struct trace_state_variable */
* tsv */
> tsv_modified
;
222 /* An inferior function at ADDRESS is about to be called in thread
224 extern observable
<ptid_t
/* thread */, CORE_ADDR
/* address */>
227 /* The inferior function at ADDRESS has just been called. This
228 observer is called even if the inferior exits during the call.
229 THREAD is the thread in which the function was called, which may
230 be different from the current thread. */
231 extern observable
<ptid_t
/* thread */, CORE_ADDR
/* address */>
234 /* A register in the inferior has been modified by the gdb user. */
235 extern observable
<struct frame_info */
* frame */
, int /* regnum */>
238 /* The user-selected inferior, thread and/or frame has changed. The
239 user_select_what flag specifies if the inferior, thread and/or
240 frame has changed. */
241 extern observable
<user_selected_what
/* selection */>
242 user_selected_context_changed
;
244 /* This is notified when a styling setting has changed, content may need
245 to be updated based on the new settings. */
246 extern observable
<> styling_changed
;
248 /* The CLI's notion of the current source has changed. This differs
249 from user_selected_context_changed in that it is also set by the
251 extern observable
<> current_source_symtab_and_line_changed
;
253 /* Called when GDB is about to exit. */
254 extern observable
<int> gdb_exiting
;
256 /* When a connection is removed. */
257 extern observable
<process_stratum_target */
* target */
> connection_removed
;
259 /* About to enter target_wait (). */
260 extern observable
<ptid_t
/* ptid */> target_pre_wait
;
262 /* About to leave target_wait (). */
263 extern observable
<ptid_t
/* event_ptid */> target_post_wait
;
265 } /* namespace observers */
267 } /* namespace gdb */
269 #endif /* OBSERVABLE_H */