summaryrefslogtreecommitdiff
path: root/gdb/corelow.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-18 19:34:57 +0000
committerTom Tromey <tromey@redhat.com>2012-07-18 19:34:57 +0000
commit6bae30f0df82cae05a3d708223dbe7783202295c (patch)
tree7f7547e8aa2d4fbb4ce4a961cba27c0976921238 /gdb/corelow.c
parente1a653b8460251c21a226128b5281fac3f783328 (diff)
downloadgdb-6bae30f0df82cae05a3d708223dbe7783202295c.tar.gz
* symfile.c (symfile_bfd_open): Don't copy name. Call
gdb_bfd_stash_filename. (load_command): Open the new BFD before freeing the old. (bfd_open_maybe_remote): Call gdb_bfd_stash_filename. * symfile-mem.c (symbol_file_add_from_memory): Don't copy name. Call gdb_bfd_stash_filename. * spu-linux-nat.c (spu_bfd_open): Don't copy name. * solib-spu.c (spu_bfd_fopen): Don't copy name. Call gdb_bfd_stash_filename. * solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init): Free found_pathname. * rs6000-nat.c (add_vmap): Don't copy filename. Call gdb_bfd_stash_filename. * remote.c (remote_bfd_open): Call gdb_bfd_stash_filename. * machoread.c (macho_add_oso_symfile): Call gdb_bfd_stash_filename. (macho_symfile_read_all_oso): Arrange to free archive_name. Call gdb_bfd_stash_filename. (macho_check_dsym): Don't copy filename. Call gdb_bfd_stash_filename. * jit.c (bfd_open_from_target_memory): Don't copy the filename. * gdb_bfd.c (gdb_bfd_stash_filename): New function. * gdb_bfd.h (gdb_bfd_stash_filename): Declare. * gcore.c (create_gcore_bfd): Call gdb_bfd_stash_filename. * exec.c (exec_close): Don't free the BFD's filename. (exec_file_attach): Don't copy the filename. Call gdb_bfd_stash_filename. * corelow.c (core_close): Don't free the BFD's filename. (core_open): Call gdb_bfd_stash_filename. * corefile.c (reopen_exec_file): Remove #if 0 code. * solib.c (solib_bfd_fopen): Call gdb_bfd_stash_filename. Free pathname. * dwarf2read.c (try_open_dwo_file): Call gdb_bfd_stash_filename.
Diffstat (limited to 'gdb/corelow.c')
-rw-r--r--gdb/corelow.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 3dfa2f483d3..1fd60e41db5 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -216,9 +216,7 @@ core_close (int quitting)
core_data = NULL;
}
- name = bfd_get_filename (core_bfd);
gdb_bfd_unref (core_bfd);
- xfree (name);
core_bfd = NULL;
}
core_vec = NULL;
@@ -326,6 +324,8 @@ core_open (char *filename, int from_tty)
if (temp_bfd == NULL)
perror_with_name (filename);
+ gdb_bfd_stash_filename (temp_bfd);
+
if (!bfd_check_format (temp_bfd, bfd_core)
&& !gdb_check_format (temp_bfd))
{
@@ -341,7 +341,7 @@ core_open (char *filename, int from_tty)
/* Looks semi-reasonable. Toss the old core file and work on the
new. */
- discard_cleanups (old_chain); /* Don't free filename any more */
+ do_cleanups (old_chain);
unpush_target (&core_ops);
core_bfd = temp_bfd;
old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/);