2016-01-07 14:55:28 +01:00
|
|
|
#ifndef QEMU_EXEC_LOG_H
|
|
|
|
#define QEMU_EXEC_LOG_H
|
|
|
|
|
|
|
|
#include "qemu/log.h"
|
2019-07-09 17:20:52 +02:00
|
|
|
#include "hw/core/cpu.h"
|
2016-01-07 14:55:28 +01:00
|
|
|
#include "disas/disas.h"
|
|
|
|
|
|
|
|
/* cpu_dump_state() logging functions: */
|
|
|
|
/**
|
|
|
|
* log_cpu_state:
|
|
|
|
* @cpu: The CPU whose state is to be logged.
|
|
|
|
* @flags: Flags what to log.
|
|
|
|
*
|
|
|
|
* Logs the output of cpu_dump_state().
|
|
|
|
*/
|
|
|
|
static inline void log_cpu_state(CPUState *cpu, int flags)
|
|
|
|
{
|
2022-04-17 20:30:04 +02:00
|
|
|
FILE *f = qemu_log_trylock();
|
|
|
|
if (f) {
|
|
|
|
cpu_dump_state(cpu, f, flags);
|
|
|
|
qemu_log_unlock(f);
|
2016-01-07 14:55:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* log_cpu_state_mask:
|
|
|
|
* @mask: Mask when to log.
|
|
|
|
* @cpu: The CPU whose state is to be logged.
|
|
|
|
* @flags: Flags what to log.
|
|
|
|
*
|
|
|
|
* Logs the output of cpu_dump_state() if loglevel includes @mask.
|
|
|
|
*/
|
|
|
|
static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
|
|
|
|
{
|
|
|
|
if (qemu_loglevel & mask) {
|
|
|
|
log_cpu_state(cpu, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|