2
0

log.h 857 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef QEMU_EXEC_LOG_H
  2. #define QEMU_EXEC_LOG_H
  3. #include "qemu/log.h"
  4. #include "hw/core/cpu.h"
  5. #include "disas/disas.h"
  6. /* cpu_dump_state() logging functions: */
  7. /**
  8. * log_cpu_state:
  9. * @cpu: The CPU whose state is to be logged.
  10. * @flags: Flags what to log.
  11. *
  12. * Logs the output of cpu_dump_state().
  13. */
  14. static inline void log_cpu_state(CPUState *cpu, int flags)
  15. {
  16. FILE *f = qemu_log_trylock();
  17. if (f) {
  18. cpu_dump_state(cpu, f, flags);
  19. qemu_log_unlock(f);
  20. }
  21. }
  22. /**
  23. * log_cpu_state_mask:
  24. * @mask: Mask when to log.
  25. * @cpu: The CPU whose state is to be logged.
  26. * @flags: Flags what to log.
  27. *
  28. * Logs the output of cpu_dump_state() if loglevel includes @mask.
  29. */
  30. static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
  31. {
  32. if (qemu_loglevel & mask) {
  33. log_cpu_state(cpu, flags);
  34. }
  35. }
  36. #endif