This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] completer test [was Re: [RFC] Cleanup for make_source_files_completion_list]
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 20 May 2013 09:28:18 +0400
- Subject: Re: [RFA] completer test [was Re: [RFC] Cleanup for make_source_files_completion_list]
- References: <519156F5 dot 5090000 at redhat dot com> <5193C786 dot 4000207 at redhat dot com> <5193E2DC dot 5000200 at redhat dot com> <m3r4h7kh4p dot fsf at redhat dot com> <51941E85 dot 8010104 at redhat dot com> <20130516053008 dot GA5555 at adacore dot com> <20130516054906 dot GB5555 at adacore dot com> <5194FE2A dot 7000205 at redhat dot com> <20130517051435 dot GC4017 at adacore dot com> <87ehd5r2qr dot fsf at fleche dot redhat dot com>
> 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
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