Commit e19e89a5d4e9416f054116765fc0c2674ddd371f
1 parent
f193c797
more log items
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@676 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
6 changed files
with
68 additions
and
73 deletions
linux-user/main.c
... | ... | @@ -847,7 +847,18 @@ int main(int argc, char **argv) |
847 | 847 | if (!strcmp(r, "-")) { |
848 | 848 | break; |
849 | 849 | } else if (!strcmp(r, "d")) { |
850 | - cpu_set_log(CPU_LOG_ALL); | |
850 | + int mask; | |
851 | + CPULogItem *item; | |
852 | + | |
853 | + mask = cpu_str_to_log_mask(optarg); | |
854 | + if (!mask) { | |
855 | + printf("Log items (comma separated):\n"); | |
856 | + for(item = cpu_log_items; item->mask != 0; item++) { | |
857 | + printf("%-10s %s\n", item->name, item->help); | |
858 | + } | |
859 | + exit(1); | |
860 | + } | |
861 | + cpu_set_log(mask); | |
851 | 862 | } else if (!strcmp(r, "s")) { |
852 | 863 | r = argv[optind++]; |
853 | 864 | x86_stack_size = strtol(r, (char **)&r, 0); | ... | ... |
target-arm/translate.c
... | ... | @@ -777,15 +777,16 @@ static inline int gen_intermediate_code_internal(CPUState *env, |
777 | 777 | *gen_opc_ptr = INDEX_op_end; |
778 | 778 | |
779 | 779 | #ifdef DEBUG_DISAS |
780 | - if (loglevel) { | |
780 | + if (loglevel & CPU_LOG_TB_IN_ASM) { | |
781 | 781 | fprintf(logfile, "----------------\n"); |
782 | 782 | fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start)); |
783 | - disas(logfile, pc_start, dc->pc - pc_start, 0, 0); | |
784 | - fprintf(logfile, "\n"); | |
785 | - | |
786 | - fprintf(logfile, "OP:\n"); | |
787 | - dump_ops(gen_opc_buf, gen_opparam_buf); | |
783 | + disas(logfile, pc_start, dc->pc - pc_start, 0, 0); | |
788 | 784 | fprintf(logfile, "\n"); |
785 | + if (loglevel & (CPU_LOG_TB_OP)) { | |
786 | + fprintf(logfile, "OP:\n"); | |
787 | + dump_ops(gen_opc_buf, gen_opparam_buf); | |
788 | + fprintf(logfile, "\n"); | |
789 | + } | |
789 | 790 | } |
790 | 791 | #endif |
791 | 792 | if (!search_pc) | ... | ... |
target-i386/helper.c
... | ... | @@ -290,7 +290,7 @@ static void switch_tss(int tss_selector, |
290 | 290 | |
291 | 291 | type = (e2 >> DESC_TYPE_SHIFT) & 0xf; |
292 | 292 | #ifdef DEBUG_PCALL |
293 | - if (loglevel) | |
293 | + if (loglevel & CPU_LOG_PCALL) | |
294 | 294 | fprintf(logfile, "switch_tss: sel=0x%04x type=%d src=%d\n", tss_selector, type, source); |
295 | 295 | #endif |
296 | 296 | |
... | ... | @@ -858,68 +858,43 @@ void do_interrupt_user(int intno, int is_int, int error_code, |
858 | 858 | } |
859 | 859 | |
860 | 860 | /* |
861 | - * Begin excution of an interruption. is_int is TRUE if coming from | |
861 | + * Begin execution of an interruption. is_int is TRUE if coming from | |
862 | 862 | * the int instruction. next_eip is the EIP value AFTER the interrupt |
863 | 863 | * instruction. It is only relevant if is_int is TRUE. |
864 | 864 | */ |
865 | 865 | void do_interrupt(int intno, int is_int, int error_code, |
866 | 866 | unsigned int next_eip, int is_hw) |
867 | 867 | { |
868 | -#if 0 | |
869 | - { | |
870 | - extern FILE *stdout; | |
871 | - static int count; | |
872 | - if (env->cr[0] & CR0_PE_MASK) { | |
873 | - fprintf(stdout, "%d: v=%02x e=%04x i=%d CPL=%d CS:EIP=%04x:%08x SS:ESP=%04x:%08x", | |
868 | +#ifdef DEBUG_PCALL | |
869 | + if (loglevel & (CPU_LOG_PCALL | CPU_LOG_INT)) { | |
870 | + if ((env->cr[0] & CR0_PE_MASK)) { | |
871 | + static int count; | |
872 | + fprintf(logfile, "%6d: v=%02x e=%04x i=%d cpl=%d IP=%04x:%08x SP=%04x:%08x", | |
874 | 873 | count, intno, error_code, is_int, |
875 | 874 | env->hflags & HF_CPL_MASK, |
876 | 875 | env->segs[R_CS].selector, EIP, |
877 | 876 | env->segs[R_SS].selector, ESP); |
878 | 877 | if (intno == 0x0e) { |
879 | - fprintf(stdout, " CR2=%08x", env->cr[2]); | |
878 | + fprintf(logfile, " CR2=%08x", env->cr[2]); | |
880 | 879 | } else { |
881 | - fprintf(stdout, " EAX=%08x", env->regs[R_EAX]); | |
880 | + fprintf(logfile, " EAX=%08x", env->regs[R_EAX]); | |
882 | 881 | } |
883 | - fprintf(stdout, "\n"); | |
884 | - | |
885 | - if (0) { | |
886 | - cpu_x86_dump_state(env, stdout, X86_DUMP_CCOP); | |
882 | + fprintf(logfile, "\n"); | |
887 | 883 | #if 0 |
888 | - { | |
889 | - int i; | |
890 | - uint8_t *ptr; | |
891 | - fprintf(stdout, " code="); | |
892 | - ptr = env->segs[R_CS].base + env->eip; | |
893 | - for(i = 0; i < 16; i++) { | |
894 | - fprintf(stdout, " %02x", ldub(ptr + i)); | |
895 | - } | |
896 | - fprintf(stdout, "\n"); | |
884 | + cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP); | |
885 | + { | |
886 | + int i; | |
887 | + uint8_t *ptr; | |
888 | + fprintf(logfile, " code="); | |
889 | + ptr = env->segs[R_CS].base + env->eip; | |
890 | + for(i = 0; i < 16; i++) { | |
891 | + fprintf(logfile, " %02x", ldub(ptr + i)); | |
897 | 892 | } |
898 | -#endif | |
893 | + fprintf(logfile, "\n"); | |
899 | 894 | } |
900 | - count++; | |
901 | - } | |
902 | - } | |
903 | 895 | #endif |
904 | -#ifdef DEBUG_PCALL | |
905 | - if (loglevel) { | |
906 | - static int count; | |
907 | - fprintf(logfile, "%d: interrupt: vector=%02x error_code=%04x int=%d\n", | |
908 | - count, intno, error_code, is_int); | |
909 | - cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP); | |
910 | -#if 0 | |
911 | - { | |
912 | - int i; | |
913 | - uint8_t *ptr; | |
914 | - fprintf(logfile, " code="); | |
915 | - ptr = env->segs[R_CS].base + env->eip; | |
916 | - for(i = 0; i < 16; i++) { | |
917 | - fprintf(logfile, " %02x", ldub(ptr + i)); | |
918 | - } | |
919 | - fprintf(logfile, "\n"); | |
896 | + count++; | |
920 | 897 | } |
921 | -#endif | |
922 | - count++; | |
923 | 898 | } |
924 | 899 | #endif |
925 | 900 | if (env->cr[0] & CR0_PE_MASK) { |
... | ... | @@ -1365,9 +1340,9 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip) |
1365 | 1340 | new_cs = T0; |
1366 | 1341 | new_eip = T1; |
1367 | 1342 | #ifdef DEBUG_PCALL |
1368 | - if (loglevel) { | |
1369 | - fprintf(logfile, "lcall %04x:%08x\n", | |
1370 | - new_cs, new_eip); | |
1343 | + if (loglevel & CPU_LOG_PCALL) { | |
1344 | + fprintf(logfile, "lcall %04x:%08x s=%d\n", | |
1345 | + new_cs, new_eip, shift); | |
1371 | 1346 | cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP); |
1372 | 1347 | } |
1373 | 1348 | #endif |
... | ... | @@ -1377,7 +1352,7 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip) |
1377 | 1352 | raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc); |
1378 | 1353 | cpl = env->hflags & HF_CPL_MASK; |
1379 | 1354 | #ifdef DEBUG_PCALL |
1380 | - if (loglevel) { | |
1355 | + if (loglevel & CPU_LOG_PCALL) { | |
1381 | 1356 | fprintf(logfile, "desc=%08x:%08x\n", e1, e2); |
1382 | 1357 | } |
1383 | 1358 | #endif |
... | ... | @@ -1466,8 +1441,8 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip) |
1466 | 1441 | /* to inner priviledge */ |
1467 | 1442 | get_ss_esp_from_tss(&ss, &sp, dpl); |
1468 | 1443 | #ifdef DEBUG_PCALL |
1469 | - if (loglevel) | |
1470 | - fprintf(logfile, "ss=%04x sp=%04x param_count=%d ESP=%x\n", | |
1444 | + if (loglevel & CPU_LOG_PCALL) | |
1445 | + fprintf(logfile, "new ss:esp=%04x:%08x param_count=%d ESP=%x\n", | |
1471 | 1446 | ss, sp, param_count, ESP); |
1472 | 1447 | #endif |
1473 | 1448 | if ((ss & 0xfffc) == 0) |
... | ... | @@ -1626,9 +1601,9 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend) |
1626 | 1601 | POPW(ssp, sp, sp_mask, new_eflags); |
1627 | 1602 | } |
1628 | 1603 | #ifdef DEBUG_PCALL |
1629 | - if (loglevel) { | |
1630 | - fprintf(logfile, "lret new %04x:%08x addend=0x%x\n", | |
1631 | - new_cs, new_eip, addend); | |
1604 | + if (loglevel & CPU_LOG_PCALL) { | |
1605 | + fprintf(logfile, "lret new %04x:%08x s=%d addend=0x%x\n", | |
1606 | + new_cs, new_eip, shift, addend); | |
1632 | 1607 | cpu_x86_dump_state(env, logfile, X86_DUMP_CCOP); |
1633 | 1608 | } |
1634 | 1609 | #endif |
... | ... | @@ -1673,6 +1648,12 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend) |
1673 | 1648 | POPW(ssp, sp, sp_mask, new_esp); |
1674 | 1649 | POPW(ssp, sp, sp_mask, new_ss); |
1675 | 1650 | } |
1651 | +#ifdef DEBUG_PCALL | |
1652 | + if (loglevel & CPU_LOG_PCALL) { | |
1653 | + fprintf(logfile, "new ss:esp=%04x:%08x\n", | |
1654 | + new_ss, new_esp); | |
1655 | + } | |
1656 | +#endif | |
1676 | 1657 | |
1677 | 1658 | if ((new_ss & 3) != rpl) |
1678 | 1659 | raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc); | ... | ... |
target-i386/translate-copy.c
... | ... | @@ -1237,7 +1237,7 @@ static inline int gen_intermediate_code_internal(CPUState *env, |
1237 | 1237 | } |
1238 | 1238 | |
1239 | 1239 | #ifdef DEBUG_DISAS |
1240 | - if (loglevel) { | |
1240 | + if (loglevel & CPU_LOG_TB_IN_ASM) { | |
1241 | 1241 | fprintf(logfile, "----------------\n"); |
1242 | 1242 | fprintf(logfile, "IN: COPY: %s fpu=%d\n", |
1243 | 1243 | lookup_symbol(pc_start), | ... | ... |
target-i386/translate.c
... | ... | @@ -4595,16 +4595,16 @@ static inline int gen_intermediate_code_internal(CPUState *env, |
4595 | 4595 | } |
4596 | 4596 | |
4597 | 4597 | #ifdef DEBUG_DISAS |
4598 | - if (loglevel) { | |
4598 | + if (loglevel & CPU_LOG_TB_IN_ASM) { | |
4599 | 4599 | fprintf(logfile, "----------------\n"); |
4600 | 4600 | fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start)); |
4601 | 4601 | disas(logfile, pc_start, pc_ptr - pc_start, 0, !dc->code32); |
4602 | 4602 | fprintf(logfile, "\n"); |
4603 | -#if 0 | |
4604 | - fprintf(logfile, "OP:\n"); | |
4605 | - dump_ops(gen_opc_buf, gen_opparam_buf); | |
4606 | - fprintf(logfile, "\n"); | |
4607 | -#endif | |
4603 | + if (loglevel & CPU_LOG_TB_OP) { | |
4604 | + fprintf(logfile, "OP:\n"); | |
4605 | + dump_ops(gen_opc_buf, gen_opparam_buf); | |
4606 | + fprintf(logfile, "\n"); | |
4607 | + } | |
4608 | 4608 | } |
4609 | 4609 | #endif |
4610 | 4610 | |
... | ... | @@ -4612,7 +4612,7 @@ static inline int gen_intermediate_code_internal(CPUState *env, |
4612 | 4612 | optimize_flags(gen_opc_buf, gen_opc_ptr - gen_opc_buf); |
4613 | 4613 | |
4614 | 4614 | #ifdef DEBUG_DISAS |
4615 | - if (loglevel) { | |
4615 | + if (loglevel & CPU_LOG_TB_OP_OPT) { | |
4616 | 4616 | fprintf(logfile, "AFTER FLAGS OPT:\n"); |
4617 | 4617 | dump_ops(gen_opc_buf, gen_opparam_buf); |
4618 | 4618 | fprintf(logfile, "\n"); | ... | ... |
target-sparc/translate.c
... | ... | @@ -800,14 +800,16 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb, |
800 | 800 | } |
801 | 801 | *gen_opc_ptr = INDEX_op_end; |
802 | 802 | #ifdef DEBUG_DISAS |
803 | - if (loglevel) { | |
803 | + if (loglevel & CPU_LOG_TB_IN_ASM) { | |
804 | 804 | fprintf(logfile, "--------------\n"); |
805 | 805 | fprintf(logfile, "IN: %s\n", lookup_symbol((uint8_t *)pc_start)); |
806 | 806 | disas(logfile, (uint8_t *)pc_start, last_pc + 4 - pc_start, 0, 0); |
807 | 807 | fprintf(logfile, "\n"); |
808 | - fprintf(logfile, "OP:\n"); | |
809 | - dump_ops(gen_opc_buf, gen_opparam_buf); | |
810 | - fprintf(logfile, "\n"); | |
808 | + if (loglevel & CPU_LOG_TB_OP) { | |
809 | + fprintf(logfile, "OP:\n"); | |
810 | + dump_ops(gen_opc_buf, gen_opparam_buf); | |
811 | + fprintf(logfile, "\n"); | |
812 | + } | |
811 | 813 | } |
812 | 814 | #endif |
813 | 815 | ... | ... |