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