aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-04-21 09:45:30 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-05-30 15:07:26 -0400
commit8e7af8434581e325366c8ec4a30f33e8e1794310 (patch)
treef2073eea71cd755cc2bc51dc0520e9e5d23a0d3e /gdb/mi
parent30e7e0a917b44cbef439cb9c52fa41d21a5f8e44 (diff)
downloadgdb-8e7af8434581e325366c8ec4a30f33e8e1794310.zip
gdb-8e7af8434581e325366c8ec4a30f33e8e1794310.tar.gz
gdb-8e7af8434581e325366c8ec4a30f33e8e1794310.tar.bz2
gdb: add interp::on_thread_exited method
Same idea as previous patches, but for thread_exited. Change-Id: I4be974cbe58cf635453fef503c2d77c82522cbd9
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-interp.c25
-rw-r--r--gdb/mi/mi-interp.h1
2 files changed, 8 insertions, 18 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 7090331..db8f69c 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -60,7 +60,6 @@ static int mi_interp_query_hook (const char *ctlstr, va_list ap)
static void mi_insert_notify_hooks (void);
static void mi_remove_notify_hooks (void);
-static void mi_thread_exit (struct thread_info *t, int silent);
static void mi_record_changed (struct inferior*, int, const char *,
const char *);
static void mi_inferior_added (struct inferior *inf);
@@ -317,23 +316,14 @@ mi_interp::on_new_thread (thread_info *t)
gdb_flush (this->event_channel);
}
-static void
-mi_thread_exit (struct thread_info *t, int silent)
+void
+mi_interp::on_thread_exited (thread_info *t, int silent)
{
- SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
-
- if (mi == NULL)
- continue;
-
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "thread-exited,id=\"%d\",group-id=\"i%d\"",
- t->global_num, t->inf->num);
- gdb_flush (mi->event_channel);
- }
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
+ gdb_printf (this->event_channel, "thread-exited,id=\"%d\",group-id=\"i%d\"",
+ t->global_num, t->inf->num);
+ gdb_flush (this->event_channel);
}
/* Emit notification on changing the state of record. */
@@ -1179,7 +1169,6 @@ _initialize_mi_interp ()
interp_factory_register (INTERP_MI4, mi_interp_factory);
interp_factory_register (INTERP_MI, mi_interp_factory);
- gdb::observers::thread_exit.attach (mi_thread_exit, "mi-interp");
gdb::observers::inferior_added.attach (mi_inferior_added, "mi-interp");
gdb::observers::inferior_appeared.attach (mi_inferior_appeared, "mi-interp");
gdb::observers::inferior_exit.attach (mi_inferior_exit, "mi-interp");
diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h
index 72e3c21..97fd634 100644
--- a/gdb/mi/mi-interp.h
+++ b/gdb/mi/mi-interp.h
@@ -51,6 +51,7 @@ public:
void on_command_error () override;
void on_user_selected_context_changed (user_selected_what selection) override;
void on_new_thread (thread_info *t) override;
+ void on_thread_exited (thread_info *t, int silent) override;
/* MI's output channels */
mi_console_file *out;