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: 113560 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 9679DB6F68 for ; Tue, 6 Sep 2011 23:16:41 +1000 (EST) Received: from localhost ([::1]:39546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0vVx-0007YY-0V for incoming@patchwork.ozlabs.org; Tue, 06 Sep 2011 09:16:33 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0vVj-0007V0-S8 for qemu-devel@nongnu.org; Tue, 06 Sep 2011 09:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0vVQ-0001eW-IJ for qemu-devel@nongnu.org; Tue, 06 Sep 2011 09:16:10 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:52518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0vVQ-0001dk-6S for qemu-devel@nongnu.org; Tue, 06 Sep 2011 09:16:00 -0400 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 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Riku Voipio , patches@linaro.org Subject: [Qemu-devel] [PATCH] linux-user: Exit with an error if we couldn't set up gdbserver 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 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);