When the VM goes into stop state while there is a gdb frontend attached,
it makes sense to inform gdb about this fact and at least a bit about
the stop reason. Basically, all stops are interesting except for the
temporary VMSTOP_SAVE/LOADVM.
The patch maps the relevant VMSTOP reasons on unique and more or less
associatable signals that gdb understands.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
enum {
GDB_SIGNAL_0 = 0,
GDB_SIGNAL_INT = 2,
enum {
GDB_SIGNAL_0 = 0,
GDB_SIGNAL_INT = 2,
+ GDB_SIGNAL_ABRT = 6,
+ GDB_SIGNAL_ALRM = 14,
+ GDB_SIGNAL_IO = 23,
+ GDB_SIGNAL_XCPU = 24,
GDB_SIGNAL_UNKNOWN = 143
};
GDB_SIGNAL_UNKNOWN = 143
};
const char *type;
int ret;
const char *type;
int ret;
- if (running || (reason != VMSTOP_DEBUG && reason != VMSTOP_USER) ||
- s->state == RS_INACTIVE || s->state == RS_SYSCALL) {
+ if (running || s->state == RS_INACTIVE || s->state == RS_SYSCALL) {
- /* disable single step if it was enable */
- cpu_single_step(env, 0);
-
- if (reason == VMSTOP_DEBUG) {
+ switch (reason) {
+ case VMSTOP_DEBUG:
if (env->watchpoint_hit) {
switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) {
case BP_MEM_READ:
if (env->watchpoint_hit) {
switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) {
case BP_MEM_READ:
"T%02xthread:%02x;%swatch:" TARGET_FMT_lx ";",
GDB_SIGNAL_TRAP, gdb_id(env), type,
env->watchpoint_hit->vaddr);
"T%02xthread:%02x;%swatch:" TARGET_FMT_lx ";",
GDB_SIGNAL_TRAP, gdb_id(env), type,
env->watchpoint_hit->vaddr);
env->watchpoint_hit = NULL;
env->watchpoint_hit = NULL;
+ break;
+ case VMSTOP_USER:
+ break;
+ case VMSTOP_SHUTDOWN:
+ ret = GDB_SIGNAL_QUIT;
+ break;
+ case VMSTOP_DISKFULL:
+ ret = GDB_SIGNAL_IO;
+ break;
+ case VMSTOP_WATCHDOG:
+ ret = GDB_SIGNAL_ALRM;
+ break;
+ case VMSTOP_PANIC:
+ ret = GDB_SIGNAL_ABRT;
+ break;
+ case VMSTOP_SAVEVM:
+ case VMSTOP_LOADVM:
+ return;
+ case VMSTOP_MIGRATE:
+ ret = GDB_SIGNAL_XCPU;
+ break;
+ default:
+ ret = GDB_SIGNAL_UNKNOWN;
+ break;
}
snprintf(buf, sizeof(buf), "T%02xthread:%02x;", ret, gdb_id(env));
}
snprintf(buf, sizeof(buf), "T%02xthread:%02x;", ret, gdb_id(env));
+
+ /* disable single step if it was enabled */
+ cpu_single_step(env, 0);