This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove gdb_bfd_stash_filename to fix crash with fix of binutils/11983
- From: Tom Tromey <tromey at redhat dot com>
- To: Hui Zhu <hui_zhu at mentor dot com>
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>, gdb-patches ml <gdb-patches at sourceware dot org>, Edjunior Barbosa Machado <emachado at linux dot vnet dot ibm dot com>, Nick Clifton <nickc at redhat dot com>
- Date: Mon, 06 Jan 2014 01:25:49 -0700
- Subject: Re: [PATCH] Remove gdb_bfd_stash_filename to fix crash with fix of binutils/11983
- Authentication-results: sourceware.org; auth=none
- References: <52C8358B dot 7080101 at mentor dot com> <m3mwja5v01 dot fsf at redhat dot com> <52C97EC0 dot 3080807 at mentor dot com>
>>>>> "Hui" == Hui Zhu <hui_zhu@mentor.com> writes:
Hui> Thanks. Post a new version.
Thanks Hui. This is definitely the direction I think the code should
go.
Hui> --- a/gdb/symfile-mem.c
Hui> +++ b/gdb/symfile-mem.c
Hui> @@ -104,11 +104,7 @@ symbol_file_add_from_memory (struct bfd
Hui> if (name == NULL)
Hui> nbfd-> filename = "shared object read from target memory";
Hui> else
Hui> - {
Hui> - nbfd->filename = name;
Hui> - gdb_bfd_stash_filename (nbfd);
Hui> - xfree (name);
Hui> - }
Hui> + nbfd->filename = name;
Hui> cleanup = make_cleanup_bfd_unref (nbfd);
In this hunk there are two things to note.
First, there is an earlier assignment to filename (in the context above)
that should use xstrdup.
Second, the new assignment really ought to free the old nbfd->filename
first.
There are also some assignments that must be fixed that do not use
gdb_bfd_stash_filename:
solib-aix.c:solib_aix_bfd_open
solib-darwin.c:darwin_bfd_open
solib-spu.c:spu_bfd_open
spu-linux-nat.c:spu_bfd_open
If you don't get to this soon, no worries, I will add these to your
patch tomorrow morning and check it in.
Tom