mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2026-08-27 00:26:02 -04:00
gdb: introduce a per-interpreter event servicing method
This allows an interpreter to override internal calls to gdb_do_one_event in case the former needs to handle alternate event sources. The default action is to call gdb_do_one_event and this is not overriden in current internal interpreters. However this feature allows to easily embed Tcl/Tk in insight that needs to concurrently handle Tcl events for GUI handling. In all cases, an interpreter event servicing method must call gdb_do_one_event at some point. All internal event servicing calls from gdb now direct to the interpreter-specific method rather than gdb_do_one_event itself.
This commit is contained in:
parent
9197e8eebe
commit
568ec5b983
3 changed files with 11 additions and 3 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#define GDB_INTERPS_H
|
||||
|
||||
#include "gdbsupport/intrusive_list.h"
|
||||
#include "gdbsupport/event-loop.h"
|
||||
|
||||
struct bpstat;
|
||||
struct ui_out;
|
||||
|
|
@ -78,6 +79,13 @@ public:
|
|||
virtual void pre_command_loop ()
|
||||
{}
|
||||
|
||||
/* Service one event.
|
||||
This gives the interpreter a chance to handle its own private
|
||||
events that cannot be fed into the gdb event mechanism.
|
||||
In all cases, this should call gdb_do_one_event at some point. */
|
||||
virtual int do_one_event (int mstimeout = -1)
|
||||
{ return gdb_do_one_event (mstimeout); }
|
||||
|
||||
/* Returns true if this interpreter supports using the readline
|
||||
library; false if it uses GDB's own simplified readline
|
||||
emulation. */
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ start_event_loop ()
|
|||
|
||||
try
|
||||
{
|
||||
result = gdb_do_one_event ();
|
||||
result = current_interpreter ()->do_one_event ();
|
||||
}
|
||||
catch (const gdb_exception_forced_quit &ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ wait_sync_command_done (void)
|
|||
point. */
|
||||
scoped_enable_commit_resumed enable ("sync wait");
|
||||
|
||||
while (gdb_do_one_event () >= 0)
|
||||
while (current_interpreter ()->do_one_event () >= 0)
|
||||
if (ui->prompt_state != PROMPT_BLOCKED)
|
||||
break;
|
||||
}
|
||||
|
|
@ -1031,7 +1031,7 @@ gdb_readline_wrapper (const char *prompt)
|
|||
(*after_char_processing_hook) ();
|
||||
gdb_assert (after_char_processing_hook == NULL);
|
||||
|
||||
while (gdb_do_one_event () >= 0)
|
||||
while (current_interpreter ()->do_one_event () >= 0)
|
||||
if (gdb_readline_wrapper_done)
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue