From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17576 invoked by alias); 18 Jun 2007 05:00:34 -0000 Received: (qmail 17565 invoked by uid 22791); 18 Jun 2007 05:00:33 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 18 Jun 2007 05:00:30 +0000 Received: from kahikatea.snap.net.nz (22.61.255.123.dynamic.snap.net.nz [123.255.61.22]) by viper.snap.net.nz (Postfix) with ESMTP id 585CB3D9E5D; Mon, 18 Jun 2007 17:00:25 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 558458FBF6; Mon, 18 Jun 2007 17:00:21 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18038.4452.524773.721616@kahikatea.snap.net.nz> Date: Mon, 18 Jun 2007 05:00:00 -0000 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: async patch (no. 4) In-Reply-To: <20070618024611.GA12587@caradoc.them.org> References: <17720.29835.230422.776965@kahikatea.snap.net.nz> <20070112183120.GB30005@nevyn.them.org> <17832.2690.298735.867020@kahikatea.snap.net.nz> <20070112230333.GA7039@nevyn.them.org> <18036.65200.916738.36790@kahikatea.snap.net.nz> <20070617152125.GA17563@caradoc.them.org> <18037.40606.95329.378825@kahikatea.snap.net.nz> <20070618024611.GA12587@caradoc.them.org> X-Mailer: VM 7.19 under Emacs 22.1.50.3 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: 2007-06/txt/msg00323.txt.bz2 > > I don't know how you can claim to uderstand almost none of it after you > > suggested to me to use SIGCHLD to interrupt the call to select instead of > > using threads. I think some of these comments are based on looking at the > > previous (eponymous) patch (no. 4). > > That's the only part of the patch I claim to understand at all. It's > not that it's unintelligible - it's that I don't understand why any > given line is necessary. Like, what does async_signal_hook do, and > why is it called from those particular places? Why does async > behavior change where we need to claim the terminal? Are the > quit_flag changes still necessary now that we've done some work on > QUIT? Why don't the infrun changes break thread handling all over the > place? > > All of these things are the same questions we'd ask for any patch. Sure, but to be fair I think this is the first time you have asked them. 1) what does async_signal_hook do Firstly this patch only currently works for Linux. That is because I don't know enough about other OSes and ISTR that you said others could extend easily it to them later. For Linux, async_signal_hook is initialised to linux_nat_signal_hook in _initialize_linux_nat. It is called (with different arguments) immediately before and after calls to select (or poll, if appropriate) and only if gdb is invoked with --async (event_loop_p != 0). On the first call, linux_nat_signal_hook sets up a handler, async_sigchld_handler, for SIGCHLD, that writes the return value of waitpid to the file descriptor that linux_nat_fetch_event reads from. linux_nat_fetch_event is called instead of my_waitpid with an asynchronous target in linux_nat_wait. On the second call linux_nat_signal_hook restores the old signal mask. I'll try to answer the other questions in due course, but I'd like to hear if you think I'm making sense trying to answer this one first. -- Nick http://www.inet.net.nz/~nickrob