Fix to 'gdb detach' stub
PATCH 1/1 Fix to 'gdb detach' stub
With this patch, 'gdb detach' correctly resumes the inferior execution after detaching the debugger.
The bug was caused by qemu asking gdb to execute a syscall (isatty) after the detach, and then waiting (forever) for the reply. I fixed this by properly setting gdb_syscall_mode appropriately in the 'detach' packet handling, so subsequent syscalls are solved by qemu rather than gdb.
I tested this manually.
Please commit it for me if accepted, since I don't have write privileges.
Thanks!
Daniel.
2010-02-22 Daniel Gutson <[email protected]>
* gdbstub.c (gdb_handle_packet): set
gdb_syscall_mode properly.
Signature · 3 lines
Daniel Gutson CodeSourcery www.codesourcery.com
gdbstub.c +1 -0
@@ -1848,6 +1848,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)case 'D' :/* Detach packet */ gdb_breakpoint_remove_all (); + gdb_syscall_mode =GDB_SYS_DISABLED ;gdb_continue (s);put_packet (s,"OK" );break ;
[Re-done with git.]
With this patch, 'gdb detach' correctly resumes the inferior execution after detaching the debugger.
The bug was caused by qemu asking gdb to execute a syscall (isatty) after the detach, and then waiting (forever) for the reply. I fixed this by properly setting gdb_syscall_mode appropriately in the 'detach' packet handling, so subsequent syscalls are solved by qemu rather than gdb.
--- gdbstub.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
gdbstub.c +1 -0
@@ -1848,6 +1848,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)case 'D' :/* Detach packet */ gdb_breakpoint_remove_all (); + gdb_syscall_mode =GDB_SYS_DISABLED ;gdb_continue (s);put_packet (s,"OK" );break ;
Signature · 1 line
1.6.2.4
Am 22.02.2010 22:22, schrieb Daniel Gutson:
Quoted 18 lines
[Re-done with git.]
With this patch, 'gdb detach' correctly resumes the inferior execution after detaching the debugger.
The bug was caused by qemu asking gdb to execute a syscall (isatty) after the detach, and then waiting (forever) for the reply. I fixed this by properly settinggdb_syscall_modeappropriately in the 'detach' packet handling, so subsequent syscalls are solved by qemu rather than gdb.Signed-off-by Daniel Gutson <[email protected]>--- gdbstub.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)gdbstub.c +0
-0
gdbstub.c static int gdb_handle_packet(GDBState *s, const · line 1848
Quoted 1 line
gdbstub.c +0
-0@@ -1848,6 +1848,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
This line wrap corrupts the patch. Have you tried git send-email?
gdbstub.c static int gdb_handle_packet(GDBState *s, const char *line_buf) · line 1851
Quoted 4 lines
gdbstub.c +1
-0case 'D' :/* Detach packet */ gdb_breakpoint_remove_all (); + gdb_syscall_mode =GDB_SYS_DISABLED ;
And indentation is off here (qemu uses four spaces, no tabs).
Kevin