14e98e3e1Schristos /* Generic simulator stop. 2*88241920Schristos Copyright (C) 1997-2024 Free Software Foundation, Inc. 34e98e3e1Schristos Contributed by Cygnus Support. 44e98e3e1Schristos 54e98e3e1Schristos This file is part of GDB, the GNU debugger. 64e98e3e1Schristos 74e98e3e1Schristos This program is free software; you can redistribute it and/or modify 84e98e3e1Schristos it under the terms of the GNU General Public License as published by 94e98e3e1Schristos the Free Software Foundation; either version 3 of the License, or 104e98e3e1Schristos (at your option) any later version. 114e98e3e1Schristos 124e98e3e1Schristos This program is distributed in the hope that it will be useful, 134e98e3e1Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 144e98e3e1Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 154e98e3e1Schristos GNU General Public License for more details. 164e98e3e1Schristos 174e98e3e1Schristos You should have received a copy of the GNU General Public License 184e98e3e1Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 194e98e3e1Schristos 204b169a6bSchristos /* This must come before any other includes. */ 214b169a6bSchristos #include "defs.h" 224b169a6bSchristos 234e98e3e1Schristos #include "sim-main.h" 244e98e3e1Schristos #include "sim-assert.h" 254b169a6bSchristos #include "sim-signal.h" 264e98e3e1Schristos 274e98e3e1Schristos /* Generic implementation of sim_stop. */ 284e98e3e1Schristos 294e98e3e1Schristos static void 304e98e3e1Schristos control_c_simulation (SIM_DESC sd, 314e98e3e1Schristos void *data) 324e98e3e1Schristos { 334e98e3e1Schristos ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); 344e98e3e1Schristos sim_engine_halt (sd, NULL, NULL, NULL_CIA, sim_stopped, SIM_SIGINT); 354e98e3e1Schristos } 364e98e3e1Schristos 374e98e3e1Schristos int 384e98e3e1Schristos sim_stop (SIM_DESC sd) 394e98e3e1Schristos { 404e98e3e1Schristos ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); 414e98e3e1Schristos sim_events_schedule_after_signal (sd, 424e98e3e1Schristos 0 /*NOW*/, 434e98e3e1Schristos control_c_simulation, 444e98e3e1Schristos sd /*data*/); 454e98e3e1Schristos return 1; 464e98e3e1Schristos } 47