aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-interp.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-03-01 20:38:35 -0500
committerSimon Marchi <simon.marchi@efficios.com>2023-05-30 15:07:26 -0400
commit8782926771b1212acb90b944f7402466c998d592 (patch)
treef46baf46bc4895ecbd7fbcec6b5243f1a0bcc1ab /gdb/cli/cli-interp.c
parent3f75a984d27da2801a9c4237b2b40917c68d6f19 (diff)
downloadgdb-8782926771b1212acb90b944f7402466c998d592.zip
gdb-8782926771b1212acb90b944f7402466c998d592.tar.gz
gdb-8782926771b1212acb90b944f7402466c998d592.tar.bz2
gdb: add interp::on_normal_stop method
Same idea as the previous patch, but for the normal_stop event. Change-Id: I4fc8ca8a51c63829dea390a2b6ce30b77f9fb863
Diffstat (limited to 'gdb/cli/cli-interp.c')
-rw-r--r--gdb/cli/cli-interp.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 51c78d9..9508171 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -112,10 +112,8 @@ should_print_stop_to_console (struct interp *console_interp,
interpreter-exec), print nothing. These are named "cli_base" as
they print to both CLI interpreters and TUI interpreters. */
-/* Observer for the normal_stop notification. */
-
-static void
-cli_base_on_normal_stop (struct bpstat *bs, int print_frame)
+void
+cli_interp_base::on_normal_stop (struct bpstat *bs, int print_frame)
{
if (!print_frame)
return;
@@ -124,17 +122,10 @@ cli_base_on_normal_stop (struct bpstat *bs, int print_frame)
if (cli_suppress_notification.normal_stop)
return;
- SWITCH_THRU_ALL_UIS ()
- {
- struct interp *interp = top_level_interpreter ();
- cli_interp_base *cli = as_cli_interp_base (interp);
- if (cli == nullptr)
- continue;
+ thread_info *thread = inferior_thread ();
+ if (should_print_stop_to_console (this, thread))
+ print_stop_event (this->interp_ui_out ());
- thread_info *thread = inferior_thread ();
- if (should_print_stop_to_console (interp, thread))
- print_stop_event (cli->interp_ui_out ());
- }
}
void
@@ -397,8 +388,6 @@ _initialize_cli_interp ()
interp_factory_register (INTERP_CONSOLE, cli_interp_factory);
/* Note these all work for both the CLI and TUI interpreters. */
- gdb::observers::normal_stop.attach (cli_base_on_normal_stop,
- "cli-interp-base");
gdb::observers::signal_exited.attach (cli_base_on_signal_exited,
"cli-interp-base");
gdb::observers::exited.attach (cli_base_on_exited, "cli-interp-base");