* [patch/gdbserver] Handle early interrupts
@ 2004-02-28 18:14 Daniel Jacobowitz
2004-02-29 16:47 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Jacobowitz @ 2004-02-28 18:14 UTC (permalink / raw)
To: gdb-patches
This patch lets gdbserver start expecting control-C as soon as we begin
resuming threads, instead of as soon as we begin waiting. On slow targets,
especially if one of the threads is scheduled right after the PTRACE_CONT
and before gdbserver has finished waking its siblings, there can be a long
delay. Until this arbitrary, sometimes very long, delay has passed, any
control-C sent by the client will be ignored. The easy solution is to
enable, but block, SIGIO; then unblock it when we're ready and the OS
will automatically deliver it then.
Will commit in a little while. Tested on arm-linux using gdbserver
(I've forgotten to mention that for the last few patches, but it's true of
all of them).
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-02-28 Daniel Jacobowitz <drow@mvista.com>
* linux-low.c (linux_wait): Unblock async I/O.
(linux_resume): Block and enable async I/O.
* remote-utils.c (block_async_io, unblock_async_io): New functions.
* server.h (block_async_io, unblock_async_io): Add prototypes.
Index: gdb/gdbserver/linux-low.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.27
diff -u -p -r1.27 linux-low.c
--- gdb/gdbserver/linux-low.c 31 Jan 2004 22:19:31 -0000 1.27
+++ gdb/gdbserver/linux-low.c 27 Feb 2004 21:34:28 -0000
@@ -662,6 +662,7 @@ retry:
}
enable_async_io ();
+ unblock_async_io ();
w = linux_wait_for_event (child);
stop_all_processes ();
disable_async_io ();
@@ -1017,7 +1018,11 @@ linux_resume (struct thread_resume *resu
if (pending_flag)
for_each_inferior (&all_threads, linux_queue_one_thread);
else
- for_each_inferior (&all_threads, linux_continue_one_thread);
+ {
+ block_async_io ();
+ enable_async_io ();
+ for_each_inferior (&all_threads, linux_continue_one_thread);
+ }
}
#ifdef HAVE_LINUX_USRREGS
Index: gdb/gdbserver/remote-utils.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.17
diff -u -p -r1.17 remote-utils.c
--- gdb/gdbserver/remote-utils.c 5 Jun 2003 14:26:58 -0000 1.17
+++ gdb/gdbserver/remote-utils.c 27 Feb 2004 20:54:11 -0000
@@ -366,6 +368,24 @@ input_interrupt (int unused)
}
void
+block_async_io (void)
+{
+ sigset_t sigio_set;
+ sigemptyset (&sigio_set);
+ sigaddset (&sigio_set, SIGIO);
+ sigprocmask (SIG_BLOCK, &sigio_set, NULL);
+}
+
+void
+unblock_async_io (void)
+{
+ sigset_t sigio_set;
+ sigemptyset (&sigio_set);
+ sigaddset (&sigio_set, SIGIO);
+ sigprocmask (SIG_UNBLOCK, &sigio_set, NULL);
+}
+
+void
enable_async_io (void)
{
signal (SIGIO, input_interrupt);
Index: gdb/gdbserver/server.h
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/gdbserver/server.h,v
retrieving revision 1.13
diff -u -p -r1.13 server.h
--- gdb/gdbserver/server.h 29 Jun 2003 04:01:39 -0000 1.13
+++ gdb/gdbserver/server.h 27 Feb 2004 16:15:53 -0000
@@ -134,6 +134,8 @@ void write_ok (char *buf);
void write_enn (char *buf);
void enable_async_io (void);
void disable_async_io (void);
+void unblock_async_io (void);
+void block_async_io (void);
void convert_ascii_to_int (char *from, char *to, int n);
void convert_int_to_ascii (char *from, char *to, int n);
void new_thread_notify (int id);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch/gdbserver] Handle early interrupts
2004-02-28 18:14 [patch/gdbserver] Handle early interrupts Daniel Jacobowitz
@ 2004-02-29 16:47 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2004-02-29 16:47 UTC (permalink / raw)
To: gdb-patches
On Sat, Feb 28, 2004 at 01:13:59PM -0500, Daniel Jacobowitz wrote:
> This patch lets gdbserver start expecting control-C as soon as we begin
> resuming threads, instead of as soon as we begin waiting. On slow targets,
> especially if one of the threads is scheduled right after the PTRACE_CONT
> and before gdbserver has finished waking its siblings, there can be a long
> delay. Until this arbitrary, sometimes very long, delay has passed, any
> control-C sent by the client will be ignored. The easy solution is to
> enable, but block, SIGIO; then unblock it when we're ready and the OS
> will automatically deliver it then.
>
> Will commit in a little while. Tested on arm-linux using gdbserver
> (I've forgotten to mention that for the last few patches, but it's true of
> all of them).
> 2004-02-28 Daniel Jacobowitz <drow@mvista.com>
>
> * linux-low.c (linux_wait): Unblock async I/O.
> (linux_resume): Block and enable async I/O.
> * remote-utils.c (block_async_io, unblock_async_io): New functions.
> * server.h (block_async_io, unblock_async_io): Add prototypes.
Committed to HEAD.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-29 16:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-28 18:14 [patch/gdbserver] Handle early interrupts Daniel Jacobowitz
2004-02-29 16:47 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox