Commit cc38b844d71d3ee1dd15a8cce152431717e4e17b

Authored by bellard
1 parent c6105c0a

factorized debug code


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@408 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 14 deletions
linux-user/main.c
... ... @@ -28,8 +28,6 @@
28 28  
29 29 #define DEBUG_LOGFILE "/tmp/qemu.log"
30 30  
31   -FILE *logfile = NULL;
32   -int loglevel;
33 31 static const char *interp_prefix = CONFIG_QEMU_PREFIX;
34 32  
35 33 #ifdef __i386__
... ... @@ -367,7 +365,9 @@ int main(int argc, char **argv)
367 365 if (argc <= 1)
368 366 usage();
369 367  
370   - loglevel = 0;
  368 + /* init debug */
  369 + cpu_set_log_filename(DEBUG_LOGFILE);
  370 +
371 371 optind = 1;
372 372 for(;;) {
373 373 if (optind >= argc)
... ... @@ -380,7 +380,7 @@ int main(int argc, char **argv)
380 380 if (!strcmp(r, "-")) {
381 381 break;
382 382 } else if (!strcmp(r, "d")) {
383   - loglevel = 1;
  383 + cpu_set_log(CPU_LOG_ALL);
384 384 } else if (!strcmp(r, "s")) {
385 385 r = argv[optind++];
386 386 x86_stack_size = strtol(r, (char **)&r, 0);
... ... @@ -407,16 +407,6 @@ int main(int argc, char **argv)
407 407 usage();
408 408 filename = argv[optind];
409 409  
410   - /* init debug */
411   - if (loglevel) {
412   - logfile = fopen(DEBUG_LOGFILE, "w");
413   - if (!logfile) {
414   - perror(DEBUG_LOGFILE);
415   - _exit(1);
416   - }
417   - setvbuf(logfile, NULL, _IOLBF, 0);
418   - }
419   -
420 410 /* Zero out regs */
421 411 memset(regs, 0, sizeof(struct target_pt_regs));
422 412  
... ...