X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fexec.c;h=2c9a74bcaa45348195ce58553747d34f782edc03;hb=9494d9636612cd9bd22e38625fbc89147beafea7;hp=eeca005b39fc662eec9ae5d1e577a24383dd1e7c;hpb=ecf45d2cc7667ed4692d07e52fc77a2c9a8adf1c;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/exec.c b/gdb/exec.c index eeca005b39..2c9a74bcaa 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -1,6 +1,6 @@ /* Work with executable files, for GDB. - Copyright (C) 1988-2016 Free Software Foundation, Inc. + Copyright (C) 1988-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -258,7 +258,9 @@ exec_file_attach (const char *filename, int from_tty) this at the end of the function; but acquiring it now lets the BFD cache return it if this call refers to the same file. */ gdb_bfd_ref (exec_bfd); - cleanups = make_cleanup_bfd_unref (exec_bfd); + gdb_bfd_ref_ptr exec_bfd_holder (exec_bfd); + + cleanups = make_cleanup (null_cleanup, NULL); /* Remove any previous exec file. */ exec_close (); @@ -333,11 +335,13 @@ exec_file_attach (const char *filename, int from_tty) make_cleanup (xfree, canonical_pathname); } + gdb_bfd_ref_ptr temp; if (write_files && !load_via_target) - exec_bfd = gdb_bfd_fopen (canonical_pathname, gnutarget, - FOPEN_RUB, scratch_chan); + temp = gdb_bfd_fopen (canonical_pathname, gnutarget, + FOPEN_RUB, scratch_chan); else - exec_bfd = gdb_bfd_open (canonical_pathname, gnutarget, scratch_chan); + temp = gdb_bfd_open (canonical_pathname, gnutarget, scratch_chan); + exec_bfd = temp.release (); if (!exec_bfd) {