diff options
-rw-r--r-- | gdb/infrun.c | 12 | ||||
-rw-r--r-- | gdb/interps.h | 4 | ||||
-rw-r--r-- | gdb/mi/mi-interp.c | 13 | ||||
-rw-r--r-- | gdb/mi/mi-interp.h | 1 |
4 files changed, 19 insertions, 11 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c index d433430..4d6df75 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2894,6 +2894,16 @@ clear_proceed_status_thread (struct thread_info *tp) bpstat_clear (&tp->control.stop_bpstat); } +/* Notify the current interpreter and observers that the target is about to + proceed. */ + +static void +notify_about_to_proceed () +{ + top_level_interpreter ()->on_about_to_proceed (); + gdb::observers::about_to_proceed.notify (); +} + void clear_proceed_status (int step) { @@ -2936,7 +2946,7 @@ clear_proceed_status (int step) inferior->control.stop_soon = NO_STOP_QUIETLY; } - gdb::observers::about_to_proceed.notify (); + notify_about_to_proceed (); } /* Returns true if TP is still stopped at a breakpoint that needs diff --git a/gdb/interps.h b/gdb/interps.h index 3339ae3..a88c405 100644 --- a/gdb/interps.h +++ b/gdb/interps.h @@ -149,6 +149,10 @@ public: /* Notify the interpreter that solib SO has been unloaded. */ virtual void on_solib_unloaded (so_list *so) {} + /* Notify the interpreter that a command it is executing is about to cause + the inferior to proceed. */ + virtual void on_about_to_proceed () {} + private: /* The memory for this is static, it comes from literal strings (e.g. "cli"). */ const char *m_name; diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 072002d..dd17fd5 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_about_to_proceed (void); static void mi_traceframe_changed (int tfnum, int tpnum); static void mi_tsv_created (const struct trace_state_variable *tsv); static void mi_tsv_deleted (const struct trace_state_variable *tsv); @@ -469,8 +468,8 @@ mi_interp::on_normal_stop (struct bpstat *bs, int print_frame) gdb_flush (this->raw_stdout); } -static void -mi_about_to_proceed (void) +void +mi_interp::on_about_to_proceed () { /* Suppress output while calling an inferior function. */ @@ -482,12 +481,7 @@ mi_about_to_proceed (void) return; } - mi_interp *mi = as_mi_interp (top_level_interpreter ()); - - if (mi == nullptr) - return; - - mi->mi_proceeded = 1; + this->mi_proceeded = 1; } /* When the element is non-zero, no MI notifications will be emitted in @@ -1061,7 +1055,6 @@ _initialize_mi_interp () interp_factory_register (INTERP_MI4, mi_interp_factory); interp_factory_register (INTERP_MI, mi_interp_factory); - gdb::observers::about_to_proceed.attach (mi_about_to_proceed, "mi-interp"); gdb::observers::traceframe_changed.attach (mi_traceframe_changed, "mi-interp"); gdb::observers::tsv_created.attach (mi_tsv_created, "mi-interp"); diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h index 704f2d9..33177fc 100644 --- a/gdb/mi/mi-interp.h +++ b/gdb/mi/mi-interp.h @@ -61,6 +61,7 @@ public: void on_target_resumed (ptid_t ptid) override; void on_solib_loaded (so_list *so) override; void on_solib_unloaded (so_list *so) override; + void on_about_to_proceed () override; /* MI's output channels */ mi_console_file *out; |