summaryrefslogblamecommitdiffstats
path: root/include/exec/log.h
blob: 4a7375a45fb5520936ef3ff6493605e1b3b97e76 (plain) (tree)
1
2
3
4
5



                       
                        











                                                          



                                      

















                                                                         
      
#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)
{
    FILE *f = qemu_log_trylock();
    if (f) {
        cpu_dump_state(cpu, f, flags);
        qemu_log_unlock(f);
    }
}

/**
 * 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