aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdb_bfd.c
diff options
context:
space:
mode:
authorHui Zhu <teawater@gmail.com>2014-01-07 00:24:41 +0800
committerHui Zhu <teawater@gmail.com>2014-01-07 00:24:41 +0800
commitadcf2eed05bb041ba579d74102c18ea1e97b29d6 (patch)
tree54836e00abea7a4194e2ca56c46f72d6f769570e /gdb/gdb_bfd.c
parentb0b0c9fc49b72ec4f0f38419f20bcafcae9736d8 (diff)
downloadgdb-adcf2eed05bb041ba579d74102c18ea1e97b29d6.zip
gdb-adcf2eed05bb041ba579d74102c18ea1e97b29d6.tar.gz
gdb-adcf2eed05bb041ba579d74102c18ea1e97b29d6.tar.bz2
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 <hui@codesourcery.com> * 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.
Diffstat (limited to 'gdb/gdb_bfd.c')
-rw-r--r--gdb/gdb_bfd.c41
1 files changed, 5 insertions, 36 deletions
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;
}