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/continuations.c | |
parent | c4c493de2bbfc7414d0ec51f40f17cd7b1ff74f2 (diff) | |
download | binutils-4efeb0d3e8ee210cd61b15355cca39b16b66004d.zip binutils-4efeb0d3e8ee210cd61b15355cca39b16b66004d.tar.gz binutils-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/continuations.c')
-rw-r--r-- | gdb/continuations.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/gdb/continuations.c b/gdb/continuations.c deleted file mode 100644 index 2edfd98..0000000 --- a/gdb/continuations.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Continuations for GDB, the GNU debugger. - - Copyright (C) 1986-2021 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#include "defs.h" -#include "gdbthread.h" -#include "inferior.h" -#include "continuations.h" - -/* Add a continuation to the continuation list of INFERIOR. The new - continuation will be added at the front. */ - -void -add_inferior_continuation (std::function<void ()> &&cont) -{ - struct inferior *inf = current_inferior (); - - inf->continuations.emplace_front (std::move (cont)); -} - -/* Do all continuations of the current inferior. */ - -void -do_all_inferior_continuations () -{ - struct inferior *inf = current_inferior (); - while (!inf->continuations.empty ()) - { - auto iter = inf->continuations.begin (); - (*iter) (); - inf->continuations.erase (iter); - } -} - -/* Get rid of all the inferior-wide continuations of INF. */ - -void -discard_all_inferior_continuations (struct inferior *inf) -{ - inf->continuations.clear (); -} |