Patchwork Fix to 'gdb detach' stub

login
register
mail settings
Submitter Daniel Gutson
Date Feb. 22, 2010, 8:50 p.m.
Message ID <4B82EE07.80904@codesourcery.com>
Download mbox | patch
Permalink /patch/46001/
State New
Headers show

Comments

Daniel Gutson - Feb. 22, 2010, 8:50 p.m.
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  <dgutson@codesourcery.com>

	* gdbstub.c (gdb_handle_packet): set
	gdb_syscall_mode properly.

Patch

diff --git a/gdbstub.c b/gdbstub.c
index 91c5f68..92bb36d 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -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;