2018-06-22 19:09:10 +03:00
|
|
|
/*
|
|
|
|
* exit support for qemu
|
|
|
|
*
|
|
|
|
* Copyright (c) 2018 Alex Bennée <alex.bennee@linaro.org>
|
|
|
|
*
|
|
|
|
* 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 2 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 "qemu/osdep.h"
|
2023-01-12 18:20:13 +03:00
|
|
|
#include "accel/tcg/perf.h"
|
2021-09-08 18:44:04 +03:00
|
|
|
#include "exec/gdbstub.h"
|
2018-06-22 19:09:10 +03:00
|
|
|
#include "qemu.h"
|
2021-09-08 18:44:03 +03:00
|
|
|
#include "user-internals.h"
|
2020-02-04 19:11:04 +03:00
|
|
|
#ifdef CONFIG_GPROF
|
2019-05-02 12:27:28 +03:00
|
|
|
#include <sys/gmon.h>
|
|
|
|
#endif
|
2018-06-22 19:09:10 +03:00
|
|
|
|
2018-06-22 19:23:44 +03:00
|
|
|
#ifdef CONFIG_GCOV
|
|
|
|
extern void __gcov_dump(void);
|
|
|
|
#endif
|
|
|
|
|
2018-06-22 19:09:10 +03:00
|
|
|
void preexit_cleanup(CPUArchState *env, int code)
|
|
|
|
{
|
2020-02-04 19:11:04 +03:00
|
|
|
#ifdef CONFIG_GPROF
|
2018-06-22 19:09:10 +03:00
|
|
|
_mcleanup();
|
2018-06-22 19:23:44 +03:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_GCOV
|
|
|
|
__gcov_dump();
|
2018-06-22 19:09:10 +03:00
|
|
|
#endif
|
2021-01-09 01:42:43 +03:00
|
|
|
gdb_exit(code);
|
2021-07-21 02:26:54 +03:00
|
|
|
qemu_plugin_user_exit();
|
2023-01-12 18:20:13 +03:00
|
|
|
perf_exit();
|
2018-06-22 19:09:10 +03:00
|
|
|
}
|