1708b6a64SAlex Bennée /* 2708b6a64SAlex Bennée * exit support for qemu 3708b6a64SAlex Bennée * 4708b6a64SAlex Bennée * Copyright (c) 2018 Alex Bennée <alex.bennee@linaro.org> 5708b6a64SAlex Bennée * 6708b6a64SAlex Bennée * This program is free software; you can redistribute it and/or modify 7708b6a64SAlex Bennée * it under the terms of the GNU General Public License as published by 8708b6a64SAlex Bennée * the Free Software Foundation; either version 2 of the License, or 9708b6a64SAlex Bennée * (at your option) any later version. 10708b6a64SAlex Bennée * 11708b6a64SAlex Bennée * This program is distributed in the hope that it will be useful, 12708b6a64SAlex Bennée * but WITHOUT ANY WARRANTY; without even the implied warranty of 13708b6a64SAlex Bennée * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14708b6a64SAlex Bennée * GNU General Public License for more details. 15708b6a64SAlex Bennée * 16708b6a64SAlex Bennée * You should have received a copy of the GNU General Public License 17708b6a64SAlex Bennée * along with this program; if not, see <http://www.gnu.org/licenses/>. 18708b6a64SAlex Bennée */ 19708b6a64SAlex Bennée #include "qemu/osdep.h" 20708b6a64SAlex Bennée #include "qemu.h" 214cc600d2SPaolo Bonzini #ifdef CONFIG_GPROF 229b21a36cSAlex Bennée #include <sys/gmon.h> 239b21a36cSAlex Bennée #endif 24708b6a64SAlex Bennée 257781afb4SAlex Bennée #ifdef CONFIG_GCOV 267781afb4SAlex Bennée extern void __gcov_dump(void); 277781afb4SAlex Bennée #endif 287781afb4SAlex Bennée 29708b6a64SAlex Bennée void preexit_cleanup(CPUArchState *env, int code) 30708b6a64SAlex Bennée { 314cc600d2SPaolo Bonzini #ifdef CONFIG_GPROF 32708b6a64SAlex Bennée _mcleanup(); 33708b6a64SAlex Bennée #endif 347781afb4SAlex Bennée #ifdef CONFIG_GCOV 357781afb4SAlex Bennée __gcov_dump(); 367781afb4SAlex Bennée #endif 37*ad9dcb20SAlex Bennée gdb_exit(code); 388634d77bSEmilio G. Cota qemu_plugin_atexit_cb(); 39708b6a64SAlex Bennée } 40