From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70116 invoked by alias); 23 Jul 2015 18:06:58 -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 69493 invoked by uid 89); 23 Jul 2015 18:06:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 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, 23 Jul 2015 18:06:57 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 58447376B69 for ; Thu, 23 Jul 2015 18:06:56 +0000 (UTC) Received: from pinnacle.lan (ovpn-113-75.phx2.redhat.com [10.3.113.75]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6NI6tYb008689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO) for ; Thu, 23 Jul 2015 14:06:56 -0400 Date: Thu, 23 Jul 2015 18:06:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH] Add proper handling for non-local references in nested functions Message-ID: <20150723110653.3f4e2f11@pinnacle.lan> In-Reply-To: <55B112D4.5010304@adacore.com> References: <54F47563.4050103@adacore.com> <54FF0D05.70907@redhat.com> <550C1170.9070208@adacore.com> <55685B60.3000004@redhat.com> <55775EB0.4080701@adacore.com> <55AF5F7E.5000600@adacore.com> <20150722173957.7ed51f18@pinnacle.lan> <55B0C583.6050601@adacore.com> <20150723064408.4dd8a9b2@pinnacle.lan> <55B112D4.5010304@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00657.txt.bz2 On Thu, 23 Jul 2015 18:14:12 +0200 Pierre-Marie de Rodat wrote: > On 07/23/2015 03:44 PM, Kevin Buettner wrote: > > > I'll test your new patch today. I've encountered a GDB bug related to > > examining variables with within a nested function. I'm hoping that > > your patch will fix it... > > I am as well: keep me updated! ;-) Your patch did indeed fix my problem. Given this test case (which I cobbled together while looking at another matter)... --- nested.c --- int main () { static int a = 1, b = 2, c = 3; int d = 4, e = 5, f = 6; void p (void) { c = 7; f = 8; __builtin_printf ("%d %d %d %d\n", b, c, e, f); } p (); a = 101; b = 102; c = 103; d = 104; e = 105; f = 106; p (); return 0; } --- end nested.c --- ...this is the behavior that I was seeing (without your patch): Breakpoint 1, p () at nested.c:11 11 __builtin_printf ("%d %d %d %d\n", b, c, e, f); (gdb) p a $1 = 1 (gdb) p b $2 = 2 (gdb) p c $3 = 7 (gdb) p d $4 = 32767 (gdb) p e $5 = 5 (gdb) p f $6 = 8 Note that the value of d is wrong. Now, with your patch, this is what I see: Breakpoint 1, p () at nested.c:11 11 __builtin_printf ("%d %d %d %d\n", b, c, e, f); (gdb) p a $1 = 1 (gdb) p b $2 = 2 (gdb) p c $3 = 7 (gdb) p d $4 = 4 (gdb) p e $5 = 5 (gdb) p f $6 = 8 So, with your patch, the value of d is correct. I don't know why, but with your patch from yesterday, I was still seeing the faulty behavior. (It is possible that I messed up with my testing...) Kevin