This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Remove gdb_bfd_stash_filename to fix crash with fix of binutils/11983
- From: Hui Zhu <hui_zhu at mentor dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Sun, 5 Jan 2014 00:23:39 +0800
- Subject: [PATCH] Remove gdb_bfd_stash_filename to fix crash with fix of binutils/11983
- Authentication-results: sourceware.org; auth=none
Got double free or corruption with new GDB:
(gdb) r
Starting program: /home/teawater/tmp/a.out
*** glibc detected *** /home/teawater/gdb/git/bgdbno/gdb/gdb: double free or corruption (out): 0x00000000011ed4d0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7ffff65f5b96]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x7c4c95]
/home/teawater/gdb/git/bgdbno/gdb/gdb(bfd_close+0xb3)[0x7c5683]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x651d0b]
/home/teawater/gdb/git/bgdbno/gdb/gdb(gdb_bfd_unref+0x146)[0x651fb3]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x5f7e2d]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x5f80a0]
/home/teawater/gdb/git/bgdbno/gdb/gdb(find_separate_debug_file_by_debuglink+0x18e)[0x5f85cd]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x563ee9]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x5f7206]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x5f76f5]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x5f773d]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x5f792d]
/home/teawater/gdb/git/bgdbno/gdb/gdb(symbol_file_add_from_bfd+0x43)[0x5f7b23]
/home/teawater/gdb/git/bgdbno/gdb/gdb(solib_read_symbols+0x173)[0x753fdb]
/home/teawater/gdb/git/bgdbno/gdb/gdb(solib_add+0x15c)[0x75468a]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x48f824]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x490bf2]
/home/teawater/gdb/git/bgdbno/gdb/gdb(solib_create_inferior_hook+0x2b)[0x754cd6]
/home/teawater/gdb/git/bgdbno/gdb/gdb(post_create_inferior+0xbf)[0x60b8ed]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x60bc92]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x60bcec]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x51caab]
/home/teawater/gdb/git/bgdbno/gdb/gdb(cmd_func+0x3f)[0x51fd40]
/home/teawater/gdb/git/bgdbno/gdb/gdb(execute_command+0x293)[0x736569]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x636ad6]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x63713f]
/home/teawater/gdb/git/bgdbno/gdb/gdb(rl_callback_read_char+0x341)[0x792534]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x636569]
/home/teawater/gdb/git/bgdbno/gdb/gdb(stdin_event_handler+0x78)[0x6369ed]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x6354f5]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x6349bb]
/home/teawater/gdb/git/bgdbno/gdb/gdb(gdb_do_one_event+0xb9)[0x634a82]
/home/teawater/gdb/git/bgdbno/gdb/gdb(start_event_loop+0x3f)[0x634ad3]
/home/teawater/gdb/git/bgdbno/gdb/gdb(cli_command_loop+0x1b)[0x63659b]
/home/teawater/gdb/git/bgdbno/gdb/gdb(current_interp_command_loop+0x5b)[0x62cdc2]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x62d823]
/home/teawater/gdb/git/bgdbno/gdb/gdb(catch_errors+0x5f)[0x62b16d]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x62ec36]
/home/teawater/gdb/git/bgdbno/gdb/gdb(catch_errors+0x5f)[0x62b16d]
/home/teawater/gdb/git/bgdbno/gdb/gdb(gdb_main+0x34)[0x62ec6c]
/home/teawater/gdb/git/bgdbno/gdb/gdb(main+0x5b)[0x45d63f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7ffff659876d]
/home/teawater/gdb/git/bgdbno/gdb/gdb[0x45d529]
======= Memory map: ========
00400000-00bf1000 r-xp 00000000 08:07 10618880 /home/teawater/gdb/git/bgdbno/gdb/gdb
00df0000-00df1000 r--p 007f0000 08:07 10618880 /home/teawater/gdb/git/bgdbno/gdb/gdb
00df1000-00e10000 rw-p 007f1000 08:07 10618880 /home/teawater/gdb/git/bgdbno/gdb/gdb
00e10000-011fc000 rw-p 00000000 00:00 0 [heap]
7ffff54b0000-7ffff54b3000 r-xp 00000000 08:05 2504246 /usr/lib/python2.7/lib-dynload/_heapq.so
7ffff54b3000-7ffff56b2000 ---p 00003000 08:05 2504246 /usr/lib/python2.7/lib-dynload/_heapq.so
7ffff56b2000-7ffff56b3000 r--p 00002000 08:05 2504246 /usr/lib/python2.7/lib-dynload/_heapq.so
7ffff56b3000-7ffff56b5000 rw-p 00003000 08:05 2504246 /usr/lib/python2.7/lib-dynload/_heapq.so
7ffff56b5000-7ffff5b25000 r--p 00000000 08:05 2500039 /usr/lib/locale/locale-archive
7ffff5b25000-7ffff5b3a000 r-xp 00000000 08:05 268475 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff5b3a000-7ffff5d39000 ---p 00015000 08:05 268475 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff5d39000-7ffff5d3a000 r--p 00014000 08:05 268475 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff5d3a000-7ffff5d3b000 rw-p 00015000 08:05 268475 /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffff5d3b000-7ffff5d3d000 r-xp 00000000 08:05 263571 /lib/x86_64-linux-gnu/libutil-2.15.so
7ffff5d3d000-7ffff5f3c000 ---p 00002000 08:05 263571 /lib/x86_64-linux-gnu/libutil-2.15.so
7ffff5f3c000-7ffff5f3d000 r--p 00001000 08:05 263571 /lib/x86_64-linux-gnu/libutil-2.15.so
7ffff5f3d000-7ffff5f3e000 rw-p 00002000 08:05 263571 /lib/x86_64-linux-gnu/libutil-2.15.so
7ffff5f3e000-7ffff60ef000 r-xp 00000000 08:05 274377 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7ffff60ef000-7ffff62ef000 ---p 001b1000 08:05 274377 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7ffff62ef000-7ffff630a000 r--p 001b1000 08:05 274377 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7ffff630a000-7ffff6315000 rw-p 001cc000 08:05 274377 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7ffff6315000-7ffff6319000 rw-p 00000000 00:00 0
7ffff6319000-7ffff636d000 r-xp 00000000 08:05 274381 /lib/x86_64-linux-gnu/libssl.so.1.0.0
7ffff636d000-7ffff656d000 ---p 00054000 08:05 274381 /lib/x86_64-linux-gnu/libssl.so.1.0.0
7ffff656d000-7ffff6570000 r--p 00054000 08:05 274381 /lib/x86_64-linux-gnu/libssl.so.1.0.0
7ffff6570000-7ffff6576000 rw-p 00057000 08:05 274381 /lib/x86_64-linux-gnu/libssl.so.1.0.0
7ffff6576000-7ffff6577000 rw-p 00000000 00:00 0
7ffff6577000-7ffff672c000 r-xp 00000000 08:05 263572 /lib/x86_64-linux-gnu/libc-2.15.so
7ffff672c000-7ffff692c000 ---p 001b5000 08:05 263572 /lib/x86_64-linux-gnu/libc-2.15.so
7ffff692c000-7ffff6930000 r--p 001b5000 08:05 263572 /lib/x86_64-linux-gnu/libc-2.15.so
7ffff6930000-7ffff6932000 rw-p 001b9000 08:05 263572 /lib/x86_64-linux-gnu/libc-2.15.so
7ffff6932000-7ffff6937000 rw-p 00000000 00:00 0
7ffff6937000-7ffff695e000 r-xp 00000000 08:05 262183 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
7ffff695e000-7ffff6b5e000 ---p 00027000 08:05 262183 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
7ffff6b5e000-7ffff6b60000 r--p 00027000 08:05 262183 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
7ffff6b60000-7ffff6b61000 rw-p 00029000 08:05 262183 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
7ffff6b61000-7ffff6de2000 r-xp 00000000 08:05 2491217 /usr/lib/libpython2.7.so.1.0
7ffff6de2000-7ffff6fe1000 ---p 00281000 08:05 2491217 /usr/lib/libpython2.7.so.1.0
7ffff6fe1000-7ffff6fe3000 r--p 00280000 08:05 2491217 /usr/lib/libpython2.7.so.1.0
7ffff6fe3000-7ffff704c000 rw-p 00282000 08:05 2491217 /usr/lib/libpython2.7.so.1.0
7ffff704c000-7ffff705e000 rw-p 00000000 00:00 0
7ffff705e000-7ffff7076000 r-xp 00000000 08:05 269928 /lib/x86_64-linux-gnu/libpthread-2.15.so
7ffff7076000-7ffff7275000 ---p 00018000 08:05 269928 /lib/x86_64-linux-gnu/libpthread-2.15.so
7ffff7275000-7ffff7276000 r--p 00017000 08:05 269928 /lib/x86_64-linux-gnu/libpthread-2.15.so
7ffff7276000-7ffff7277000 rw-p 00018000 08:05 269928 /lib/x86_64-linux-gnu/libpthread-2.15.so
7ffff7277000-7ffff727b000 rw-p 00000000 00:00 0
7ffff727b000-7ffff7376000 r-xp 00000000 08:05 269930 /lib/x86_64-linux-gnu/libm-2.15.so
7ffff7376000-7ffff7575000 ---p 000fb000 08:05 269930 /lib/x86_64-linux-gnu/libm-2.15.so
7ffff7575000-7ffff7576000 r--p 000fa000 08:05 269930 /lib/x86_64-linux-gnu/libm-2.15.so
7ffff7576000-7ffff7577000 rw-p 000fb000 08:05 269930 /lib/x86_64-linux-gnu/libm-2.15.so
7ffff7577000-7ffff758d000 r-xp 00000000 08:05 268782 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7ffff758d000-7ffff778c000 ---p 00016000 08:05 268782 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7ffff778c000-7ffff778d000 r--p 00015000 08:05 268782 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7ffff778d000-7ffff778e000 rw-p 00016000 08:05 268782 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7ffff778e000-7ffff77b0000 r-xp 00000000 08:05 262294 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7ffff77b0000-7ffff79b0000 ---p 00022000 08:05 262294 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7ffff79b0000-7ffff79b4000 r--p 00022000 08:05 262294 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7ffff79b4000-7ffff79b5000 rw-p 00026000 08:05 262294 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7ffff79b5000-7ffff79d4000 r-xp 00000000 08:05 263652 /lib/x86_64-linux-gnu/libncurses.so.5.9
7ffff79d4000-7ffff7bd4000 ---p 0001f000 08:05 263652 /lib/x86_64-linux-gnu/libncurses.so.5.9
7ffff7bd4000-7ffff7bd5000 r--p 0001f000 08:05 263652 /lib/x86_64-linux-gnu/libncurses.so.5.9
7ffff7bd5000-7ffff7bd6000 rw-p 00020000 08:05 263652 /lib/x86_64-linux-gnu/libncurses.so.5.9
7ffff7bd6000-7ffff7bd8000 r-xp 00000000 08:05 275939 /lib/x86_64-linux-gnu/libdl-2.15.so
7ffff7bd8000-7ffff7dd8000 ---p 00002000 08:05 275939 /lib/x86_64-linux-gnu/libdl-2.15.so
7ffff7dd8000-7ffff7dd9000 r--p 00002000 08:05 275939 /lib/x86_64-linux-gnu/libdl-2.15.so
7ffff7dd9000-7ffff7dda000 rw-p 00003000 08:05 275939 /lib/x86_64-linux-gnu/libdl-2.15.so
7ffff7dda000-7ffff7dfc000 r-xp 00000000 08:05 269931 /lib/x86_64-linux-gnu/ld-2.15.so
7ffff7f10000-7ffff7f41000 rw-p 00000000 00:00 0
7ffff7f42000-7ffff7fcc000 rw-p 00000000 00:00 0
7ffff7fd2000-7ffff7fd8000 rw-p 00000000 00:00 0
7ffff7fd8000-7ffff7fed000 r--p 00000000 08:05 2915761 /usr/share/locale-langpack/zh_CN/LC_MESSAGES/libc.mo
7ffff7fed000-7ffff7ff4000 r--s 00000000 08:05 2516792 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7ffff7ff4000-7ffff7ff9000 r--p 00000000 08:05 2910407 /usr/share/locale-langpack/zh_CN/LC_MESSAGES/gdb.mo
7ffff7ff9000-7ffff7ffb000 rw-p 00000000 00:00 0
7ffff7ffb000-7ffff7ffc000 r-xp 00000000 00:00 0 [vdso]
7ffff7ffc000-7ffff7ffd000 r--p 00022000 08:05 269931 /lib/x86_64-linux-gnu/ld-2.15.so
7ffff7ffd000-7ffff7fff000 rw-p 00023000 08:05 269931 /lib/x86_64-linux-gnu/ld-2.15.so
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0 [stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Program received signal SIGABRT, Aborted.
0x00007ffff65ad425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff65ad425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff65b0b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff65eb39e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff65f5b96 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x00000000007c4c95 in _bfd_delete_bfd (abfd=0x11ebef0) at ../../binutils-gdb/bfd/opncls.c:127
#5 0x00000000007c5683 in bfd_close (abfd=0x11ebef0) at ../../binutils-gdb/bfd/opncls.c:743
#6 0x0000000000651d0b in gdb_bfd_close_or_warn (abfd=0x11ebef0) at ../../binutils-gdb/gdb/gdb_bfd.c:246
#7 0x0000000000651fb3 in gdb_bfd_unref (abfd=0x11ebef0) at ../../binutils-gdb/gdb/gdb_bfd.c:331
#8 0x00000000005f7e2d in separate_debug_file_exists (name=0x11ebe80 "/lib/x86_64-linux-gnu/ld-2.15.so", crc=2945490929,
parent_objfile=0x11e19c0) at ../../binutils-gdb/gdb/symfile.c:1329
#9 0x00000000005f80a0 in find_separate_debug_file (dir=0x11ec070 "/lib/x86_64-linux-gnu/",
canon_dir=0x11ec070 "/lib/x86_64-linux-gnu/", debuglink=0x11ec370 "ld-2.15.so", crc32=2945490929, objfile=0x11e19c0)
at ../../binutils-gdb/gdb/symfile.c:1420
#10 0x00000000005f85cd in find_separate_debug_file_by_debuglink (objfile=0x11e19c0)
at ../../binutils-gdb/gdb/symfile.c:1549
#11 0x0000000000563ee9 in elf_symfile_read (objfile=0x11e19c0, symfile_flags=8) at ../../binutils-gdb/gdb/elfread.c:1324
#12 0x00000000005f7206 in read_symbols (objfile=0x11e19c0, add_flags=8) at ../../binutils-gdb/gdb/symfile.c:839
#13 0x00000000005f76f5 in syms_from_objfile_1 (objfile=0x11e19c0, addrs=0x11c3970, add_flags=8)
at ../../binutils-gdb/gdb/symfile.c:1014
#14 0x00000000005f773d in syms_from_objfile (objfile=0x11e19c0, addrs=0x11c3970, add_flags=8)
at ../../binutils-gdb/gdb/symfile.c:1030
#15 0x00000000005f792d in symbol_file_add_with_addrs (abfd=0x1171e60, name=0x11e0db0 "/lib64/ld-linux-x86-64.so.2",
add_flags=8, addrs=0x11c3970, flags=2, parent=0x0) at ../../binutils-gdb/gdb/symfile.c:1127
#16 0x00000000005f7b23 in symbol_file_add_from_bfd (abfd=0x1171e60, name=0x11e0db0 "/lib64/ld-linux-x86-64.so.2",
add_flags=8, addrs=0x11c3970, flags=2, parent=0x0) at ../../binutils-gdb/gdb/symfile.c:1216
#17 0x0000000000753fdb in solib_read_symbols (so=0x11e0ba0, flags=8) at ../../binutils-gdb/gdb/solib.c:640
#18 0x000000000075468a in solib_add (pattern=0x0, from_tty=0, target=0xe2f360 <current_target>, readsyms=1)
at ../../binutils-gdb/gdb/solib.c:951
#19 0x000000000048f824 in enable_break (info=0x1154ec0, from_tty=0) at ../../binutils-gdb/gdb/solib-svr4.c:2282
---Type <return> to continue, or q <return> to quit---q
The reason is when GDB open bfd, it will call gdb_bfd_stash_filename to the memory of abfd.
But in binutils/11983, it add "(_bfd_delete_bfd): Free filename." So when gdb try to close the bfd, it will crash.
I make a patch to remove all gdb_bfd_stash_filename to fix this issue.
Thanks,
Hui
2014-01-05 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.
* symfile-mem.c (symbol_file_add_from_memory): Removed
gdb_bfd_stash_filename.
--- 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 ch
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, con
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, con
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, con
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 *filenam
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, c
bfd *result = bfd_fdopenr (filename, target, fd);
if (result)
- {
- gdb_bfd_ref (result);
- gdb_bfd_stash_filename (result);
- }
+ gdb_bfd_ref (result);
return result;
}
--- a/gdb/gdb_bfd.h
+++ b/gdb/gdb_bfd.h
@@ -24,12 +24,6 @@
DECLARE_REGISTRY (bfd);
-/* Make a copy ABFD's filename using bfd_alloc, and reassign it to the
- BFD. This ensures that the BFD's filename has the same lifetime as
- the BFD itself. */
-
-void gdb_bfd_stash_filename (struct bfd *abfd);
-
/* Open a read-only (FOPEN_RB) BFD given arguments like bfd_fopen.
Returns NULL on error. On success, returns a new reference to the
BFD, which must be freed with gdb_bfd_unref. BFDs returned by this
@@ -79,22 +73,22 @@ int gdb_bfd_crc (struct bfd *abfd, unsig
/* A wrapper for bfd_fopen that initializes the gdb-specific reference
- count and calls gdb_bfd_stash_filename. */
+ count. */
bfd *gdb_bfd_fopen (const char *, const char *, const char *, int);
/* A wrapper for bfd_openr that initializes the gdb-specific reference
- count and calls gdb_bfd_stash_filename. */
+ count. */
bfd *gdb_bfd_openr (const char *, const char *);
/* A wrapper for bfd_openw that initializes the gdb-specific reference
- count and calls gdb_bfd_stash_filename. */
+ count. */
bfd *gdb_bfd_openw (const char *, const char *);
/* A wrapper for bfd_openr_iovec that initializes the gdb-specific
- reference count and calls gdb_bfd_stash_filename. */
+ reference count. */
bfd *gdb_bfd_openr_iovec (const char *filename, const char *target,
void *(*open_func) (struct bfd *nbfd,
@@ -112,12 +106,12 @@ bfd *gdb_bfd_openr_iovec (const char *fi
struct stat *sb));
/* A wrapper for bfd_openr_next_archived_file that initializes the
- gdb-specific reference count and calls gdb_bfd_stash_filename. */
+ gdb-specific reference count. */
bfd *gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous);
/* A wrapper for bfd_fdopenr that initializes the gdb-specific
- reference count and calls gdb_bfd_stash_filename. */
+ reference count. */
bfd *gdb_bfd_fdopenr (const char *filename, const char *target, int fd);
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -104,11 +104,7 @@ symbol_file_add_from_memory (struct bfd
if (name == NULL)
nbfd->filename = "shared object read from target memory";
else
- {
- nbfd->filename = name;
- gdb_bfd_stash_filename (nbfd);
- xfree (name);
- }
+ nbfd->filename = name;
cleanup = make_cleanup_bfd_unref (nbfd);