mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-03 04:01:22 +08:00
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.
This commit is contained in:
@ -31,7 +31,6 @@
|
||||
#include "symfile.h"
|
||||
#include "gdbsupport/environ.h"
|
||||
#include "cli/cli-utils.h"
|
||||
#include "continuations.h"
|
||||
#include "arch-utils.h"
|
||||
#include "target-descriptions.h"
|
||||
#include "readline/tilde.h"
|
||||
@ -74,7 +73,7 @@ inferior::~inferior ()
|
||||
{
|
||||
inferior *inf = this;
|
||||
|
||||
discard_all_inferior_continuations (inf);
|
||||
m_continuations.clear ();
|
||||
inferior_free_data (inf);
|
||||
xfree (inf->args);
|
||||
target_desc_info_free (inf->tdesc_info);
|
||||
@ -106,6 +105,23 @@ inferior::tty ()
|
||||
return m_terminal.get ();
|
||||
}
|
||||
|
||||
void
|
||||
inferior::add_continuation (std::function<void ()> &&cont)
|
||||
{
|
||||
m_continuations.emplace_front (std::move (cont));
|
||||
}
|
||||
|
||||
void
|
||||
inferior::do_all_continuations ()
|
||||
{
|
||||
while (!m_continuations.empty ())
|
||||
{
|
||||
auto iter = m_continuations.begin ();
|
||||
(*iter) ();
|
||||
m_continuations.erase (iter);
|
||||
}
|
||||
}
|
||||
|
||||
struct inferior *
|
||||
add_inferior_silent (int pid)
|
||||
{
|
||||
|
Reference in New Issue
Block a user