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