print_signal_received_reason (this->interp_ui_out (), siggnal);
}
-/* Observer for the signalled notification. */
-
-static void
-cli_base_on_signal_exited (enum gdb_signal siggnal)
+void
+cli_interp_base::on_signal_exited (gdb_signal sig)
{
- SWITCH_THRU_ALL_UIS ()
- {
- cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
- if (cli == nullptr)
- continue;
-
- print_signal_exited_reason (cli->interp_ui_out (), siggnal);
- }
+ print_signal_exited_reason (this->interp_ui_out (), sig);
}
/* Observer for the exited notification. */
interp_factory_register (INTERP_CONSOLE, cli_interp_factory);
/* Note these all work for both the CLI and TUI interpreters. */
- gdb::observers::signal_exited.attach (cli_base_on_signal_exited,
- "cli-interp-base");
gdb::observers::exited.attach (cli_base_on_exited, "cli-interp-base");
gdb::observers::no_history.attach (cli_base_on_no_history, "cli-interp-base");
gdb::observers::sync_execution_done.attach (cli_base_on_sync_execution_done,
bool supports_command_editing () override;
void on_signal_received (gdb_signal sig) override;
- void on_normal_stop(bpstat *bs, int print_frame) override;
+ void on_signal_exited (gdb_signal sig) override;
+ void on_normal_stop (bpstat *bs, int print_frame) override;
private:
struct saved_output_files
"signal number.");
}
- gdb::observers::signal_exited.notify (ecs->ws.sig ());
+ interps_notify_signal_exited (ecs->ws.sig ());
}
gdb_flush (gdb_stdout);
/* See interps.h. */
+void
+interps_notify_signal_exited (gdb_signal sig)
+{
+ interps_notify (&interp::on_signal_exited, sig);
+}
+
+/* See interps.h. */
+
void
interps_notify_normal_stop (bpstat *bs, int print_frame)
{
SIG. */
virtual void on_signal_received (gdb_signal sig) {}
+ /* Notify the interpreter that the current inferior has exited with signal
+ SIG. */
+ virtual void on_signal_exited (gdb_signal sig) {}
+
/* Notify the interpreter that the current inferior has stopped normally. */
virtual void on_normal_stop (bpstat *bs, int print_frame) {}
SIG. */
extern void interps_notify_signal_received (gdb_signal sig);
+/* Notify all interpreters that the current inferior has exited with signal
+ SIG. */
+extern void interps_notify_signal_exited (gdb_signal sig);
+
/* Notify all interpreters that the current inferior has stopped normally. */
extern void interps_notify_normal_stop (bpstat *bs, int print_frame);
static void mi_insert_notify_hooks (void);
static void mi_remove_notify_hooks (void);
-static void mi_on_signal_exited (enum gdb_signal siggnal);
static void mi_on_exited (int exitstatus);
static void mi_on_no_history (void);
print_signal_received_reason (this->cli_uiout, siggnal);
}
-/* Observer for the signal_exited notification. */
-
-static void
-mi_on_signal_exited (enum gdb_signal siggnal)
+void
+mi_interp::on_signal_exited (gdb_signal sig)
{
- SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = find_mi_interp ();
-
- if (mi == NULL)
- continue;
-
- print_signal_exited_reason (mi->mi_uiout, siggnal);
- print_signal_exited_reason (mi->cli_uiout, siggnal);
- }
+ print_signal_exited_reason (this->mi_uiout, sig);
+ print_signal_exited_reason (this->cli_uiout, sig);
}
/* Observer for the exited notification. */
interp_factory_register (INTERP_MI4, mi_interp_factory);
interp_factory_register (INTERP_MI, mi_interp_factory);
- gdb::observers::signal_exited.attach (mi_on_signal_exited, "mi-interp");
gdb::observers::exited.attach (mi_on_exited, "mi-interp");
gdb::observers::no_history.attach (mi_on_no_history, "mi-interp");
gdb::observers::new_thread.attach (mi_new_thread, "mi-interp");
void pre_command_loop () override;
void on_signal_received (gdb_signal sig) override;
+ void on_signal_exited (gdb_signal sig) override;
void on_normal_stop (struct bpstat *bs, int print_frame) override;
/* MI's output channels */
DEFINE_OBSERVABLE (normal_stop);
DEFINE_OBSERVABLE (signal_received);
-DEFINE_OBSERVABLE (signal_exited);
DEFINE_OBSERVABLE (exited);
DEFINE_OBSERVABLE (no_history);
DEFINE_OBSERVABLE (sync_execution_done);
/* The inferior was stopped by a signal. */
extern observable<enum gdb_signal /* siggnal */> signal_received;
-/* The inferior was terminated by a signal. */
-extern observable<enum gdb_signal /* siggnal */> signal_exited;
-
/* The inferior program is finished. */
extern observable<int /* exitstatus */> exited;