From patchwork Tue Sep 6 13:15:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 3886 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 6D28A23EFD for ; Tue, 6 Sep 2011 13:15:55 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 44630A185FA for ; Tue, 6 Sep 2011 13:15:55 +0000 (UTC) Received: by fxd18 with SMTP id 18so6253254fxd.11 for ; Tue, 06 Sep 2011 06:15:55 -0700 (PDT) Received: by 10.223.76.201 with SMTP id d9mr416944fak.119.1315314954799; Tue, 06 Sep 2011 06:15:54 -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.152.11.8 with SMTP id m8cs97403lab; Tue, 6 Sep 2011 06:15:54 -0700 (PDT) Received: by 10.227.28.30 with SMTP id k30mr125933wbc.98.1315314953782; Tue, 06 Sep 2011 06:15:53 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id fb17si371412wbb.63.2011.09.06.06.15.53 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Sep 2011 06:15:53 -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 1R0vVG-00043N-B1; Tue, 06 Sep 2011 14:15:50 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio Subject: [PATCH] linux-user: Exit with an error if we couldn't set up gdbserver Date: Tue, 6 Sep 2011 14:15:50 +0100 Message-Id: <1315314950-15558-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 If gdbserver_start() fails (usually because we couldn't bind to the requested TCP port) then exit qemu rather than blithely continuing. This brings the linux-user behaviour in to line with system mode. Signed-off-by: Peter Maydell --- linux-user/main.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 89a51d7..7268997 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3568,7 +3568,11 @@ int main(int argc, char **argv, char **envp) #endif if (gdbstub_port) { - gdbserver_start (gdbstub_port); + if (gdbserver_start(gdbstub_port) < 0) { + fprintf(stderr, "qemu: could not open gdbserver on port %d\n", + gdbstub_port); + exit(1); + } gdb_handlesig(env, 0); } cpu_loop(env);