binutils-gdb/gdb/bfd-target.h
Tom Tromey 5768573861 Remove target_close
I noticed that target_close is only called in two places:
solib-svr4.c, and target_ops_ref_policy::decref.

This patch fixes the former by changing target_bfd_reopen to return a
target_ops_up and then fixing the sole caller.  Then it removes
target_close by inlining its body into the decref method.

The advantage of this approach is that targets are now automatically
managed.

Regression tested on x86-64 Fedora 38.

Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-07-10 15:43:08 -06:00

31 lines
1015 B
C

/* Very simple "bfd" target, for GDB, the GNU debugger.
Copyright (C) 2003-2023 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef BFD_TARGET_H
#define BFD_TARGET_H
#include "gdb_bfd.h"
struct target_ops;
/* Given an existing BFD, re-open it as a "struct target_ops". */
target_ops_up target_bfd_reopen (const gdb_bfd_ref_ptr &bfd);
#endif