1 #ifndef QEMU_EXEC_LOG_H 2 #define QEMU_EXEC_LOG_H 3 4 #include "qemu/log.h" 5 #include "qom/cpu.h" 6 #include "disas/disas.h" 7 8 /* cpu_dump_state() logging functions: */ 9 /** 10 * log_cpu_state: 11 * @cpu: The CPU whose state is to be logged. 12 * @flags: Flags what to log. 13 * 14 * Logs the output of cpu_dump_state(). 15 */ 16 static inline void log_cpu_state(CPUState *cpu, int flags) 17 { 18 if (qemu_log_enabled()) { 19 cpu_dump_state(cpu, qemu_logfile, fprintf, flags); 20 } 21 } 22 23 /** 24 * log_cpu_state_mask: 25 * @mask: Mask when to log. 26 * @cpu: The CPU whose state is to be logged. 27 * @flags: Flags what to log. 28 * 29 * Logs the output of cpu_dump_state() if loglevel includes @mask. 30 */ 31 static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags) 32 { 33 if (qemu_loglevel & mask) { 34 log_cpu_state(cpu, flags); 35 } 36 } 37 38 #ifdef NEED_CPU_H 39 /* disas() and target_disas() to qemu_logfile: */ 40 static inline void log_target_disas(CPUState *cpu, target_ulong start, 41 target_ulong len, int flags) 42 { 43 target_disas(qemu_logfile, cpu, start, len, flags); 44 } 45 46 static inline void log_disas(void *code, unsigned long size) 47 { 48 disas(qemu_logfile, code, size); 49 } 50 51 #if defined(CONFIG_USER_ONLY) 52 /* page_dump() output to the log file: */ 53 static inline void log_page_dump(void) 54 { 55 page_dump(qemu_logfile); 56 } 57 #endif 58 #endif 59 60 #endif 61