From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53391 invoked by alias); 24 Oct 2019 03:11: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 53383 invoked by uid 89); 24 Oct 2019 03:11:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= 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; Thu, 24 Oct 2019 03:11:33 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 8557D1E61D; Wed, 23 Oct 2019 23:11:31 -0400 (EDT) Subject: Re: [PATCH] gdb/python: Introduce gdb.lookup_all_static_symbols To: Andrew Burgess , Christian Biesinger Cc: gdb-patches References: <20191015141515.GW4962@embecosm.com> <20191015164647.1837-1-andrew.burgess@embecosm.com> <32eba92d-55a9-5694-cec5-80001d8ff1ae@simark.ca> <20191023191354.GH4962@embecosm.com> From: Simon Marchi Message-ID: <4582382d-b58a-8fa8-9478-168de34e2a82@simark.ca> Date: Thu, 24 Oct 2019 03:11:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191023191354.GH4962@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-10/txt/msg00870.txt.bz2 On 2019-10-23 3:13 p.m., Andrew Burgess wrote: >>> I see two use cases here: >>> >>> 1. I want to get all static symbols named `foo`. In which case, I'd use the >>> function Andrew proposes in this patch. >>> 2. I want to get the static symbol named `foo` that's visible from a certain >>> point, perhaps a given block or where my program is currently stopped at. >>> Ideally, we would have a "CompilationUnit" object type in Python, such that >>> I could use >>> >>> block.compunit.lookup_static_symbol('foo') >>> >>> or >>> >>> gdb.current_compunit().lookup_static_symbol('foo') >> So technically, those don't give you "the static symbol named `foo` >> that's visible from [this] point", because there could be static >> variable in the function. >> >> Since we already have block objects, should this new function >> optionally take a block to start the lookup in? > When you say "new function", I assume you mean > 'gdb.lookup_static_symbol' not 'gdb.lookup_static_symbols', as the > second one always returns all symbols. > > Anyway, I took a stab at adding a block parameter to the first of > these functions - is this what you were thinking? > > Thanks, > Andrew I'm confused, I don't gdb.lookup_static_symbol(s) only look through static symbols, as in file-level static variables? Simon