From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1944 invoked by alias); 26 Jul 2019 22:43:14 -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 1935 invoked by uid 89); 26 Jul 2019 22:43:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.1 spammy=H*r:112, concluded X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Jul 2019 22:43:13 +0000 Received: by simark.ca (Postfix, from userid 112) id 759E21F333; Fri, 26 Jul 2019 18:43:11 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 10D1B1EE74; Fri, 26 Jul 2019 18:43:10 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 26 Jul 2019 22:43:00 -0000 From: Simon Marchi To: Christian Biesinger Cc: Christian Biesinger via gdb-patches Subject: Re: [PATCH][PR/24474] Make gdb.lookup_static_symbol also check the STATIC_SCOPE In-Reply-To: References: <20190605012421.252953-1-cbiesinger@google.com> <8f4bcc74-18a0-c8f6-b97d-aef05021a656@simark.ca> Message-ID: X-Sender: simark@simark.ca User-Agent: Roundcube Webmail/1.3.6 X-SW-Source: 2019-07/txt/msg00600.txt.bz2 On 2019-07-26 18:04, Christian Biesinger wrote: > Thanks for your response! I have started implementing this and > concluded that I would prefer not to add a block argument with this > behavior to lookup_static_symbol: > - If I add it with the behavior you suggest, this will be very > confusing to use because it won't find function-local static variables > (they are not part of the static block) Agreed, it would be a bit confusing to pass a block to a 'lookup' function, and have the search actually done in another block. > - It does not add new functionality. You can already access static > symbols if you have a block: [sym for sym in block if sym.addr_class > == gdb.SYMBOL_LOC_STATIC]. And you can already do that in a function's > static block too, using block.static_block. I agree. > - I'd be happy to add a patch that adds makes block['foo'] work, in > addition to the currently-existing iteration That is a separate issue, but yeah, if blocks can be seen as containers of symbols, and symbol names are guaranteed to be unique within a block, then it sounds like it would be handy. > > Conversely, lookup_static_symbol without a block does add new > functionality. Yes, and it's always possible to add parameters after if needed since it's Python. > I will send a new patch with this in a moment. Thanks, Simon