aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-03-21 17:08:23 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-03-21 17:08:23 +0000
commite19e89a5d4e9416f054116765fc0c2674ddd371f (patch)
tree31b52135a0890b82e3f15e8fa90474f331ecd95f
parentf193c7979c2f7e4e021453689b5dd9c8abdcbbc4 (diff)
more log items
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@676 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--linux-user/main.c13
-rw-r--r--target-arm/translate.c13
-rw-r--r--target-i386/helper.c89
-rw-r--r--target-i386/translate-copy.c2
-rw-r--r--target-i386/translate.c14
-rw-r--r--target-sparc/translate.c10
6 files changed, 68 insertions, 73 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 5a8292b129..21ddf7aeb9 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -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);
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 3efd55ee3e..f405a232f9 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -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)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 6fc136763a..d08de8a8b4 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -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);
diff --git a/target-i386/translate-copy.c b/target-i386/translate-copy.c
index 08775e618d..fb0bcaa3cf 100644
--- a/target-i386/translate-copy.c
+++ b/target-i386/translate-copy.c
@@ -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),
diff --git a/target-i386/translate.c b/target-i386/translate.c
index f9823a49d1..12a74435ff 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -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");
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 321b4eba4d..41decb18ff 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -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