Go to the documentation of this file.
40 #ifndef __X86EMU_DEBUG_H
41 #define __X86EMU_DEBUG_H
47 #define CHECK_IP_FETCH_F 0x1
48 #define CHECK_SP_ACCESS_F 0x2
49 #define CHECK_MEM_ACCESS_F 0x4
50 #define CHECK_DATA_ACCESS_F 0x8
53 # define CHECK_IP_FETCH() (M.x86.check & CHECK_IP_FETCH_F)
54 # define CHECK_SP_ACCESS() (M.x86.check & CHECK_SP_ACCESS_F)
55 # define CHECK_MEM_ACCESS() (M.x86.check & CHECK_MEM_ACCESS_F)
56 # define CHECK_DATA_ACCESS() (M.x86.check & CHECK_DATA_ACCESS_F)
58 # define CHECK_IP_FETCH()
59 # define CHECK_SP_ACCESS()
60 # define CHECK_MEM_ACCESS()
61 # define CHECK_DATA_ACCESS()
65 # define DEBUG_INSTRUMENT() (M.x86.debug & DEBUG_INSTRUMENT_F)
66 # define DEBUG_DECODE() (M.x86.debug & DEBUG_DECODE_F)
67 # define DEBUG_TRACE() (M.x86.debug & DEBUG_TRACE_F)
68 # define DEBUG_STEP() (M.x86.debug & DEBUG_STEP_F)
69 # define DEBUG_DISASSEMBLE() (M.x86.debug & DEBUG_DISASSEMBLE_F)
70 # define DEBUG_BREAK() (M.x86.debug & DEBUG_BREAK_F)
71 # define DEBUG_SVC() (M.x86.debug & DEBUG_SVC_F)
72 # define DEBUG_SAVE_IP_CS() (M.x86.debug & DEBUG_SAVE_IP_CS_F)
74 # define DEBUG_FS() (M.x86.debug & DEBUG_FS_F)
75 # define DEBUG_PROC() (M.x86.debug & DEBUG_PROC_F)
76 # define DEBUG_SYSINT() (M.x86.debug & DEBUG_SYSINT_F)
77 # define DEBUG_TRACECALL() (M.x86.debug & DEBUG_TRACECALL_F)
78 # define DEBUG_TRACECALLREGS() (M.x86.debug & DEBUG_TRACECALL_REGS_F)
79 # define DEBUG_SYS() (M.x86.debug & DEBUG_SYS_F)
80 # define DEBUG_MEM_TRACE() (M.x86.debug & DEBUG_MEM_TRACE_F)
81 # define DEBUG_IO_TRACE() (M.x86.debug & DEBUG_IO_TRACE_F)
82 # define DEBUG_DECODE_NOPRINT() (M.x86.debug & DEBUG_DECODE_NOPRINT_F)
84 # define DEBUG_INSTRUMENT() 0
85 # define DEBUG_DECODE() 0
86 # define DEBUG_TRACE() 0
87 # define DEBUG_STEP() 0
88 # define DEBUG_DISASSEMBLE() 0
89 # define DEBUG_BREAK() 0
90 # define DEBUG_SVC() 0
91 # define DEBUG_SAVE_IP_CS() 0
93 # define DEBUG_PROC() 0
94 # define DEBUG_SYSINT() 0
95 # define DEBUG_TRACECALL() 0
96 # define DEBUG_TRACECALLREGS() 0
97 # define DEBUG_SYS() 0
98 # define DEBUG_MEM_TRACE() 0
99 # define DEBUG_IO_TRACE() 0
100 # define DEBUG_DECODE_NOPRINT() 0
105 # define DECODE_PRINTF(x) if (DEBUG_DECODE()) \
106 x86emu_decode_printf(x)
107 # define DECODE_PRINTF2(x,y) if (DEBUG_DECODE()) \
108 x86emu_decode_printf2(x,y)
116 #define INC_DECODED_INST_LEN(x) \
117 if (DEBUG_DECODE()) \
118 x86emu_inc_decoded_inst_len(x)
120 #define SAVE_IP_CS(x,y) \
121 if (DEBUG_DECODE() | DEBUG_TRACECALL() | DEBUG_BREAK() \
122 | DEBUG_IO_TRACE() | DEBUG_SAVE_IP_CS()) { \
123 M.x86.saved_cs = x; \
124 M.x86.saved_ip = y; \
127 # define INC_DECODED_INST_LEN(x)
128 # define DECODE_PRINTF(x)
129 # define DECODE_PRINTF2(x,y)
130 # define SAVE_IP_CS(x,y)
134 #define TRACE_REGS() \
135 if (DEBUG_DISASSEMBLE()) { \
136 x86emu_just_disassemble(); \
137 goto EndOfTheInstructionProcedure; \
139 if (DEBUG_TRACE() || DEBUG_DECODE()) X86EMU_trace_regs()
141 # define TRACE_REGS()
145 # define SINGLE_STEP() if (DEBUG_STEP()) x86emu_single_step()
147 # define SINGLE_STEP()
150 #define TRACE_AND_STEP() \
155 # define START_OF_INSTR()
156 # define END_OF_INSTR() EndOfTheInstructionProcedure: x86emu_end_instr();
157 # define END_OF_INSTR_NO_TRACE() x86emu_end_instr();
159 # define START_OF_INSTR()
160 # define END_OF_INSTR()
161 # define END_OF_INSTR_NO_TRACE()
165 # define CALL_TRACE(u,v,w,x,s) \
166 if (DEBUG_TRACECALLREGS()) \
167 x86emu_dump_regs(); \
168 if (DEBUG_TRACECALL()) \
169 printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
170 # define RETURN_TRACE(n,u,v) \
171 if (DEBUG_TRACECALLREGS()) \
172 x86emu_dump_regs(); \
173 if (DEBUG_TRACECALL()) \
174 printk("%04x:%04x: %s\n",u,v,n);
176 # define CALL_TRACE(u,v,w,x,s)
177 # define RETURN_TRACE(n,u,v)