diff options
author | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2021-04-22 17:22:39 +0200 |
---|---|---|
committer | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2021-04-22 17:22:39 +0200 |
commit | 4efeb0d3e8ee210cd61b15355cca39b16b66004d (patch) | |
tree | 4c74b54f1e733a7a222d618091b06c6fca18237d /gdb/inferior.h | |
parent | c4c493de2bbfc7414d0ec51f40f17cd7b1ff74f2 (diff) | |
download | gdb-4efeb0d3e8ee210cd61b15355cca39b16b66004d.zip gdb-4efeb0d3e8ee210cd61b15355cca39b16b66004d.tar.gz gdb-4efeb0d3e8ee210cd61b15355cca39b16b66004d.tar.bz2 |
gdb/continuations: turn continuation functions into inferior methods
Turn continuations-related functions into methods of the inferior
class. This is a refactoring.
gdb/ChangeLog:
2021-04-22 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* Makefile.in (COMMON_SFILES): Remove continuations.c.
* inferior.c (inferior::add_continuation): New method, adapted
from 'add_inferior_continuation'.
(inferior::do_all_continuations): New method, adapted from
'do_all_inferior_continuations'.
(inferior::~inferior): Clear the list of continuations directly.
* inferior.h (class inferior) <continuations>: Rename into...
<m_continuations>: ...this and make private.
* continuations.c: Remove.
* continuations.h: Remove.
* event-top.c: Don't include "continuations.h".
Update the users below.
* inf-loop.c (inferior_event_handler)
* infcmd.c (attach_command)
(notice_new_inferior): Update.
Diffstat (limited to 'gdb/inferior.h')
-rw-r--r-- | gdb/inferior.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gdb/inferior.h b/gdb/inferior.h index 9e7291a..e0a7d62 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -422,6 +422,14 @@ public: inline safe_inf_threads_range threads_safe () { return safe_inf_threads_range (this->thread_list); } + /* Continuations-related methods. A continuation is an std::function + to be called to finish the execution of a command when running + GDB asynchronously. A continuation is executed after any thread + of this inferior stops. Continuations are used by the attach + command and the remote target when a new inferior is detected. */ + void add_continuation (std::function<void ()> &&cont); + void do_all_continuations (); + /* Set/get file name for default use for standard in/out in the inferior. On Unix systems, we try to make TERMINAL_NAME the inferior's controlling terminal. If TERMINAL_NAME is nullptr or @@ -508,10 +516,6 @@ public: /* True if we're in the process of detaching from this inferior. */ bool detaching = false; - /* What is left to do for an execution command after any thread of - this inferior stops. */ - std::list<std::function<void ()>> continuations; - /* True if setup_inferior wasn't called for this inferior yet. Until that is done, we must not access inferior memory or registers, as we haven't determined the target @@ -559,6 +563,9 @@ private: /* The name of terminal device to use for I/O. */ gdb::unique_xmalloc_ptr<char> m_terminal; + + /* The list of continuations. */ + std::list<std::function<void ()>> m_continuations; }; /* Keep a registry of per-inferior data-pointers required by other GDB |