mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-04 03:48:52 +08:00
* 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.
This commit is contained in:
@ -1,3 +1,18 @@
|
|||||||
|
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>
|
2007-12-06 Mick Davis <mickd@goanna.iinet.net.au>
|
||||||
|
|
||||||
* remote-utils.c (readchar): Allow binary data in received messages.
|
* remote-utils.c (readchar): Allow binary data in received messages.
|
||||||
|
@ -897,11 +897,8 @@ retry:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_async_io ();
|
|
||||||
unblock_async_io ();
|
|
||||||
w = linux_wait_for_event (child);
|
w = linux_wait_for_event (child);
|
||||||
stop_all_processes ();
|
stop_all_processes ();
|
||||||
disable_async_io ();
|
|
||||||
|
|
||||||
if (must_set_ptrace_flags)
|
if (must_set_ptrace_flags)
|
||||||
{
|
{
|
||||||
@ -1313,12 +1310,8 @@ linux_resume (struct thread_resume *resume_info)
|
|||||||
if (pending_flag)
|
if (pending_flag)
|
||||||
for_each_inferior (&all_threads, linux_queue_one_thread);
|
for_each_inferior (&all_threads, linux_queue_one_thread);
|
||||||
else
|
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
|
#ifdef HAVE_LINUX_USRREGS
|
||||||
|
|
||||||
|
@ -275,7 +275,6 @@ remote_open (char *name)
|
|||||||
fcntl (remote_desc, F_SETOWN, getpid ());
|
fcntl (remote_desc, F_SETOWN, getpid ());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
disable_async_io ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -645,22 +644,12 @@ check_remote_input_interrupt_request (void)
|
|||||||
accept Control-C from the client, and must be disabled when talking to
|
accept Control-C from the client, and must be disabled when talking to
|
||||||
the client. */
|
the client. */
|
||||||
|
|
||||||
void
|
static 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
|
|
||||||
unblock_async_io (void)
|
unblock_async_io (void)
|
||||||
{
|
{
|
||||||
#ifndef USE_WIN32API
|
#ifndef USE_WIN32API
|
||||||
sigset_t sigio_set;
|
sigset_t sigio_set;
|
||||||
|
|
||||||
sigemptyset (&sigio_set);
|
sigemptyset (&sigio_set);
|
||||||
sigaddset (&sigio_set, SIGIO);
|
sigaddset (&sigio_set, SIGIO);
|
||||||
sigprocmask (SIG_UNBLOCK, &sigio_set, NULL);
|
sigprocmask (SIG_UNBLOCK, &sigio_set, NULL);
|
||||||
@ -696,6 +685,17 @@ disable_async_io (void)
|
|||||||
async_io_enabled = 0;
|
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. */
|
/* Returns next char from remote GDB. -1 if error. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -756,12 +756,14 @@ handle_v_cont (char *own_buf, char *status, int *signal)
|
|||||||
cont_thread = -1;
|
cont_thread = -1;
|
||||||
set_desired_inferior (0);
|
set_desired_inferior (0);
|
||||||
|
|
||||||
|
enable_async_io ();
|
||||||
(*the_target->resume) (resume_info);
|
(*the_target->resume) (resume_info);
|
||||||
|
|
||||||
free (resume_info);
|
free (resume_info);
|
||||||
|
|
||||||
*signal = mywait (status, 1);
|
*signal = mywait (status, 1);
|
||||||
prepare_resume_reply (own_buf, *status, *signal);
|
prepare_resume_reply (own_buf, *status, *signal);
|
||||||
|
disable_async_io ();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@ -798,10 +800,13 @@ handle_v_requests (char *own_buf, char *status, int *signal,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
myresume (int step, int sig)
|
myresume (int step, int *signalp, char *statusp)
|
||||||
{
|
{
|
||||||
struct thread_resume resume_info[2];
|
struct thread_resume resume_info[2];
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
int sig = *signalp;
|
||||||
|
|
||||||
|
set_desired_inferior (0);
|
||||||
|
|
||||||
if (step || sig || (cont_thread != 0 && cont_thread != -1))
|
if (step || sig || (cont_thread != 0 && cont_thread != -1))
|
||||||
{
|
{
|
||||||
@ -817,7 +822,11 @@ myresume (int step, int sig)
|
|||||||
resume_info[n].sig = 0;
|
resume_info[n].sig = 0;
|
||||||
resume_info[n].leave_stopped = (cont_thread != 0 && cont_thread != -1);
|
resume_info[n].leave_stopped = (cont_thread != 0 && cont_thread != -1);
|
||||||
|
|
||||||
|
enable_async_io ();
|
||||||
(*the_target->resume) (resume_info);
|
(*the_target->resume) (resume_info);
|
||||||
|
*signalp = mywait (statusp, 1);
|
||||||
|
prepare_resume_reply (own_buf, *statusp, *signalp);
|
||||||
|
disable_async_io ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int attached;
|
static int attached;
|
||||||
@ -895,6 +904,7 @@ main (int argc, char *argv[])
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initialize_async_io ();
|
||||||
initialize_low ();
|
initialize_low ();
|
||||||
|
|
||||||
own_buf = malloc (PBUFSIZ + 1);
|
own_buf = malloc (PBUFSIZ + 1);
|
||||||
@ -946,6 +956,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
restart:
|
restart:
|
||||||
setjmp (toplevel);
|
setjmp (toplevel);
|
||||||
|
disable_async_io ();
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
unsigned char sig;
|
unsigned char sig;
|
||||||
@ -1073,10 +1084,7 @@ main (int argc, char *argv[])
|
|||||||
signal = target_signal_to_host (sig);
|
signal = target_signal_to_host (sig);
|
||||||
else
|
else
|
||||||
signal = 0;
|
signal = 0;
|
||||||
set_desired_inferior (0);
|
myresume (0, &signal, &status);
|
||||||
myresume (0, signal);
|
|
||||||
signal = mywait (&status, 1);
|
|
||||||
prepare_resume_reply (own_buf, status, signal);
|
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
convert_ascii_to_int (own_buf + 1, &sig, 1);
|
convert_ascii_to_int (own_buf + 1, &sig, 1);
|
||||||
@ -1084,22 +1092,15 @@ main (int argc, char *argv[])
|
|||||||
signal = target_signal_to_host (sig);
|
signal = target_signal_to_host (sig);
|
||||||
else
|
else
|
||||||
signal = 0;
|
signal = 0;
|
||||||
set_desired_inferior (0);
|
myresume (1, &signal, &status);
|
||||||
myresume (1, signal);
|
|
||||||
signal = mywait (&status, 1);
|
|
||||||
prepare_resume_reply (own_buf, status, signal);
|
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
set_desired_inferior (0);
|
signal = 0;
|
||||||
myresume (0, 0);
|
myresume (0, &signal, &status);
|
||||||
signal = mywait (&status, 1);
|
|
||||||
prepare_resume_reply (own_buf, status, signal);
|
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
set_desired_inferior (0);
|
signal = 0;
|
||||||
myresume (1, 0);
|
myresume (1, &signal, &status);
|
||||||
signal = mywait (&status, 1);
|
|
||||||
prepare_resume_reply (own_buf, status, signal);
|
|
||||||
break;
|
break;
|
||||||
case 'Z':
|
case 'Z':
|
||||||
{
|
{
|
||||||
|
@ -171,10 +171,9 @@ void remote_open (char *name);
|
|||||||
void remote_close (void);
|
void remote_close (void);
|
||||||
void write_ok (char *buf);
|
void write_ok (char *buf);
|
||||||
void write_enn (char *buf);
|
void write_enn (char *buf);
|
||||||
|
void initialize_async_io (void);
|
||||||
void enable_async_io (void);
|
void enable_async_io (void);
|
||||||
void disable_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 check_remote_input_interrupt_request (void);
|
||||||
void convert_ascii_to_int (char *from, unsigned char *to, int n);
|
void convert_ascii_to_int (char *from, unsigned char *to, int n);
|
||||||
void convert_int_to_ascii (unsigned char *from, char *to, int n);
|
void convert_int_to_ascii (unsigned char *from, char *to, int n);
|
||||||
|
@ -348,9 +348,6 @@ spu_resume (struct thread_resume *resume_info)
|
|||||||
&& resume_info->thread != current_tid)
|
&& resume_info->thread != current_tid)
|
||||||
resume_info++;
|
resume_info++;
|
||||||
|
|
||||||
block_async_io ();
|
|
||||||
enable_async_io ();
|
|
||||||
|
|
||||||
if (resume_info->leave_stopped)
|
if (resume_info->leave_stopped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -375,9 +372,6 @@ spu_wait (char *status)
|
|||||||
int w;
|
int w;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
enable_async_io ();
|
|
||||||
unblock_async_io ();
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
ret = waitpid (tid, &w, WNOHANG | __WALL | __WNOTHREAD);
|
ret = waitpid (tid, &w, WNOHANG | __WALL | __WNOTHREAD);
|
||||||
@ -407,8 +401,6 @@ spu_wait (char *status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_async_io ();
|
|
||||||
|
|
||||||
if (WIFEXITED (w))
|
if (WIFEXITED (w))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
|
fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
|
||||||
|
Reference in New Issue
Block a user