From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24052 invoked by alias); 26 Sep 2019 17:47:33 -0000 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 Received: (qmail 24032 invoked by uid 89); 26 Sep 2019 17:47:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 spammy=simplifies X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Sep 2019 17:47:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1569520046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YO8A4IslviDE2MKbdZjjsJ/u4ZNHTre6+k9p8vHNnZM=; b=fPRebIqmPlh414GNXp7QDu5lTqfF0x9x8FWsd17CBSD5qLn8Lsaq58qMjeWQ/lCKVF2ELO ipk9QQTmlrx3xCC8JBwT6tlEvYoI/TmpHMwGNoHJZWmjOSmPgan/aaTwblgd5tkWDnsO/r sW4gqSRaSx93PWh3VpDixjvw98jKKp8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-353-XH2YXvIvMneWF3k6BazHcQ-1; Thu, 26 Sep 2019 13:47:23 -0400 Received: by mail-wm1-f70.google.com with SMTP id 4so1338591wmj.6 for ; Thu, 26 Sep 2019 10:47:23 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id z4sm2165286wrh.93.2019.09.26.10.47.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Sep 2019 10:47:21 -0700 (PDT) Subject: Re: [RFC 00/17] Merge event loop implementations To: Tom Tromey , gdb-patches@sourceware.org References: <20190224165153.5062-1-tom@tromey.com> From: Pedro Alves Message-ID: <3ae5ab8e-c219-6510-bb54-b30c1cf2d074@redhat.com> Date: Thu, 26 Sep 2019 17:47:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190224165153.5062-1-tom@tromey.com> X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-09/txt/msg00534.txt.bz2 On 2/24/19 4:51 PM, Tom Tromey wrote: > This series merges the gdb and gdbserver forks of event-loop.[ch]. Thanks for doing this. > This is an RFC because there are a few possibly unresolved issues. >=20 > Most of the patches are straightforward. The series begins by tidying > up the gdb event-loop code, removing things that are specific to gdb. > Then, the code is moved. After this, gdbserver is switched to use the > common code; and finally, a few cleanups are applied. >=20 > I initially attempted something more ambitious here: unifying the > async event and async signal code in event-loop (as I do not > understand the reason for the difference); and then further handling > the async signal code using the same code path as ordinary file > descriptors. See: https://sourceware.org/ml/gdb-patches/2008-10/msg00595.html >=20 > However, this didn't work, and since it was not directly important to > my goal of merging event loops, I dropped it. I think it may be worth > reviving. For example I think th async event code suffers from the > same race that led Pedro to change the async signal code to use a the > self-pipe trick. >=20 > Another related possible to-do item is changing the ser-event code to > maintain just a single self-pipe. It seems to me that there's never a > reason to need more than one. Can you clarify/expand? Are you suggesting to use one single pipe, and then if select/poll wakes up, go through a list of registered ser-events to know which one triggered? Or something else? >=20 > create_file_handler may have a latent bug where the global select > masks are not updated if it is called a second time for the same file > descriptor. Both versions of the event loop have this issue; I didn't > try to verify it, so perhaps I'm just misunderstanding the code here. I think you're right. >=20 > The final patch simplifies the rather convoluted handling of "serial" > (meaning remote protocol) input in gdbserver. It passes testing, but > I wonder whether there's some subtle reason that the code is written > the way it is. This is one of the unresolved issues I mentioned. I replied to this one directly. >=20 > The second unresolved issue involves the USE_WIN32API code. Before > this series, gdbserver used gdb_fildes_t, defined like: >=20 > #if USE_WIN32API > #include > typedef SOCKET gdb_fildes_t; > #else > typedef int gdb_fildes_t; > #endif >=20 > gdb did not use this approach, but does have a separate gdb_select > implementation in mingw-hdep.c, which gdbserver does not. >=20 > I don't know much about Windows, so I don't know why these things are > needed. I did a build using " --host=3Di686-w64-mingw32 > --target=3Di686-w64-mingw32", and everything built just fine using a > POSIX-style API. >=20 > Given that, I removed gdb_fildes_t in this series. However, perhaps > it is still needed and this series needs some more work. I could use > some advice here -- when is this code actually needed and is there a > way I can reproduce any problems? I don't have a Windows host, so I'm > hoping for some sort of compile-time error using a mingw cross. This was already discussed. Do I understand correctly that you're going to try to replace gdb_select with gnulib's select? Thanks, Pedro Alves