diff options
author | Tom Tromey <tom@tromey.com> | 2020-10-29 15:04:33 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-10-29 15:04:34 -0600 |
commit | 8a4f140205d1fb7240b154fd2f9074d7b42330b7 (patch) | |
tree | 871e1273de3a465496fcf4d037904c756ea48375 /gdb/progspace.c | |
parent | c20cb6860c27d6ef15a1e561f4be78e7b85952ac (diff) | |
download | binutils-8a4f140205d1fb7240b154fd2f9074d7b42330b7.zip binutils-8a4f140205d1fb7240b154fd2f9074d7b42330b7.tar.gz binutils-8a4f140205d1fb7240b154fd2f9074d7b42330b7.tar.bz2 |
Change exec_close to be a method on program_space
exec_close uses the current program space, so it seemed cleaner to
change it to be a method on program_space. This patch makes this
change.
gdb/ChangeLog
2020-10-29 Tom Tromey <tom@tromey.com>
* progspace.c (program_space::exec_close): New method, from
exec_close in exec.c.
* exec.c (exec_close): Move to progspace.c.
(exec_target::close, exec_file_attach): Update.
* progspace.h (struct program_space) <exec_close>: Declare
method.
Diffstat (limited to 'gdb/progspace.c')
-rw-r--r-- | gdb/progspace.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/progspace.c b/gdb/progspace.c index 7600123..8a15c40 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -223,6 +223,26 @@ program_space::solibs () const return next_adapter<struct so_list> (this->so_list); } +/* See progspace.h. */ + +void +program_space::exec_close () +{ + if (ebfd) + { + gdb_bfd_unref (ebfd); + + /* Removing target sections may close the exec_ops target. + Clear exec_bfd before doing so to prevent recursion. */ + ebfd = NULL; + ebfd_mtime = 0; + + remove_target_sections (&ebfd); + + exec_filename.reset (nullptr); + } +} + /* Copies program space SRC to DEST. Copies the main executable file, and the main symbol file. Returns DEST. */ |