From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60162 invoked by alias); 23 Jul 2015 18:23:01 -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 60035 invoked by uid 89); 23 Jul 2015 18:23:00 -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:22:59 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 0E7504C364 for ; Thu, 23 Jul 2015 18:22:58 +0000 (UTC) Received: from pinnacle.lan (ovpn-113-75.phx2.redhat.com [10.3.113.75]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6NIMvBX016075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO) for ; Thu, 23 Jul 2015 14:22:57 -0400 Date: Thu, 23 Jul 2015 18:23: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: <20150723112255.1b14a40a@pinnacle.lan> In-Reply-To: <20150723110653.3f4e2f11@pinnacle.lan> 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> <20150723110653.3f4e2f11@pinnacle.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00659.txt.bz2 Hi Pierre-Marie, On Thu, 23 Jul 2015 11:06:53 -0700 Kevin Buettner wrote: > --- 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 --- I came across something else (for someone) to ponder while playing with the above code. I don't necessarily expect your current patch to handle this case, but since you've been looking at nested subprograms, you may have some insight into what's happening. The situation is that I want to place a breakpoint on the function p(). How do I do this? This is what I've tried: 1) Placing a breakpoint on p without qualification does not work: (gdb) b p Function "p" not defined. Make breakpoint pending on future shared library load? (y or [n]) n 2) Placing a breakpoint on main::p doesn't work: (gdb) b main::p Function "main::p" not defined. Make breakpoint pending on future shared library load? (y or [n]) n 3a) However, the completion mechanism seems to think that p is a viable candidate for a breakpoint: (gdb) b p p printf printf@plt 3b) But, as in (1), when we try it (by hitting here), it does not work: Function "p" not defined. Make breakpoint pending on future shared library load? (y or [n]) n 4) Perhaps p will be visible if we run to a breakpoint in main? (Nope.) (gdb) b main Breakpoint 1 at 0x400525: file nested.c, line 5. (gdb) run Starting program: /mesquite2/.ironwood2/1158876/nested Breakpoint 1, main () at nested.c:5 5 int d = 4, e = 5, f = 6; (gdb) b p Function "p" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) So, there it is. I want to be perfectly clear that I do NOT want this issue to hold up your patch. I'm just throwing it out there in case you want to look at it. Kevin