From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103062 invoked by alias); 30 Jul 2019 01:14:40 -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 103043 invoked by uid 89); 30 Jul 2019 01:14:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:yYf_G4U9PV, H*f:sk:V6AZuQ@, H*f:PYNgcy 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; Tue, 30 Jul 2019 01:14:39 +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 BD5F21E05A; Mon, 29 Jul 2019 21:14:37 -0400 (EDT) Subject: Re: [PATCH v2] [PR/24474] Add gdb.lookup_static_symbol to the python API To: Christian Biesinger , gdb-patches@sourceware.org References: <20190726222259.12312-1-cbiesinger@google.com> From: Simon Marchi Message-ID: <896673e7-8b71-c161-f62f-4cc8fc87cb27@simark.ca> Date: Tue, 30 Jul 2019 01:14:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190726222259.12312-1-cbiesinger@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-07/txt/msg00645.txt.bz2 Hi Christian, On 2019-07-26 6:22 p.m., Christian Biesinger via gdb-patches wrote: > diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp > index 5b8a2be7c4..5d45e35da0 100644 > --- a/gdb/testsuite/gdb.python/py-symbol.exp > +++ b/gdb/testsuite/gdb.python/py-symbol.exp > @@ -48,6 +48,22 @@ gdb_test "python print (gdb.lookup_global_symbol('qq').needs_frame)" \ > "False" \ > "print whether qq needs a frame" > > +set rr_line [gdb_get_line_number "line of rr"] > +gdb_test "python print (gdb.lookup_global_symbol ('rr') is None)" "True" \ > + "lookup_global_symbol for static var" > + > +gdb_test "python print (gdb.lookup_static_symbol ('rr').line)" "$rr_line" \ > + "print line number of rr" > + > +gdb_test "python print (gdb.lookup_static_symbol ('rr').value ())" "42" \ > + "print value of rr" > + > +gdb_test "python print (gdb.lookup_static_symbol ('rr').needs_frame)" \ > + "False" \ > + "print whether rr needs a frame" > + > +gdb_test "python print (gdb.lookup_global_symbol ('nonexistant') is None)" \ > + "True" "lookup_static_symbol for nonexistant var The test name says "lookup_static_symbol" but the command uses lookup_global_symbol. I suppose you actually want to test lookup_static_symbol. Is there a test that checks that lookup_static_symbol won't find a global symbol? If not, it would be good to add. Simon