1*6881a400Schristos /* Copyright (C) 2009-2023 Free Software Foundation, Inc. 27f2ac410Schristos 37f2ac410Schristos This file is part of GDB. 47f2ac410Schristos 57f2ac410Schristos This program is free software; you can redistribute it and/or modify 67f2ac410Schristos it under the terms of the GNU General Public License as published by 77f2ac410Schristos the Free Software Foundation; either version 3 of the License, or 87f2ac410Schristos (at your option) any later version. 97f2ac410Schristos 107f2ac410Schristos This program is distributed in the hope that it will be useful, 117f2ac410Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 127f2ac410Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 137f2ac410Schristos GNU General Public License for more details. 147f2ac410Schristos 157f2ac410Schristos You should have received a copy of the GNU General Public License 167f2ac410Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 177f2ac410Schristos 187f2ac410Schristos 197f2ac410Schristos #ifndef PROGSPACE_AND_THREAD_H 207f2ac410Schristos #define PROGSPACE_AND_THREAD_H 217f2ac410Schristos 227f2ac410Schristos #include "progspace.h" 237f2ac410Schristos #include "gdbthread.h" 247f2ac410Schristos 257f2ac410Schristos /* Save/restore the current program space, thread, inferior and frame. 267f2ac410Schristos Use this when you need to call 277f2ac410Schristos switch_to_program_space_and_thread. */ 287f2ac410Schristos 297f2ac410Schristos class scoped_restore_current_pspace_and_thread 307f2ac410Schristos { 317f2ac410Schristos scoped_restore_current_program_space m_restore_pspace; 327f2ac410Schristos scoped_restore_current_thread m_restore_thread; 337f2ac410Schristos }; 347f2ac410Schristos 357f2ac410Schristos /* Switches full context to program space PSPACE. Switches to the 367f2ac410Schristos first thread found bound to PSPACE, giving preference to the 377f2ac410Schristos current thread, if there's one and it isn't executing. */ 387f2ac410Schristos void switch_to_program_space_and_thread (program_space *pspace); 397f2ac410Schristos 407f2ac410Schristos #endif 41