From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19687 invoked by alias); 20 May 2013 05:28:31 -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 19660 invoked by uid 89); 20 May 2013 05:28:28 -0000 X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_HOSTKARMA_NO autolearn=no version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 20 May 2013 05:28:28 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 354EE2EB27; Mon, 20 May 2013 01:28:26 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id B-aVlXcqHJUw; Mon, 20 May 2013 01:28:26 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id BC9BB2E4C1; Mon, 20 May 2013 01:28:25 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id CCDA6C23BC; Mon, 20 May 2013 09:28:18 +0400 (RET) Date: Mon, 20 May 2013 05:28:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA] completer test [was Re: [RFC] Cleanup for make_source_files_completion_list] Message-ID: <20130520052818.GK4017@adacore.com> References: <519156F5.5090000@redhat.com> <5193C786.4000207@redhat.com> <5193E2DC.5000200@redhat.com> <51941E85.8010104@redhat.com> <20130516053008.GA5555@adacore.com> <20130516054906.GB5555@adacore.com> <5194FE2A.7000205@redhat.com> <20130517051435.GC4017@adacore.com> <87ehd5r2qr.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8GpibOaaTibBMecb" Content-Disposition: inline In-Reply-To: <87ehd5r2qr.fsf@fleche.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Found: No X-SW-Source: 2013-05/txt/msg00714.txt.bz2 --8GpibOaaTibBMecb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 657 > The checker found two -- the one you fixed in > ada_make_symbol_completion_list, and also a dangling cleanup in > old_renaming_is_invisible. This one seemed hard to fix and so > in my patch series I just punted on it by marking it with > the dangling_cleanup attribute. Do you see something obviously wrong with the attached patch? I haven't tested it yet, and I am not sure how much I can test it, given that old-style renamings have been replaced 6 years ago. I was looking at the option of removing support for them, but I actually know of some users still using an ancient version of the compiler but with a new version of the debugger... -- Joel --8GpibOaaTibBMecb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="old_renaming_is_invisible-cleanup.diff" Content-length: 1244 diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index fa6db0f..b6d5e0b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4726,17 +4726,20 @@ static int old_renaming_is_invisible (const struct symbol *sym, const char *function_name) { char *scope; + struct cleanup *old_chain; if (SYMBOL_CLASS (sym) != LOC_TYPEDEF) return 0; scope = xget_renaming_scope (SYMBOL_TYPE (sym)); - - make_cleanup (xfree, scope); + old_chain = make_cleanup (xfree, scope); /* If the rename has been defined in a package, then it is visible. */ if (is_package_name (scope)) - return 0; + { + do_cleanups (old_chain); + return 0; + } /* Check that the rename is in the current function scope by checking that its name starts with SCOPE. */ @@ -4748,7 +4751,12 @@ old_renaming_is_invisible (const struct symbol *sym, const char *function_name) if (strncmp (function_name, "_ada_", 5) == 0) function_name += 5; - return (strncmp (function_name, scope, strlen (scope)) != 0); + { + int is_invisible = strncmp (function_name, scope, strlen (scope)) != 0; + + do_cleanups (old_chain); + return is_invisible; + } } /* Remove entries from SYMS that corresponds to a renaming entity that --8GpibOaaTibBMecb--