summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-10-27 21:16:14 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-10-27 21:16:14 +0000
commitcc38b844d71d3ee1dd15a8cce152431717e4e17b (patch)
treed4a5d7fa40843d062102378bc180ed89548588eb
parentc6105c0a042ba0ecb59038f9f2edab8aa4322baf (diff)
downloadqemu-cc38b844d71d3ee1dd15a8cce152431717e4e17b.tar.gz
factorized debug code
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@408 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--linux-user/main.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 811b8bfba8..6df7b42c5e 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -28,8 +28,6 @@
#define DEBUG_LOGFILE "/tmp/qemu.log"
-FILE *logfile = NULL;
-int loglevel;
static const char *interp_prefix = CONFIG_QEMU_PREFIX;
#ifdef __i386__
@@ -367,7 +365,9 @@ int main(int argc, char **argv)
if (argc <= 1)
usage();
- loglevel = 0;
+ /* init debug */
+ cpu_set_log_filename(DEBUG_LOGFILE);
+
optind = 1;
for(;;) {
if (optind >= argc)
@@ -380,7 +380,7 @@ int main(int argc, char **argv)
if (!strcmp(r, "-")) {
break;
} else if (!strcmp(r, "d")) {
- loglevel = 1;
+ cpu_set_log(CPU_LOG_ALL);
} else if (!strcmp(r, "s")) {
r = argv[optind++];
x86_stack_size = strtol(r, (char **)&r, 0);
@@ -407,16 +407,6 @@ int main(int argc, char **argv)
usage();
filename = argv[optind];
- /* init debug */
- if (loglevel) {
- logfile = fopen(DEBUG_LOGFILE, "w");
- if (!logfile) {
- perror(DEBUG_LOGFILE);
- _exit(1);
- }
- setvbuf(logfile, NULL, _IOLBF, 0);
- }
-
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));