This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 1/8] Generalize interaction with agent in gdb/gdbserver
- From: Yao Qi <yao at codesourcery dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Tue, 14 Feb 2012 10:40:51 +0800
- Subject: Re: [patch 1/8] Generalize interaction with agent in gdb/gdbserver
- References: <4F1D55D7.7030506@codesourcery.com> <4F1D62D3.2080805@codesourcery.com> <4F341C89.40501@redhat.com>
On 02/10/2012 03:20 AM, Pedro Alves wrote:
>> > +#ifdef GDBSERVER
>> > + /* Need to read response with the inferior stopped. */
>> > + if (!ptid_equal (ptid, null_ptid))
>> > + {
>> > + int was_non_stop = non_stop;
>> > + struct target_waitstatus status;
>> > + struct thread_resume resume_info;
>> > +
>> > + /* Stop thread PTID. */
>> > + resume_info.thread = ptid;
>> > + resume_info.kind = resume_stop;
>> > + resume_info.sig = TARGET_SIGNAL_0;
>> > + (*the_target->resume) (&resume_info, 1);
>> > +
>> > + non_stop = 1;
>> > + mywait (ptid, &status, 0, 0);
>> > + non_stop = was_non_stop;
>> > + }
>> > +#endif
> Since there's no #else, I take it you haven't really tried using this
> on GDB, without gdbserver?
>
I thought this part can be removed. The intention of this part is to
really stop "debugging thread", so it is safe to read from command
buffer later. We don't have "debugging thread" stopped, because the
synchronization of read and write is controlled by socket. When we get
here, after reading one byte from socket, "debugging thread" has
finished executing command, and write return result in command buffer.
It is being blocked by reading from socket, even it is not stopped.
GDB/GDBserver can safely read contents out of command buffer without
having to stop "debugging thread". Am I missing something here?
I get rid of this part from its original place (gdbserver/tracepoint.c),
and run gdb.trace/strace.exp. Results look unchanged.
--
Yao (éå)