* remote-utils.c (remote_open): Do not call disable_async_io.
(block_async_io): Delete.
(unblock_async_io): Make static.
(initialize_async_io): New.
* server.c (handle_v_cont): Handle async I/O here.
(myresume): Likewise. Move other common resume tasks here...
(main): ... from here. Call initialize_async_io. Disable async
I/O before the main loop.
* server.h (initialize_async_io): Declare.
(block_async_io, unblock_async_io): Delete prototypes.
* spu-low.c (spu_resume, spu_wait): Do not handle async I/O here.
+2007-12-06 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * linux-low.c (linux_wait, linux_resume): Do not handle async I/O.
+ * remote-utils.c (remote_open): Do not call disable_async_io.
+ (block_async_io): Delete.
+ (unblock_async_io): Make static.
+ (initialize_async_io): New.
+ * server.c (handle_v_cont): Handle async I/O here.
+ (myresume): Likewise. Move other common resume tasks here...
+ (main): ... from here. Call initialize_async_io. Disable async
+ I/O before the main loop.
+ * server.h (initialize_async_io): Declare.
+ (block_async_io, unblock_async_io): Delete prototypes.
+ * spu-low.c (spu_resume, spu_wait): Do not handle async I/O here.
+
2007-12-06 Mick Davis <mickd@goanna.iinet.net.au>
* remote-utils.c (readchar): Allow binary data in received messages.
}
}
- enable_async_io ();
- unblock_async_io ();
w = linux_wait_for_event (child);
stop_all_processes ();
- disable_async_io ();
if (must_set_ptrace_flags)
{
if (pending_flag)
for_each_inferior (&all_threads, linux_queue_one_thread);
else
- {
- block_async_io ();
- enable_async_io ();
- for_each_inferior (&all_threads, linux_continue_one_thread);
- }
+ for_each_inferior (&all_threads, linux_continue_one_thread);
}
#ifdef HAVE_LINUX_USRREGS
fcntl (remote_desc, F_SETOWN, getpid ());
#endif
#endif
- disable_async_io ();
}
void
accept Control-C from the client, and must be disabled when talking to
the client. */
-void
-block_async_io (void)
-{
-#ifndef USE_WIN32API
- sigset_t sigio_set;
- sigemptyset (&sigio_set);
- sigaddset (&sigio_set, SIGIO);
- sigprocmask (SIG_BLOCK, &sigio_set, NULL);
-#endif
-}
-
-void
+static void
unblock_async_io (void)
{
#ifndef USE_WIN32API
sigset_t sigio_set;
+
sigemptyset (&sigio_set);
sigaddset (&sigio_set, SIGIO);
sigprocmask (SIG_UNBLOCK, &sigio_set, NULL);
async_io_enabled = 0;
}
+void
+initialize_async_io (void)
+{
+ /* Make sure that async I/O starts disabled. */
+ async_io_enabled = 1;
+ disable_async_io ();
+
+ /* Make sure the signal is unblocked. */
+ unblock_async_io ();
+}
+
/* Returns next char from remote GDB. -1 if error. */
static int
cont_thread = -1;
set_desired_inferior (0);
+ enable_async_io ();
(*the_target->resume) (resume_info);
free (resume_info);
*signal = mywait (status, 1);
prepare_resume_reply (own_buf, *status, *signal);
+ disable_async_io ();
return;
err:
}
void
-myresume (int step, int sig)
+myresume (int step, int *signalp, char *statusp)
{
struct thread_resume resume_info[2];
int n = 0;
+ int sig = *signalp;
+
+ set_desired_inferior (0);
if (step || sig || (cont_thread != 0 && cont_thread != -1))
{
resume_info[n].sig = 0;
resume_info[n].leave_stopped = (cont_thread != 0 && cont_thread != -1);
+ enable_async_io ();
(*the_target->resume) (resume_info);
+ *signalp = mywait (statusp, 1);
+ prepare_resume_reply (own_buf, *statusp, *signalp);
+ disable_async_io ();
}
static int attached;
exit (1);
}
+ initialize_async_io ();
initialize_low ();
own_buf = malloc (PBUFSIZ + 1);
restart:
setjmp (toplevel);
+ disable_async_io ();
while (1)
{
unsigned char sig;
signal = target_signal_to_host (sig);
else
signal = 0;
- set_desired_inferior (0);
- myresume (0, signal);
- signal = mywait (&status, 1);
- prepare_resume_reply (own_buf, status, signal);
+ myresume (0, &signal, &status);
break;
case 'S':
convert_ascii_to_int (own_buf + 1, &sig, 1);
signal = target_signal_to_host (sig);
else
signal = 0;
- set_desired_inferior (0);
- myresume (1, signal);
- signal = mywait (&status, 1);
- prepare_resume_reply (own_buf, status, signal);
+ myresume (1, &signal, &status);
break;
case 'c':
- set_desired_inferior (0);
- myresume (0, 0);
- signal = mywait (&status, 1);
- prepare_resume_reply (own_buf, status, signal);
+ signal = 0;
+ myresume (0, &signal, &status);
break;
case 's':
- set_desired_inferior (0);
- myresume (1, 0);
- signal = mywait (&status, 1);
- prepare_resume_reply (own_buf, status, signal);
+ signal = 0;
+ myresume (1, &signal, &status);
break;
case 'Z':
{
void remote_close (void);
void write_ok (char *buf);
void write_enn (char *buf);
+void initialize_async_io (void);
void enable_async_io (void);
void disable_async_io (void);
-void unblock_async_io (void);
-void block_async_io (void);
void check_remote_input_interrupt_request (void);
void convert_ascii_to_int (char *from, unsigned char *to, int n);
void convert_int_to_ascii (unsigned char *from, char *to, int n);
&& resume_info->thread != current_tid)
resume_info++;
- block_async_io ();
- enable_async_io ();
-
if (resume_info->leave_stopped)
return;
int w;
int ret;
- enable_async_io ();
- unblock_async_io ();
-
while (1)
{
ret = waitpid (tid, &w, WNOHANG | __WALL | __WNOTHREAD);
}
}
- disable_async_io ();
-
if (WIFEXITED (w))
{
fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));