From adcf2eed05bb041ba579d74102c18ea1e97b29d6 Mon Sep 17 00:00:00 2001 From: Hui Zhu Date: Tue, 7 Jan 2014 00:24:41 +0800 Subject: Remove gdb_bfd_stash_filename to fix crash with fix of binutils/11983 https://sourceware.org/ml/gdb-patches/2014-01/msg00029.html https://sourceware.org/ml/gdb-patches/2014-01/msg00053.html 2014-01-07 Hui Zhu * gdb_bfd.c (gdb_bfd_stash_filename): Removed. (gdb_bfd_open): Removed gdb_bfd_stash_filename. (gdb_bfd_fopen): Ditto. (gdb_bfd_openr): Ditto. (gdb_bfd_openw): Ditto. (gdb_bfd_openr_iovec): Ditto. (gdb_bfd_fdopenr): Ditto. * gdb_bfd.h (gdb_bfd_stash_filename): Removed. * solib-aix.c (solib_aix_bfd_open): Alloc object_bfd->filename with xstrdup. * solib-darwin.c (darwin_bfd_open): Alloc res->filename with xstrdup. * symfile-mem.c (symbol_file_add_from_memory): Removed gdb_bfd_stash_filename. --- gdb/gdb_bfd.c | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) (limited to 'gdb/gdb_bfd.c') diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 36c4630..5230d21 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -57,21 +57,6 @@ struct gdb_bfd_section_data static htab_t all_bfds; -/* See gdb_bfd.h. */ - -void -gdb_bfd_stash_filename (struct bfd *abfd) -{ - char *name = bfd_get_filename (abfd); - char *data; - - data = bfd_alloc (abfd, strlen (name) + 1); - strcpy (data, name); - - /* Unwarranted chumminess with BFD. */ - abfd->filename = data; -} - /* An object of this type is stored in each BFD's user data. */ struct gdb_bfd_data @@ -204,7 +189,6 @@ gdb_bfd_open (const char *name, const char *target, int fd) gdb_assert (!*slot); *slot = abfd; - gdb_bfd_stash_filename (abfd); gdb_bfd_ref (abfd); return abfd; } @@ -490,10 +474,7 @@ gdb_bfd_fopen (const char *filename, const char *target, const char *mode, bfd *result = bfd_fopen (filename, target, mode, fd); if (result) - { - gdb_bfd_stash_filename (result); - gdb_bfd_ref (result); - } + gdb_bfd_ref (result); return result; } @@ -506,10 +487,7 @@ gdb_bfd_openr (const char *filename, const char *target) bfd *result = bfd_openr (filename, target); if (result) - { - gdb_bfd_stash_filename (result); - gdb_bfd_ref (result); - } + gdb_bfd_ref (result); return result; } @@ -522,10 +500,7 @@ gdb_bfd_openw (const char *filename, const char *target) bfd *result = bfd_openw (filename, target); if (result) - { - gdb_bfd_stash_filename (result); - gdb_bfd_ref (result); - } + gdb_bfd_ref (result); return result; } @@ -553,10 +528,7 @@ gdb_bfd_openr_iovec (const char *filename, const char *target, pread_func, close_func, stat_func); if (result) - { - gdb_bfd_ref (result); - gdb_bfd_stash_filename (result); - } + gdb_bfd_ref (result); return result; } @@ -603,10 +575,7 @@ gdb_bfd_fdopenr (const char *filename, const char *target, int fd) bfd *result = bfd_fdopenr (filename, target, fd); if (result) - { - gdb_bfd_ref (result); - gdb_bfd_stash_filename (result); - } + gdb_bfd_ref (result); return result; } -- cgit v1.1