qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] armv7m: optional -kernel if -gdb present


From: Liviu Ionescu
Subject: [Qemu-devel] [PATCH] armv7m: optional -kernel if -gdb present
Date: Thu, 20 Nov 2014 14:05:18 +0200

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 <address@hidden>
---
 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();
     }
 
-- 
1.9.3 (Apple Git-50)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]