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