From patchwork Mon Jul 18 10:44:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 2738 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0A9E324352 for ; Mon, 18 Jul 2011 10:44:16 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id C77B0A18431 for ; Mon, 18 Jul 2011 10:44:15 +0000 (UTC) Received: by qyk10 with SMTP id 10so1729258qyk.11 for ; Mon, 18 Jul 2011 03:44:15 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr4802633qcc.148.1310985854961; Mon, 18 Jul 2011 03:44:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs50970qcb; Mon, 18 Jul 2011 03:44:14 -0700 (PDT) Received: by 10.216.18.72 with SMTP id k50mr5367444wek.49.1310985853797; Mon, 18 Jul 2011 03:44:13 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id u54si7495289wec.52.2011.07.18.03.44.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Jul 2011 03:44:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QilJ3-0001hS-Au; Mon, 18 Jul 2011 11:44:09 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Blue Swirl Subject: [PATCH] user: Restore debug usage message for '-d ?' in user mode emulation Date: Mon, 18 Jul 2011 11:44:09 +0100 Message-Id: <1310985849-6511-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 The code which prints the debug usage message on '-d ?' for *-user has to come before the check for "not enough arguments", so that "qemu-foo -d ?" prints the list of possible debug log items rather than the generic usage message. (This was inadvertently broken in commit c235d73.) Signed-off-by: Peter Maydell --- NB that I've tested the linux-user part of this fix but don't have access to bsd/darwin to test those files; however the change is identical for all three files so it should be OK... bsd-user/main.c | 8 +++++--- darwin-user/main.c | 8 +++++--- linux-user/main.c | 11 ++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 6018a41..a63b877 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -856,9 +856,6 @@ int main(int argc, char **argv) usage(); } } - if (optind >= argc) - usage(); - filename = argv[optind]; /* init debug */ cpu_set_log_filename(log_file); @@ -877,6 +874,11 @@ int main(int argc, char **argv) cpu_set_log(mask); } + if (optind >= argc) { + usage(); + } + filename = argv[optind]; + /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs)); diff --git a/darwin-user/main.c b/darwin-user/main.c index 35196a1..72307ad 100644 --- a/darwin-user/main.c +++ b/darwin-user/main.c @@ -809,9 +809,6 @@ int main(int argc, char **argv) usage(); } } - if (optind >= argc) - usage(); - filename = argv[optind]; /* init debug */ cpu_set_log_filename(log_file); @@ -830,6 +827,11 @@ int main(int argc, char **argv) cpu_set_log(mask); } + if (optind >= argc) { + usage(); + } + filename = argv[optind]; + /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs)); diff --git a/linux-user/main.c b/linux-user/main.c index 289054b..8976b60 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3019,11 +3019,6 @@ int main(int argc, char **argv, char **envp) usage(); } } - if (optind >= argc) - usage(); - filename = argv[optind]; - exec_path = argv[optind]; - /* init debug */ cpu_set_log_filename(log_file); if (log_mask) { @@ -3041,6 +3036,12 @@ int main(int argc, char **argv, char **envp) cpu_set_log(mask); } + if (optind >= argc) { + usage(); + } + filename = argv[optind]; + exec_path = argv[optind]; + /* Zero out regs */ memset(regs, 0, sizeof(struct target_pt_regs));