This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix fail in gdb.base/interrupt-noterm.exp
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Mon, 25 Jan 2016 09:30:12 +0000
- Subject: Re: [PATCH] Fix fail in gdb.base/interrupt-noterm.exp
- Authentication-results: sourceware.org; auth=none
- References: <1453480183-5131-1-git-send-email-yao dot qi at linaro dot org> <56A25D13 dot 2080608 at redhat dot com> <86twm5r0yp dot fsf at gmail dot com> <56A26849 dot 9070206 at redhat dot com>
Pedro Alves <palves@redhat.com> writes:
> If 1. is followed by 3., then the \\003 is always read by gdb
s/ready by/sent by/ ?
> after the vCont;c. We call enable_async_io before reaching
> mywait. Since we're in all-stop, that means we'll block
Although we call enable_async_io earlier, so the window between received
vCont;c and calling enable_async_io is tiny, it is still possible that
\\003 arrives at that period.
> inside mywait -> waitpid, all the while \\003 is already available to
> read in the socket. Since we're blocked in waitpid, we won't see
> the \\003 until after the next time the program happens to stop.
>
> Agree?
Yes, I agree.
>
> It still seems to me like a gdbserver bug.
>
> I think that after calling enable_async_io, we need to check whether
> input is already pending from GDB, and if so, process it immediately -- we
> know the only input coming from GDB at this point is a \\003. IOW, I think
> we need to call input_interrupt after calling enable_async_io. input_interrupt
> already uses select before reading, so it handles the case of there
> being no input available without blocking.
>
> However, we need to be careful, because a SIGIO can race with calling
> input_interrupt from mainline code...
What you mean here is that we can call input_interrupt after calling
enable_async_io, but meanwhile, \\0003 arrives, and input_interrupt is
invoked as a SIGIO handler, so there is a race. Is it correct?
I agree your next email about the approach of block/unblock SIGIO is
better. I'll give a fix that way.
--
Yao (éå)