diff options
Diffstat (limited to 'darwin-user/main.c')
-rw-r--r-- | darwin-user/main.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/darwin-user/main.c b/darwin-user/main.c index 175e12f96..a6dc85921 100644 --- a/darwin-user/main.c +++ b/darwin-user/main.c @@ -738,6 +738,8 @@ TaskState *first_task_state; int main(int argc, char **argv) { const char *filename; + const char *log_file = DEBUG_LOGFILE; + const char *log_mask = NULL; struct target_pt_regs regs1, *regs = ®s1; TaskState ts1, *ts = &ts1; CPUState *env; @@ -749,9 +751,6 @@ int main(int argc, char **argv) if (argc <= 1) usage(); - /* init debug */ - cpu_set_log_filename(DEBUG_LOGFILE); - optind = 1; for(;;) { if (optind >= argc) @@ -764,22 +763,15 @@ int main(int argc, char **argv) if (!strcmp(r, "-")) { break; } else if (!strcmp(r, "d")) { - int mask; - CPULogItem *item; - - if (optind >= argc) - break; - - r = argv[optind++]; - mask = cpu_str_to_log_mask(r); - 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); + if (optind >= argc) { + break; } - cpu_set_log(mask); + log_mask = argv[optind++]; + } else if (!strcmp(r, "D")) { + if (optind >= argc) { + break; + } + log_file = argv[optind++]; } else if (!strcmp(r, "s")) { r = argv[optind++]; stack_size = strtol(r, (char **)&r, 0); @@ -821,6 +813,23 @@ int main(int argc, char **argv) usage(); filename = argv[optind]; + /* init debug */ + cpu_set_log_filename(log_file); + if (log_mask) { + int mask; + CPULogItem *item; + + mask = cpu_str_to_log_mask(r); + 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); + } + /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs)); |