+/* Observers for several run control events. If the interpreter is
+ quiet (i.e., another interpreter is being run with
+ interpreter-exec), print nothing. */
+
+/* Observer for the normal_stop notification. */
+
+static void
+tui_on_normal_stop (struct bpstats *bs, int print_frame)
+{
+ if (!print_frame)
+ return;
+
+ SWITCH_THRU_ALL_UIS ()
+ {
+ struct interp *interp = top_level_interpreter ();
+ struct interp *tui = as_tui_interp (interp);
+ struct thread_info *thread;
+
+ if (tui == NULL)
+ continue;
+
+ thread = inferior_thread ();
+ if (should_print_stop_to_console (interp, thread))
+ print_stop_event (tui->interp_ui_out ());
+ }
+}
+
+/* Observer for the signal_received notification. */
+
+static void
+tui_on_signal_received (enum gdb_signal siggnal)
+{
+ SWITCH_THRU_ALL_UIS ()
+ {
+ struct interp *tui = as_tui_interp (top_level_interpreter ());
+
+ if (tui == NULL)
+ continue;
+
+ print_signal_received_reason (tui->interp_ui_out (), siggnal);
+ }
+}
+
+/* Observer for the end_stepping_range notification. */
+
+static void
+tui_on_end_stepping_range (void)
+{
+ SWITCH_THRU_ALL_UIS ()
+ {
+ struct interp *tui = as_tui_interp (top_level_interpreter ());
+
+ if (tui == NULL)
+ continue;
+
+ print_end_stepping_range_reason (tui->interp_ui_out ());
+ }
+}
+
+/* Observer for the signal_exited notification. */
+
+static void
+tui_on_signal_exited (enum gdb_signal siggnal)
+{
+ SWITCH_THRU_ALL_UIS ()
+ {
+ struct interp *tui = as_tui_interp (top_level_interpreter ());
+
+ if (tui == NULL)
+ continue;
+
+ print_signal_exited_reason (tui->interp_ui_out (), siggnal);
+ }
+}
+
+/* Observer for the exited notification. */
+
+static void
+tui_on_exited (int exitstatus)
+{
+ SWITCH_THRU_ALL_UIS ()
+ {
+ struct interp *tui = as_tui_interp (top_level_interpreter ());
+
+ if (tui == NULL)
+ continue;
+
+ print_exited_reason (tui->interp_ui_out (), exitstatus);
+ }
+}
+
+/* Observer for the no_history notification. */
+
+static void
+tui_on_no_history (void)
+{
+ SWITCH_THRU_ALL_UIS ()
+ {
+ struct interp *tui = as_tui_interp (top_level_interpreter ());
+
+ if (tui == NULL)
+ continue;
+
+ print_no_history_reason (tui->interp_ui_out ());
+ }
+}
+
+/* Observer for the sync_execution_done notification. */
+
+static void
+tui_on_sync_execution_done (void)
+{
+ struct interp *tui = as_tui_interp (top_level_interpreter ());
+
+ if (tui == NULL)
+ return;
+
+ display_gdb_prompt (NULL);
+}
+
+/* Observer for the command_error notification. */
+
+static void
+tui_on_command_error (void)
+{
+ struct interp *tui = as_tui_interp (top_level_interpreter ());
+
+ if (tui == NULL)
+ return;
+
+ display_gdb_prompt (NULL);
+}
+
+/* Observer for the user_selected_context_changed notification. */
+
+static void
+tui_on_user_selected_context_changed (user_selected_what selection)
+{
+ /* This event is suppressed. */
+ if (cli_suppress_notification.user_selected_context)
+ return;
+
+ thread_info *tp = inferior_ptid != null_ptid ? inferior_thread () : NULL;
+
+ SWITCH_THRU_ALL_UIS ()
+ {
+ struct interp *tui = as_tui_interp (top_level_interpreter ());
+
+ if (tui == NULL)
+ continue;
+
+ if (selection & USER_SELECTED_INFERIOR)
+ print_selected_inferior (tui->interp_ui_out ());
+
+ if (tp != NULL
+ && ((selection & (USER_SELECTED_THREAD | USER_SELECTED_FRAME))))
+ print_selected_thread_frame (tui->interp_ui_out (), selection);
+
+ }
+}
+