From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 107910 invoked by alias); 26 May 2016 18:13:25 -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 107882 invoked by uid 89); 26 May 2016 18:13:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=painful, H*M:3ae0, H*M:3533 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 26 May 2016 18:13:20 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E580780086; Thu, 26 May 2016 18:13:18 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4QIDHcr022696; Thu, 26 May 2016 14:13:18 -0400 Subject: Re: [PATCH v3 08/34] Always run async signal handlers in the main UI To: Simon Marchi , gdb-patches@sourceware.org References: <1462538104-19109-1-git-send-email-palves@redhat.com> <1462538104-19109-9-git-send-email-palves@redhat.com> <573E13D0.7010104@ericsson.com> From: Pedro Alves Message-ID: Date: Thu, 26 May 2016 18:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <573E13D0.7010104@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-05/txt/msg00467.txt.bz2 On 05/19/2016 08:28 PM, Simon Marchi wrote: > On 16-05-06 08:34 AM, Pedro Alves wrote: >> -/* The main UI. This is the UI that is bound to stdin/stdout/stderr. >> - It always exists and is created automatically when GDB starts >> - up. */ >> +/* The main UI. */ >> static struct ui main_ui_; >> >> +struct ui *main_ui = &main_ui_; > > I'd suggest making the pointer const, to show (and make sure) that the main ui > never changes throughout the lifetime of the gdb instance: > > +struct ui * const main_ui = &main_ui_; Hmm, that wouldn't work, because later on the series, main_ui becomes heap allocated: https://sourceware.org/ml/gdb-patches/2016-05/msg00125.html Guess we could instead have: struct ui *get_main_ui (void); To make it clearer that this is not supposed to be an lvalue. And likewise maybe: struct ui *get_current_ui (void); void set_current_ui (struct ui *); Though unless I'm in for some other major rework of the series, at this point I'd rather defer that to a follow up patch. I've gone through renaming these objects throughout the whole series a few times already, and it's quite painful. WDYT? > >> struct ui *current_ui = &main_ui_; >> struct ui *ui_list = &main_ui_; > > ui_list could be const for the same reason, while we're at it. > Likewise, this becomes heap allocated. (I don't see much point in changing this one, the only point of making it extern is to be able to access it in the implementation of ALL_UIS.) Thanks, Pedro Alves