| 1 | /* Observers |
| 2 | |
| 3 | Copyright (C) 2016-2019 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 | |
| 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 | |
| 38 | /* The inferior has stopped for real. The bs argument describes the |
| 39 | breakpoints were are stopped at, if any. Second argument |
| 40 | print_frame non-zero means display the location where the |
| 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. */ |
| 52 | extern observable<struct bpstats *, int> normal_stop; |
| 53 | |
| 54 | /* The inferior was stopped by a signal. */ |
| 55 | extern observable<enum gdb_signal> signal_received; |
| 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. */ |
| 61 | extern observable<enum gdb_signal> signal_exited; |
| 62 | |
| 63 | /* The inferior program is finished. */ |
| 64 | extern observable<int> exited; |
| 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. */ |
| 76 | extern observable<struct target_ops *> target_changed; |
| 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. */ |
| 89 | extern observable<struct target_ops *, int> inferior_created; |
| 90 | |
| 91 | /* The status of process record for inferior inferior in gdb has |
| 92 | changed. The process record is started if started is true, and |
| 93 | the process record is stopped if started is false. |
| 94 | |
| 95 | When started is true, method indicates the short name of the |
| 96 | method used for recording. If the method supports multiple |
| 97 | formats, format indicates which one is being used, otherwise it |
| 98 | is NULL. When started is false, they are both NULL. */ |
| 99 | extern observable<struct inferior *, int, const char *, const char *> |
| 100 | record_changed; |
| 101 | |
| 102 | /* The shared library specified by solib has been loaded. Note that |
| 103 | when gdb calls this observer, the library's symbols probably |
| 104 | haven't been loaded yet. */ |
| 105 | extern observable<struct so_list *> solib_loaded; |
| 106 | |
| 107 | /* The shared library specified by solib has been unloaded. Note |
| 108 | that when gdb calls this observer, the library's symbols have not |
| 109 | been unloaded yet, and thus are still available. */ |
| 110 | extern observable<struct so_list *> solib_unloaded; |
| 111 | |
| 112 | /* The symbol file specified by objfile has been loaded. Called |
| 113 | with objfile equal to NULL to indicate previously loaded symbol |
| 114 | table data has now been invalidated. */ |
| 115 | extern observable<struct objfile *> new_objfile; |
| 116 | |
| 117 | /* The object file specified by objfile is about to be freed. */ |
| 118 | extern observable<struct objfile *> free_objfile; |
| 119 | |
| 120 | /* The thread specified by t has been created. */ |
| 121 | extern observable<struct thread_info *> new_thread; |
| 122 | |
| 123 | /* The thread specified by t has exited. The silent argument |
| 124 | indicates that gdb is removing the thread from its tables without |
| 125 | wanting to notify the user about it. */ |
| 126 | extern observable<struct thread_info *, int> thread_exit; |
| 127 | |
| 128 | /* An explicit stop request was issued to ptid. If ptid equals |
| 129 | minus_one_ptid, the request applied to all threads. If |
| 130 | ptid_is_pid(ptid) returns true, the request applied to all |
| 131 | threads of the process pointed at by ptid. Otherwise, the |
| 132 | request applied to the single thread pointed at by ptid. */ |
| 133 | extern observable<ptid_t> thread_stop_requested; |
| 134 | |
| 135 | /* The target was resumed. The ptid parameter specifies which |
| 136 | thread was resume, and may be RESUME_ALL if all threads are |
| 137 | resumed. */ |
| 138 | extern observable<ptid_t> target_resumed; |
| 139 | |
| 140 | /* The target is about to be proceeded. */ |
| 141 | extern observable<> about_to_proceed; |
| 142 | |
| 143 | /* A new breakpoint b has been created. */ |
| 144 | extern observable<struct breakpoint *> breakpoint_created; |
| 145 | |
| 146 | /* A breakpoint has been destroyed. The argument b is the |
| 147 | pointer to the destroyed breakpoint. */ |
| 148 | extern observable<struct breakpoint *> breakpoint_deleted; |
| 149 | |
| 150 | /* A breakpoint has been modified in some way. The argument b |
| 151 | is the modified breakpoint. */ |
| 152 | extern observable<struct breakpoint *> breakpoint_modified; |
| 153 | |
| 154 | /* The trace frame is changed to tfnum (e.g., by using the 'tfind' |
| 155 | command). If tfnum is negative, it means gdb resumes live |
| 156 | debugging. The number of the tracepoint associated with this |
| 157 | traceframe is tpnum. */ |
| 158 | extern observable<int, int> traceframe_changed; |
| 159 | |
| 160 | /* The current architecture has changed. The argument newarch is a |
| 161 | pointer to the new architecture. */ |
| 162 | extern observable<struct gdbarch *> architecture_changed; |
| 163 | |
| 164 | /* The thread's ptid has changed. The old_ptid parameter specifies |
| 165 | the old value, and new_ptid specifies the new value. */ |
| 166 | extern observable<ptid_t, ptid_t> thread_ptid_changed; |
| 167 | |
| 168 | /* The inferior inf has been added to the list of inferiors. At |
| 169 | this point, it might not be associated with any process. */ |
| 170 | extern observable<struct inferior *> inferior_added; |
| 171 | |
| 172 | /* The inferior identified by inf has been attached to a |
| 173 | process. */ |
| 174 | extern observable<struct inferior *> inferior_appeared; |
| 175 | |
| 176 | /* Either the inferior associated with inf has been detached from |
| 177 | the process, or the process has exited. */ |
| 178 | extern observable<struct inferior *> inferior_exit; |
| 179 | |
| 180 | /* The inferior inf has been removed from the list of inferiors. |
| 181 | This method is called immediately before freeing inf. */ |
| 182 | extern observable<struct inferior *> inferior_removed; |
| 183 | |
| 184 | /* Bytes from data to data + len have been written to the inferior |
| 185 | at addr. */ |
| 186 | extern observable<struct inferior *, CORE_ADDR, ssize_t, const bfd_byte *> |
| 187 | memory_changed; |
| 188 | |
| 189 | /* Called before a top-level prompt is displayed. current_prompt is |
| 190 | the current top-level prompt. */ |
| 191 | extern observable<const char *> before_prompt; |
| 192 | |
| 193 | /* Variable gdb_datadir has been set. The value may not necessarily |
| 194 | change. */ |
| 195 | extern observable<> gdb_datadir_changed; |
| 196 | |
| 197 | /* The parameter of some 'set' commands in console are changed. |
| 198 | This method is called after a command 'set param value'. param |
| 199 | is the parameter of 'set' command, and value is the value of |
| 200 | changed parameter. */ |
| 201 | extern observable<const char *, const char *> command_param_changed; |
| 202 | |
| 203 | /* The new trace state variable tsv is created. */ |
| 204 | extern observable<const struct trace_state_variable *> tsv_created; |
| 205 | |
| 206 | /* The trace state variable tsv is deleted. If tsv is NULL, all |
| 207 | trace state variables are deleted. */ |
| 208 | extern observable<const struct trace_state_variable *> tsv_deleted; |
| 209 | |
| 210 | /* The trace state value tsv is modified. */ |
| 211 | extern observable<const struct trace_state_variable *> tsv_modified; |
| 212 | |
| 213 | /* An inferior function at address is about to be called in thread |
| 214 | thread. */ |
| 215 | extern observable<ptid_t, CORE_ADDR> inferior_call_pre; |
| 216 | |
| 217 | /* The inferior function at address has just been called. This |
| 218 | observer is called even if the inferior exits during the call. |
| 219 | thread is the thread in which the function was called, which may |
| 220 | be different from the current thread. */ |
| 221 | extern observable<ptid_t, CORE_ADDR> inferior_call_post; |
| 222 | |
| 223 | /* A register in the inferior has been modified by the gdb user. */ |
| 224 | extern observable<struct frame_info *, int> register_changed; |
| 225 | |
| 226 | /* The user-selected inferior, thread and/or frame has changed. The |
| 227 | user_select_what flag specifies if the inferior, thread and/or |
| 228 | frame has changed. */ |
| 229 | extern observable<user_selected_what> user_selected_context_changed; |
| 230 | |
| 231 | /* This is notified when the source styling setting has changed and |
| 232 | should be reconsulted. */ |
| 233 | extern observable<> source_styling_changed; |
| 234 | |
| 235 | } /* namespace observers */ |
| 236 | |
| 237 | } /* namespace gdb */ |
| 238 | |
| 239 | #endif /* OBSERVABLE_H */ |