This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] dangling cleanup in find_frame_funname
- From: Doug Evans <dje at google dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>, Joel Brobecker <brobecker at adacore dot com>
- Date: Fri, 17 May 2013 10:52:23 -0700
- Subject: Re: [RFA] dangling cleanup in find_frame_funname
- References: <51953293 dot 1020502 at redhat dot com>
On Thu, May 16, 2013 at 12:25 PM, Keith Seitz <keiths@redhat.com> wrote:
> [I'm cc'ing Joel on this, since I believe this is the same assertion failure
> that he is seeing.]
>
> While testing insight, I ran across the following assertion:
>
> ../../gdb/gdb/cleanups.c:264: internal-error: restore_my_cleanups: Assertion
> `*pmy_chain == SENTINEL_CLEANUP' failed.
>
> This is caused by a dangling cleanup in find_frame_funname, which uses a
> (dangling) cleanup to free memory for the returned function name in some
> instances.
>
> I've corrected this by simply requiring the caller to free any memory.
>
> Unfortunately, I don't have a test case to trigger the failure. Perhaps Joel
> can describe an ada test case?
>
> This patch definitely needs a few fresh eyeballs...
>
> Keith
>
> ChangeLog
> 2013-05-16 Keith Seitz <keiths@redhat.com>
>
> * ada-lang.c (is_known_support_routine): Add explicit free of
> 'func_name' from find_frame_funname.
> (ada_unhandled_exception_name_addr_from_raise): Likewise.
> * python/py-frame.c (frapy_name): Likewise for 'name'.
> * stack.c (find_frame_funname): Add comment explaining that
> funcp must be freed by the caller.
> Return copy of symbol names instead of pointers.
> (print_frame): Add a cleanup for 'funname' from
> find_frame_funname.
> * stack.h (find_frame_funname): Remove "const" from
> 'funname' parameter.
Looks ok to me.