diff options
author | bellard | 2003-03-03 16:02:29 +0100 |
---|---|---|
committer | bellard | 2003-03-03 16:02:29 +0100 |
commit | 586314f2aa62990dead8144e780c4c8c498eece6 (patch) | |
tree | 59e8e588860b7430214833f82da84c762612c9b4 /op-i386.c | |
parent | prints hello world (diff) | |
download | qemu-586314f2aa62990dead8144e780c4c8c498eece6.tar.gz qemu-586314f2aa62990dead8144e780c4c8c498eece6.tar.xz qemu-586314f2aa62990dead8144e780c4c8c498eece6.zip |
better debug support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@18 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'op-i386.c')
-rw-r--r-- | op-i386.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -1,3 +1,5 @@ +#define DEBUG_EXEC + typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; @@ -10,6 +12,11 @@ typedef signed long long int64_t; #define NULL 0 +typedef struct FILE FILE; +extern FILE *logfile; +extern int loglevel; +extern int fprintf(FILE *, const char *, ...); + #ifdef __i386__ register int T0 asm("esi"); register int T1 asm("ebx"); @@ -1636,6 +1643,32 @@ void OPPROTO op_fcos(void) /* main execution loop */ uint8_t code_gen_buffer[65536]; +#ifdef DEBUG_EXEC +static const char *cc_op_str[] = { + "DYNAMIC", + "EFLAGS", + "MUL", + "ADDB", + "ADDW", + "ADDL", + "SUBB", + "SUBW", + "SUBL", + "LOGICB", + "LOGICW", + "LOGICL", + "INCB", + "INCW", + "INCL", + "DECB", + "DECW", + "DECL", + "SHLB", + "SHLW", + "SHLL", +}; +#endif + int cpu_x86_exec(CPUX86State *env1) { int saved_T0, saved_T1, saved_A0; @@ -1653,6 +1686,17 @@ int cpu_x86_exec(CPUX86State *env1) /* prepare setjmp context for exception handling */ if (setjmp(env->jmp_env) == 0) { for(;;) { +#ifdef DEBUG_EXEC + if (loglevel) { + fprintf(logfile, + "EAX=%08x EBX=%08X ECX=%08x EDX=%08x\n" + "ESI=%08x ESI=%08X EBP=%08x ESP=%08x\n" + "CCS=%08x CCD=%08x CCOP=%s\n", + env->regs[R_EAX], env->regs[R_EBX], env->regs[R_ECX], env->regs[R_EDX], + env->regs[R_ESI], env->regs[R_EDI], env->regs[R_EBP], env->regs[R_ESP], + env->cc_src, env->cc_dst, cc_op_str[env->cc_op]); + } +#endif cpu_x86_gen_code(code_gen_buffer, &code_gen_size, (uint8_t *)env->pc); /* execute the generated code */ gen_func = (void *)code_gen_buffer; |