1#ifndef QEMU_LOG_H
2#define QEMU_LOG_H
3
4
5#include "qemu/log-for-trace.h"
6
7
8
9
10
11
12bool qemu_log_enabled(void);
13
14
15bool qemu_log_separate(void);
16
17#define CPU_LOG_TB_OUT_ASM (1 << 0)
18#define CPU_LOG_TB_IN_ASM (1 << 1)
19#define CPU_LOG_TB_OP (1 << 2)
20#define CPU_LOG_TB_OP_OPT (1 << 3)
21#define CPU_LOG_INT (1 << 4)
22#define CPU_LOG_EXEC (1 << 5)
23#define CPU_LOG_PCALL (1 << 6)
24#define CPU_LOG_TB_CPU (1 << 8)
25#define CPU_LOG_RESET (1 << 9)
26#define LOG_UNIMP (1 << 10)
27#define LOG_GUEST_ERROR (1 << 11)
28#define CPU_LOG_MMU (1 << 12)
29#define CPU_LOG_TB_NOCHAIN (1 << 13)
30#define CPU_LOG_PAGE (1 << 14)
31
32#define CPU_LOG_TB_OP_IND (1 << 16)
33#define CPU_LOG_TB_FPU (1 << 17)
34#define CPU_LOG_PLUGIN (1 << 18)
35
36#define LOG_STRACE (1 << 19)
37#define LOG_PER_THREAD (1 << 20)
38
39
40
41FILE *qemu_log_trylock(void) G_GNUC_WARN_UNUSED_RESULT;
42void qemu_log_unlock(FILE *fd);
43
44
45
46
47
48
49
50
51#define qemu_log_mask(MASK, FMT, ...) \
52 do { \
53 if (unlikely(qemu_loglevel_mask(MASK))) { \
54 qemu_log(FMT, ## __VA_ARGS__); \
55 } \
56 } while (0)
57
58
59
60
61
62
63
64
65#define qemu_log_mask_and_addr(MASK, ADDR, FMT, ...) \
66 do { \
67 if (unlikely(qemu_loglevel_mask(MASK)) && \
68 qemu_log_in_addr_range(ADDR)) { \
69 qemu_log(FMT, ## __VA_ARGS__); \
70 } \
71 } while (0)
72
73
74
75
76typedef struct QEMULogItem {
77 int mask;
78 const char *name;
79 const char *help;
80} QEMULogItem;
81
82extern const QEMULogItem qemu_log_items[];
83
84bool qemu_set_log(int log_flags, Error **errp);
85bool qemu_set_log_filename(const char *filename, Error **errp);
86bool qemu_set_log_filename_flags(const char *name, int flags, Error **errp);
87void qemu_set_dfilter_ranges(const char *ranges, Error **errp);
88bool qemu_log_in_addr_range(uint64_t addr);
89int qemu_str_to_log_mask(const char *str);
90
91
92
93
94void qemu_print_log_usage(FILE *f);
95
96#endif
97