From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12516 invoked by alias); 27 Apr 2015 18:45:55 -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 12497 invoked by uid 89); 27 Apr 2015 18:45:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lb0-f182.google.com Received: from mail-lb0-f182.google.com (HELO mail-lb0-f182.google.com) (209.85.217.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 27 Apr 2015 18:45:52 +0000 Received: by lbbzk7 with SMTP id zk7so89468437lbb.0 for ; Mon, 27 Apr 2015 11:45:49 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr11242975lbb.36.1430160349309; Mon, 27 Apr 2015 11:45:49 -0700 (PDT) Received: from [192.168.0.115] (h86-62-88-129.ln.rinet.ru. [86.62.88.129]) by mx.google.com with ESMTPSA id oe1sm4965286lbb.23.2015.04.27.11.45.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Apr 2015 11:45:48 -0700 (PDT) Message-ID: <553E83ED.80000@gmail.com> Date: Mon, 27 Apr 2015 18:53:00 -0000 From: Vladimir Prus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 Newsgroups: gmane.comp.gdb.patches To: Taimoor , gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] Testsuite for varobj updation after symbol removal References: <1429155160-4816-1-git-send-email-tmirza@codesourcery.com> <1429155160-4816-3-git-send-email-tmirza@codesourcery.com> <5538A7A6.3000908@codesourcery.com> In-Reply-To: <5538A7A6.3000908@codesourcery.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg01010.txt.bz2 On 04/23/2015 11:04 AM, Taimoor wrote: > Hi Vladimir, > > Thanks for reviewing the patch. > > On 04/17/2015 08:18 PM, Vladimir Prus wrote: >> >> >> On 04/16/2015 06:32 AM, Taimoor Mirza wrote: >> > This patch provides testcases for variable object updation after >> removing >> > symbols. Test programs are same as used for testing remove-symbol-file >> > command in gdb.base. sym-file-main.c is modified to just add a global >> > variable for which varible object is created in testsuite. >> > >> >> Taimoor, >> >> thanks for the patch, and testsuite change. Looking at it, it appears >> that 'count' is >> a global variable, and it's modified in one place, in the main function, >> and after that >> you do 'remove-symbol-files' and verify that var-update reports reports >> 'count' as >> changed. But what does it test exactly? Since count is explicitly >> modified in the >> test, I'd imagine that -var-update will report it as changed even without >> 'remove-symbol-file'. In other words, does this testcase fail if the >> code patch is not >> applied? > > Yes. This testcase fails without applying this patch. Below is problematic scenario: > > > 1) Run GDB session and load symbols from file a. > 2) Create varobj for some global variable test. > 3) put some breakpoint in some function and run to that breakpoint. > 4) Use add-symbol-file to load symbols of file b. > 5) Put breakpoint on some other function that is called after updating > global variable test. > 6) When this breakpoint gets hit, remove symbols of b using > 'remove-symbol-file'. > 7) print value of test. Its updated and different from initial value. > 8) give 'var-update' command for variable object of 'test' and > changelist will be empty. > > I know its not a common scenario but as long as it is valid > according to individual command specifications we have all the right to > expect it will produce the intended results. > >> >> Even if so, does it test exactly what is your real case? It's easy to >> see why 'remove-symbol-files' >> can make some global variables no longer present. But how it can change >> value of some expression? > > Its not the case of global variable not present. Its problem with properly displaying changeset for a valid global variable whose value is > changed. > Step 7 in above scenario displays updated value of variable but -var-update for varobj of that variable gives empty changeset. The reason > for this is mentioned in source code patch [PATCH 1/2]. Hi Taimoor, thanks, so the issue is that removing a symbol file recreates *all* global varobjs, and in the process clears any change of value since the last update. I agree the patch is fixing that. There's a second change, it seems - to invalidate varobj that refers to types in unloaded objfile - is there a test for that? Thanks, -- Vladimir Prus CodeSourcery / Mentor Embedded http://vladimirprus.com From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13421 invoked by alias); 27 Apr 2015 18:46:16 -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 13401 invoked by uid 89); 27 Apr 2015 18:46:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: plane.gmane.org Received: from plane.gmane.org (HELO plane.gmane.org) (80.91.229.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 27 Apr 2015 18:46:14 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ymo2Y-00018Y-H3 for gdb-patches@sourceware.org; Mon, 27 Apr 2015 20:45:58 +0200 Received: from h86-62-88-129.ln.rinet.ru ([86.62.88.129]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Apr 2015 20:45:58 +0200 Received: from vladimir.prus by h86-62-88-129.ln.rinet.ru with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Apr 2015 20:45:58 +0200 To: gdb-patches@sourceware.org From: Vladimir Prus Subject: Re: [PATCH 2/2] Testsuite for varobj updation after symbol removal Date: Mon, 27 Apr 2015 19:10:00 -0000 Message-ID: <553E83ED.80000@gmail.com> References: <1429155160-4816-1-git-send-email-tmirza@codesourcery.com> <1429155160-4816-3-git-send-email-tmirza@codesourcery.com> <5538A7A6.3000908@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <5538A7A6.3000908@codesourcery.com> X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01011.txt.bz2 Message-ID: <20150427191000.x8tGNKHHdmtCcQB_4PD8_FebRRGeCVrPNOdekAf0iM8@z> On 04/23/2015 11:04 AM, Taimoor wrote: > Hi Vladimir, > > Thanks for reviewing the patch. > > On 04/17/2015 08:18 PM, Vladimir Prus wrote: >> >> >> On 04/16/2015 06:32 AM, Taimoor Mirza wrote: >> > This patch provides testcases for variable object updation after >> removing >> > symbols. Test programs are same as used for testing remove-symbol-file >> > command in gdb.base. sym-file-main.c is modified to just add a global >> > variable for which varible object is created in testsuite. >> > >> >> Taimoor, >> >> thanks for the patch, and testsuite change. Looking at it, it appears >> that 'count' is >> a global variable, and it's modified in one place, in the main function, >> and after that >> you do 'remove-symbol-files' and verify that var-update reports reports >> 'count' as >> changed. But what does it test exactly? Since count is explicitly >> modified in the >> test, I'd imagine that -var-update will report it as changed even without >> 'remove-symbol-file'. In other words, does this testcase fail if the >> code patch is not >> applied? > > Yes. This testcase fails without applying this patch. Below is problematic scenario: > > > 1) Run GDB session and load symbols from file a. > 2) Create varobj for some global variable test. > 3) put some breakpoint in some function and run to that breakpoint. > 4) Use add-symbol-file to load symbols of file b. > 5) Put breakpoint on some other function that is called after updating > global variable test. > 6) When this breakpoint gets hit, remove symbols of b using > 'remove-symbol-file'. > 7) print value of test. Its updated and different from initial value. > 8) give 'var-update' command for variable object of 'test' and > changelist will be empty. > > I know its not a common scenario but as long as it is valid > according to individual command specifications we have all the right to > expect it will produce the intended results. > >> >> Even if so, does it test exactly what is your real case? It's easy to >> see why 'remove-symbol-files' >> can make some global variables no longer present. But how it can change >> value of some expression? > > Its not the case of global variable not present. Its problem with properly displaying changeset for a valid global variable whose value is > changed. > Step 7 in above scenario displays updated value of variable but -var-update for varobj of that variable gives empty changeset. The reason > for this is mentioned in source code patch [PATCH 1/2]. Hi Taimoor, thanks, so the issue is that removing a symbol file recreates *all* global varobjs, and in the process clears any change of value since the last update. I agree the patch is fixing that. There's a second change, it seems - to invalidate varobj that refers to types in unloaded objfile - is there a test for that? Thanks, -- Vladimir Prus CodeSourcery / Mentor Embedded http://vladimirprus.com