From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117872 invoked by alias); 17 Apr 2019 22:17:34 -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 117863 invoked by uid 89); 17 Apr 2019 22:17:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=pay X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Apr 2019 22:17:33 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 5CBD4116FA1; Wed, 17 Apr 2019 18:17:31 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LwTwv29s8UD6; Wed, 17 Apr 2019 18:17:31 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 293A0116F6F; Wed, 17 Apr 2019 18:17:31 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 6B81F83C06; Wed, 17 Apr 2019 15:17:29 -0700 (PDT) Date: Wed, 17 Apr 2019 22:17:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [RFA 2/2][master only] gdb/windows-nat.c: Get rid of main_thread_id global Message-ID: <20190417221729.GA5839@adacore.com> References: <1555453982-77808-1-git-send-email-brobecker@adacore.com> <1555453982-77808-3-git-send-email-brobecker@adacore.com> <83imvcg0ud.fsf@gnu.org> <20190417173842.GA14817@adacore.com> <83wojseb9c.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83wojseb9c.fsf@gnu.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2019-04/txt/msg00302.txt.bz2 > > If I understand you correctly, you want to preserve the global > > so we can avoid those notifications. In my opinion, doing that > > just for the purpose of filtering one notification is simply > > not worth the trouble of keeping a global around. Generally speaking, > > we tend to try to avoid globals as much as we can, as they are hard to > > track, and makes the code harder to understand and maintain. > > Modifying the logic to use the main_thread_id global instead of > > the kind of event is a step backwards, in my opinion. > > If the only problem is having the global variable, we could mark the > main thread in some other way, that won't need the global. > > But yes, I think not announcing the main thread is a nice feature, and > losing it due to the mess that happens at program exit (something to > which most users won't pay attention anyway) would be a pity. I'd > even agree to announcing the exit of the main thread, if we cannot > come up with a better solution, if that could allow us avoid its > announcement at program startup. > > The use case I have in mind is debugging a single-threaded program. > It is jarring enough, when debugging such a program, to see GDB > announcing threads started by the OS. It would be nice if we could > avoid announcing the main thread. Personally, I feel the other way, especially since we always get all sorts of random temporary thread notifications polutting the output, that I don't mind the extra notification. And that way, I know when each thread is actually terminated, and with what error code. But if you and others feel differently, I can switch my approach: - patch #1 (master+8.3): Just fix the crash, and nothing more. This means that, on 8.3, thread creation and exit notifications can be slightly off; this is considered an acceptable known problem, and is not a regression. This is actually what we've put in AdaCore's GDB as a first step to see we had any issue after that, and we did not. - patch #2 (master only): Remove uses of the global But we keep the filtering of the "main" thread. We still the known problem that the thread-exit notifications might be silenced for the wrong thread. Not a regression. - patch #3 (master only): Tag the main thread, and silence the thread-exit notification of the thread that got tagged. Depending on the implementation, this patch would potentially be acceptable for 8.3, but might need extra work to apply. I think we've had enough problems with 8.3 as it is, I don't want to add more things to do, so I vote OUT for 8.3. I don't think I have time for that before the weekend or next week, though. -- Joel