From patchwork Thu Nov 20 12:05:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Ionescu X-Patchwork-Id: 412664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46CEE14010F for ; Thu, 20 Nov 2014 23:05:58 +1100 (AEDT) Received: from localhost ([::1]:34861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrQUm-0003vo-SX for incoming@patchwork.ozlabs.org; Thu, 20 Nov 2014 07:05:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrQUQ-0003eo-7V for qemu-devel@nongnu.org; Thu, 20 Nov 2014 07:05:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrQUK-00072I-VB for qemu-devel@nongnu.org; Thu, 20 Nov 2014 07:05:34 -0500 Received: from [109.99.239.84] (port=34177 helo=ilg-mbp.local) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrQUK-00072A-OZ for qemu-devel@nongnu.org; Thu, 20 Nov 2014 07:05:28 -0500 Received: by ilg-mbp.local (Postfix, from userid 501) id 6446A2E53C65; Thu, 20 Nov 2014 14:05:21 +0200 (EET) From: Liviu Ionescu To: qemu-devel@nongnu.org Date: Thu, 20 Nov 2014 14:05:18 +0200 Message-Id: <1416485118-75534-1-git-send-email-ilg@livius.net> X-Mailer: git-send-email 1.9.3 (Apple Git-50) X-detected-operating-system: by eggs.gnu.org: iOS iPhone or iPad X-Received-From: 109.99.239.84 Cc: peter.maydell@linaro.org, ilg@livius.net Subject: [Qemu-devel] [PATCH] armv7m: optional -kernel if -gdb present 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 For standalone emulation, the image must be specified via -kernel, but when using QEMU as a GDB server, the presence of -kernel is no longer mandatory, since the image can be loaded by the GDB client. Signed-off-by: Liviu Ionescu --- hw/arm/armv7m.c | 3 ++- include/sysemu/sysemu.h | 1 + vl.c | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 696de12..9d1669c 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -14,6 +14,7 @@ #include "sysemu/qtest.h" #include "qemu/error-report.h" #include "hw/boards.h" +#include "sysemu/sysemu.h" static struct arm_boot_info armv7m_binfo; @@ -241,7 +242,7 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory, big_endian = 0; #endif - if (!kernel_filename && !qtest_enabled()) { + if (!kernel_filename && !qtest_enabled() && !with_gdb) { fprintf(stderr, "Guest image must be specified (using -kernel)\n"); exit(1); } diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index c145d94..08bbe71 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -104,6 +104,7 @@ typedef enum DisplayType } DisplayType; extern int autostart; +extern int with_gdb; typedef enum { VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, diff --git a/vl.c b/vl.c index a88e5da..4a03fb8 100644 --- a/vl.c +++ b/vl.c @@ -138,6 +138,7 @@ bool enable_mlock = false; int nb_nics; NICInfo nd_table[MAX_NICS]; int autostart; +int with_gdb; static int rtc_utc = 1; static int rtc_date_offset = -1; /* -1 means no change */ QEMUClockType rtc_clock; @@ -2797,6 +2798,7 @@ int main(int argc, char **argv, char **envp) uint64_t ram_slots = 0; FILE *vmstate_dump_file = NULL; Error *main_loop_err = NULL; + with_gdb = false; atexit(qemu_run_exit_notifiers); error_set_progname(argv[0]); @@ -3241,9 +3243,11 @@ int main(int argc, char **argv, char **envp) break; case QEMU_OPTION_s: add_device_config(DEV_GDB, "tcp::" DEFAULT_GDBSTUB_PORT); + with_gdb = true; break; case QEMU_OPTION_gdb: add_device_config(DEV_GDB, optarg); + with_gdb = true; break; case QEMU_OPTION_L: if (data_dir_idx < ARRAY_SIZE(data_dir)) { @@ -4443,7 +4447,8 @@ int main(int argc, char **argv, char **envp) error_free(local_err); exit(1); } - } else if (autostart) { + } else if (autostart && kernel_filename) { + /* If an image is defined and no -S is requested, start it. */ vm_start(); }