*/
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qemu/error-report.h"
#include "qemu/cutils.h"
#include "cpu.h"
#ifdef CONFIG_USER_ONLY
#define MAX_PACKET_LENGTH 4096
-#include "cpu.h"
#include "qemu/sockets.h"
+#include "sysemu/hw_accel.h"
#include "sysemu/kvm.h"
#include "exec/semihost.h"
#include "exec/exec-all.h"
*p = s;
if (g_pos) {
if (g_pos != s->base_reg) {
- fprintf(stderr, "Error: Bad gdb register numbering for '%s'\n"
- "Expected %d got %d\n", xml, g_pos, s->base_reg);
+ error_report("Error: Bad gdb register numbering for '%s', "
+ "expected %d got %d", xml, g_pos, s->base_reg);
} else {
cpu->gdb_num_g_regs = cpu->gdb_num_regs;
}
}
case 'k':
/* Kill the target */
- fprintf(stderr, "\nQEMU: Terminated via GDBstub\n");
+ error_report("QEMU: Terminated via GDBstub");
exit(0);
case 'D':
/* Detach packet */
break;
default:
bad_format:
- fprintf(stderr, "gdbstub: Bad syscall format string '%s'\n",
- fmt - 1);
+ error_report("gdbstub: Bad syscall format string '%s'",
+ fmt - 1);
break;
}
} else {
CharDriverState *mon_chr;
ChardevCommon common = { 0 };
+ if (!first_cpu) {
+ error_report("gdbstub: meaningless to attach gdb to a "
+ "machine without any CPU.");
+ return -1;
+ }
+
if (!device)
return -1;
if (strcmp(device, "none") != 0) {