1 #ifndef QEMU_EXEC_LOG_H
2 #define QEMU_EXEC_LOG_H
5 #include "hw/core/cpu.h"
6 #include "disas/disas.h"
8 /* cpu_dump_state() logging functions: */
11 * @cpu: The CPU whose state is to be logged.
12 * @flags: Flags what to log.
14 * Logs the output of cpu_dump_state().
16 static inline void log_cpu_state(CPUState *cpu, int flags)
20 if (qemu_log_enabled()) {
22 logfile = atomic_rcu_read(&qemu_logfile);
24 cpu_dump_state(cpu, logfile->fd, flags);
32 * @mask: Mask when to log.
33 * @cpu: The CPU whose state is to be logged.
34 * @flags: Flags what to log.
36 * Logs the output of cpu_dump_state() if loglevel includes @mask.
38 static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
40 if (qemu_loglevel & mask) {
41 log_cpu_state(cpu, flags);
46 /* disas() and target_disas() to qemu_logfile: */
47 static inline void log_target_disas(CPUState *cpu, target_ulong start,
52 logfile = atomic_rcu_read(&qemu_logfile);
54 target_disas(logfile->fd, cpu, start, len);
59 static inline void log_disas(void *code, unsigned long size, const char *note)
63 logfile = atomic_rcu_read(&qemu_logfile);
65 disas(logfile->fd, code, size, note);
70 #if defined(CONFIG_USER_ONLY)
71 /* page_dump() output to the log file: */
72 static inline void log_page_dump(const char *operation)
74 FILE *logfile = qemu_log_lock();
76 qemu_log("page layout changed following %s\n", operation);
79 qemu_log_unlock(logfile);