2e5b09fd0e
Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20190709152053.16670-2-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> [Rebased onto merge commit 95a9457fd44; missed instances of qom/cpu.h in comments replaced]
61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
#ifndef QEMU_EXEC_LOG_H
|
|
#define QEMU_EXEC_LOG_H
|
|
|
|
#include "qemu/log.h"
|
|
#include "hw/core/cpu.h"
|
|
#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)
|
|
{
|
|
if (qemu_log_enabled()) {
|
|
cpu_dump_state(cpu, qemu_logfile, flags);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|
|
}
|
|
|
|
#ifdef NEED_CPU_H
|
|
/* disas() and target_disas() to qemu_logfile: */
|
|
static inline void log_target_disas(CPUState *cpu, target_ulong start,
|
|
target_ulong len)
|
|
{
|
|
target_disas(qemu_logfile, cpu, start, len);
|
|
}
|
|
|
|
static inline void log_disas(void *code, unsigned long size)
|
|
{
|
|
disas(qemu_logfile, code, size);
|
|
}
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
/* page_dump() output to the log file: */
|
|
static inline void log_page_dump(void)
|
|
{
|
|
page_dump(qemu_logfile);
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
#endif
|