From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4050 invoked by alias); 14 Feb 2012 02:41:25 -0000 Received: (qmail 4031 invoked by uid 22791); 14 Feb 2012 02:41:24 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Feb 2012 02:41:11 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Rx8KL-0002xM-Sa from Yao_Qi@mentor.com ; Mon, 13 Feb 2012 18:41:09 -0800 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 13 Feb 2012 18:40:40 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.1.289.1; Mon, 13 Feb 2012 18:41:08 -0800 Message-ID: <4F39C9B3.9010005@codesourcery.com> Date: Tue, 14 Feb 2012 02:41:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20120130 Thunderbird/10.0 MIME-Version: 1.0 To: Pedro Alves CC: 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> In-Reply-To: <4F341C89.40501@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00248.txt.bz2 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 (齐尧)