Remove target_close
authorTom Tromey <tom@tromey.com>
Mon, 10 Jul 2023 00:46:53 +0000 (18:46 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 10 Jul 2023 21:43:08 +0000 (15:43 -0600)
commit57685738614a0089fba7f79669392b8d66d7c6af
tree0a18ff62ea218beea528c373209ddfbdfb12b22f
parent9fe01a376b2fb096e4836e985ba316ce9dc02399
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>
gdb/bfd-target.c
gdb/bfd-target.h
gdb/solib-svr4.c
gdb/target.c
gdb/target.h