gdbstub: do not restart crashed guest
PATCH 1/1 gdbstub: do not restart crashed guest
If a guest has crashed with an internal error or similar, detaching gdb (or any other debugger action) should not restart it.
--- gdbstub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
gdbstub.c +3 -1
@@ -371,7 +371,9 @@ static inline void gdb_continue(GDBState *s)#ifdef CONFIG_USER_ONLY s->running_state =1 ;#else -vm_start (); +if (runstate_check (RUN_STATE_DEBUG )) { +vm_start (); + }#endif }
Signature · 1 line
1.8.1.4
Quoted 15 lines · Paolo Bonzini
If a guest has crashed with an internal error or similar, detaching gdb (or any other debugger action) should not restart it.
Cc Jan Kiszka <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- gdbstub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)gdbstub.c +0
-0
gdbstub.c static inline void gdb_continue(GDBState *s) · line 379
Quoted 10 lines
gdbstub.c +3
-1@@ -371,7 +371,9 @@ static inline void gdb_continue(GDBState *s)#ifdef CONFIG_USER_ONLY s->running_state =1 ;#else -vm_start (); +if (runstate_check (RUN_STATE_DEBUG )) { +vm_start (); + }#endif }
I sought to check the gdb_continue() call sites, and uses of RUN_STATE_DEBUG. Seems reasonable.
(
FWIW I wonder why in commit ad02b96a Luiz allowed DEBUG -> SUSPENDED. As far as I understand, when the debugger is attached, the guest is not running, hence it can't go directly to RUN_STATE_SUSPENDED. Maybe due to a concurrent monitor command?
Technically it does seem possible; from main_loop_should_exit():
if (qemu_debug_requested()) {
vm_stop(RUN_STATE_DEBUG);
}
if (qemu_suspend_requested()) {
qemu_system_suspend();
}Both requests could become pending during one iteration of the loop, and the next iteration will see both of them. OK.
)
Laszlo
Quoted 30 lines · On Thu, 30 May 2013 13:55:50 +0200 Laszlo Ersek <[email protected]> wrote:
Quoted 15 lines · Paolo Bonzini
If a guest has crashed with an internal error or similar, detaching gdb (or any other debugger action) should not restart it.
Cc Jan Kiszka <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- gdbstub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)gdbstub.c +0
-0gdbstub.c static inline void gdb_continue(GDBState *s) · line 379
Quoted 10 lines
gdbstub.c +3
-1@@ -371,7 +371,9 @@ static inline void gdb_continue(GDBState *s)#ifdef CONFIG_USER_ONLY s->running_state =1 ;#else -vm_start (); +if (runstate_check (RUN_STATE_DEBUG )) { +vm_start (); + }#endif }I sought to check the
gdb_continue()call sites, and uses ofRUN_STATE_DEBUG. Seems reasonable.
Quoted 7 lines
Reviewed-by Laszlo Ersek <[email protected]>(
FWIW I wonder why in commitad02b96aLuiz allowed DEBUG -> SUSPENDED. As far as I understand, when the debugger is attached, the guest is not running, hence it can't go directly toRUN_STATE_SUSPENDED. Maybe due to a concurrent monitor command?
I honestly don't remember if I took into account the explanation you gave below. You're right that a stopped guest can't suspend.
Quoted 16 lines
Technically it does seem possible; from
main_loop_should_exit():if (qemu_debug_requested()) { vm_stop(RUN_STATE_DEBUG); } if (qemu_suspend_requested()) { qemu_system_suspend(); }Both requests could become pending during one iteration of the loop, and the next iteration will see both of them. OK.
)Laszlo
Anthony Liguori
AppliedApplied. Thanks.
Regards,
Anthony Liguori