]> git.proxmox.com Git - mirror_qemu.git/commitdiff
more log items
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 21 Mar 2004 17:08:23 +0000 (17:08 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 21 Mar 2004 17:08:23 +0000 (17:08 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@676 c046a42c-6fe2-441c-8c8c-71466251a162

linux-user/main.c
target-arm/translate.c
target-i386/helper.c
target-i386/translate-copy.c
target-i386/translate.c
target-sparc/translate.c

index 5a8292b1296964e5b278c0c5a56d60be4bc6f16f..21ddf7aeb938ab4e5affc27609718c6efabb40c8 100644 (file)
@@ -847,7 +847,18 @@ int main(int argc, char **argv)
         if (!strcmp(r, "-")) {
             break;
         } else if (!strcmp(r, "d")) {
-            cpu_set_log(CPU_LOG_ALL);
+            int mask;
+            CPULogItem *item;
+            
+            mask = cpu_str_to_log_mask(optarg);
+            if (!mask) {
+                printf("Log items (comma separated):\n");
+                for(item = cpu_log_items; item->mask != 0; item++) {
+                    printf("%-10s %s\n", item->name, item->help);
+                }
+                exit(1);
+            }
+            cpu_set_log(mask);
         } else if (!strcmp(r, "s")) {
             r = argv[optind++];
             x86_stack_size = strtol(r, (char **)&r, 0);
index 3efd55ee3e2dc0340daca201e61c92fb44991740..f405a232f9ddf2f8c35488e7af41a94bc9544f41 100644 (file)
@@ -777,15 +777,16 @@ static inline int gen_intermediate_code_internal(CPUState *env,
     *gen_opc_ptr = INDEX_op_end;
 
 #ifdef DEBUG_DISAS
-    if (loglevel) {
+    if (loglevel & CPU_LOG_TB_IN_ASM) {
         fprintf(logfile, "----------------\n");
         fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start));
-       disas(logfile, pc_start, dc->pc - pc_start, 0, 0);
-        fprintf(logfile, "\n");
-
-        fprintf(logfile, "OP:\n");
-        dump_ops(gen_opc_buf, gen_opparam_buf);
+        disas(logfile, pc_start, dc->pc - pc_start, 0, 0);
         fprintf(logfile, "\n");
+        if (loglevel & (CPU_LOG_TB_OP)) {
+            fprintf(logfile, "OP:\n");
+            dump_ops(gen_opc_buf, gen_opparam_buf);
+            fprintf(logfile, "\n");
+        }
     }
 #endif
     if (!search_pc)
index 6fc136763a92751808efbdf26b7f5df129c28206..d08de8a8b4246dededf485f9841747f57a2f5976 100644 (file)
@@ -290,7 +290,7 @@ static void switch_tss(int tss_selector,
 
     type = (e2 >> DESC_TYPE_SHIFT) & 0xf;
 #ifdef DEBUG_PCALL
-    if (loglevel)
+    if (loglevel & CPU_LOG_PCALL)
         fprintf(logfile, "switch_tss: sel=0x%04x type=%d src=%d\n", tss_selector, type, source);
 #endif
 
@@ -858,68 +858,43 @@ void do_interrupt_user(int intno, int is_int, int error_code,
 }
 
 /*
- * Begin excution of an interruption. is_int is TRUE if coming from
+ * Begin execution of an interruption. is_int is TRUE if coming from
  * the int instruction. next_eip is the EIP value AFTER the interrupt
  * instruction. It is only relevant if is_int is TRUE.  
  */
 void do_interrupt(int intno, int is_int, int error_code, 
                   unsigned int next_eip, int is_hw)
 {
-#if 0
-    {
-        extern FILE *stdout;
-        static int count;
-        if (env->cr[0] & CR0_PE_MASK)  {
-            fprintf(stdout, "%d: v=%02x e=%04x i=%d CPL=%d CS:EIP=%04x:%08x SS:ESP=%04x:%08x",
+#ifdef DEBUG_PCALL
+    if (loglevel & (CPU_LOG_PCALL | CPU_LOG_INT)) {
+        if ((env->cr[0] & CR0_PE_MASK)) {
+            static int count;
+            fprintf(logfile, "%6d: v=%02x e=%04x i=%d cpl=%d IP=%04x:%08x SP=%04x:%08x",
                     count, intno, error_code, is_int,
                     env->hflags & HF_CPL_MASK,
                     env->segs[R_CS].selector, EIP,
                     env->segs[R_SS].selector, ESP);
             if (intno == 0x0e) {
-                fprintf(stdout, " CR2=%08x", env->cr[2]);
+                fprintf(logfile, " CR2=%08x", env->cr[2]);
             } else {
-                fprintf(stdout, " EAX=%08x", env->regs[R_EAX]);
+                fprintf(logfile, " EAX=%08x", env->regs[R_EAX]);
             }
-            fprintf(stdout, "\n");
-
-            if (0) {
-                cpu_x86_dump_state(env, stdout, X86_DUMP_CCOP);
+            fprintf(logfile, "\n");
 #if 0
-                {
-                    int i;
-                    uint8_t *ptr;
-                    fprintf(stdout, "       code=");
-                    ptr = env->segs[R_CS].base + env->eip;
-                    for(i = 0; i < 16; i++) {
-                        fprintf(stdout, " %02x", ldub(ptr + i));
-                    }
-                    fprintf(stdout, "\n");
+            cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
+            {
+                int i;
+                uint8_t *ptr;
+                fprintf(logfile, "       code=");
+                ptr = env->segs[R_CS].base + env->eip;
+                for(i = 0; i < 16; i++) {
+                    fprintf(logfile, " %02x", ldub(ptr + i));
                 }
-#endif
+                fprintf(logfile, "\n");
             }
-            count++;
-        }
-    }
 #endif
-#ifdef DEBUG_PCALL
-    if (loglevel) {
-        static int count;
-        fprintf(logfile, "%d: interrupt: vector=%02x error_code=%04x int=%d\n",
-                count, intno, error_code, is_int);
-        cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
-#if 0
-        {
-            int i;
-            uint8_t *ptr;
-            fprintf(logfile, "       code=");
-            ptr = env->segs[R_CS].base + env->eip;
-            for(i = 0; i < 16; i++) {
-                fprintf(logfile, " %02x", ldub(ptr + i));
-            }
-            fprintf(logfile, "\n");
+            count++;
         }
-#endif
-        count++;
     }
 #endif
     if (env->cr[0] & CR0_PE_MASK) {
@@ -1365,9 +1340,9 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip)
     new_cs = T0;
     new_eip = T1;
 #ifdef DEBUG_PCALL
-    if (loglevel) {
-        fprintf(logfile, "lcall %04x:%08x\n",
-                new_cs, new_eip);
+    if (loglevel & CPU_LOG_PCALL) {
+        fprintf(logfile, "lcall %04x:%08x s=%d\n",
+                new_cs, new_eip, shift);
         cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
     }
 #endif
@@ -1377,7 +1352,7 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip)
         raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
     cpl = env->hflags & HF_CPL_MASK;
 #ifdef DEBUG_PCALL
-    if (loglevel) {
+    if (loglevel & CPU_LOG_PCALL) {
         fprintf(logfile, "desc=%08x:%08x\n", e1, e2);
     }
 #endif
@@ -1466,8 +1441,8 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip)
             /* to inner priviledge */
             get_ss_esp_from_tss(&ss, &sp, dpl);
 #ifdef DEBUG_PCALL
-            if (loglevel)
-                fprintf(logfile, "ss=%04x sp=%04x param_count=%d ESP=%x\n", 
+            if (loglevel & CPU_LOG_PCALL)
+                fprintf(logfile, "new ss:esp=%04x:%08x param_count=%d ESP=%x\n", 
                         ss, sp, param_count, ESP);
 #endif
             if ((ss & 0xfffc) == 0)
@@ -1626,9 +1601,9 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
             POPW(ssp, sp, sp_mask, new_eflags);
     }
 #ifdef DEBUG_PCALL
-    if (loglevel) {
-        fprintf(logfile, "lret new %04x:%08x addend=0x%x\n",
-                new_cs, new_eip, addend);
+    if (loglevel & CPU_LOG_PCALL) {
+        fprintf(logfile, "lret new %04x:%08x s=%d addend=0x%x\n",
+                new_cs, new_eip, shift, addend);
         cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP);
     }
 #endif
@@ -1673,6 +1648,12 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
             POPW(ssp, sp, sp_mask, new_esp);
             POPW(ssp, sp, sp_mask, new_ss);
         }
+#ifdef DEBUG_PCALL
+        if (loglevel & CPU_LOG_PCALL) {
+            fprintf(logfile, "new ss:esp=%04x:%08x\n",
+                    new_ss, new_esp);
+        }
+#endif
         
         if ((new_ss & 3) != rpl)
             raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc);
index 08775e618d82c70d84c7920c1b32c956fd4b7ba2..fb0bcaa3cfcb6c04989f3da179b1ccb03a7e6722 100644 (file)
@@ -1237,7 +1237,7 @@ static inline int gen_intermediate_code_internal(CPUState *env,
     }
     
 #ifdef DEBUG_DISAS
-    if (loglevel) {
+    if (loglevel & CPU_LOG_TB_IN_ASM) {
         fprintf(logfile, "----------------\n");
         fprintf(logfile, "IN: COPY: %s fpu=%d\n", 
                 lookup_symbol(pc_start),
index f9823a49d19f15a36898a278e8e3f0f876846c35..12a74435ff444f22b148f57205e2cb74446d40a2 100644 (file)
@@ -4595,16 +4595,16 @@ static inline int gen_intermediate_code_internal(CPUState *env,
     }
         
 #ifdef DEBUG_DISAS
-    if (loglevel) {
+    if (loglevel & CPU_LOG_TB_IN_ASM) {
         fprintf(logfile, "----------------\n");
         fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start));
        disas(logfile, pc_start, pc_ptr - pc_start, 0, !dc->code32);
         fprintf(logfile, "\n");
-#if 0
-        fprintf(logfile, "OP:\n");
-        dump_ops(gen_opc_buf, gen_opparam_buf);
-        fprintf(logfile, "\n");
-#endif
+        if (loglevel & CPU_LOG_TB_OP) {
+            fprintf(logfile, "OP:\n");
+            dump_ops(gen_opc_buf, gen_opparam_buf);
+            fprintf(logfile, "\n");
+        }
     }
 #endif
 
@@ -4612,7 +4612,7 @@ static inline int gen_intermediate_code_internal(CPUState *env,
     optimize_flags(gen_opc_buf, gen_opc_ptr - gen_opc_buf);
 
 #ifdef DEBUG_DISAS
-    if (loglevel) {
+    if (loglevel & CPU_LOG_TB_OP_OPT) {
         fprintf(logfile, "AFTER FLAGS OPT:\n");
         dump_ops(gen_opc_buf, gen_opparam_buf);
         fprintf(logfile, "\n");
index 321b4eba4d68f256010105cd3651aad0a71a9ee2..41decb18ff1919d137a852121ff435d12286966a 100644 (file)
@@ -800,14 +800,16 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb,
     }
     *gen_opc_ptr = INDEX_op_end;
 #ifdef DEBUG_DISAS
-    if (loglevel) {
+    if (loglevel & CPU_LOG_TB_IN_ASM) {
        fprintf(logfile, "--------------\n");
        fprintf(logfile, "IN: %s\n", lookup_symbol((uint8_t *)pc_start));
        disas(logfile, (uint8_t *)pc_start, last_pc + 4 - pc_start, 0, 0);
        fprintf(logfile, "\n");
-       fprintf(logfile, "OP:\n");
-       dump_ops(gen_opc_buf, gen_opparam_buf);
-       fprintf(logfile, "\n");
+        if (loglevel & CPU_LOG_TB_OP) {
+            fprintf(logfile, "OP:\n");
+            dump_ops(gen_opc_buf, gen_opparam_buf);
+            fprintf(logfile, "\n");
+        }
     }
 #endif