From patchwork Sat Jul 30 12:18:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 107502 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 92CA4B6F64 for ; Sat, 30 Jul 2011 22:18:52 +1000 (EST) Received: from localhost ([::1]:42193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qn8VB-0006fj-Lj for incoming@patchwork.ozlabs.org; Sat, 30 Jul 2011 08:18:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]:37712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qn8V5-0006fQ-R6 for qemu-devel@nongnu.org; Sat, 30 Jul 2011 08:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qn8V4-0001HY-8J for qemu-devel@nongnu.org; Sat, 30 Jul 2011 08:18:39 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:39832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qn8V4-0001HM-1g for qemu-devel@nongnu.org; Sat, 30 Jul 2011 08:18:38 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1Qn8V1-00088C-FV; Sat, 30 Jul 2011 13:18:35 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Sat, 30 Jul 2011 13:18:35 +0100 Message-Id: <1312028315-31233-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: "Justin M. Forbes" Subject: [Qemu-devel] [PATCH][STABLE] user: Restore debug usage message for '-d ?' in user mode emulation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- This is just a retransmit of this patch (applied in master as 4b5dfd824) with the appropriate magic markers to say "please apply to 0.15 as well", since it's a regression from 0.14. 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 2135b9c..6a8f4bd 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3048,11 +3048,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) { @@ -3070,6 +3065,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));