diff options
author | Tom Tromey <tom@tromey.com> | 2020-09-23 09:32:54 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-09-23 09:32:56 -0600 |
commit | 92677124d90f0690ec5ffb6ee0a7b5097f95b135 (patch) | |
tree | 857576b16b81d4d26c44f3c66ef4192148b64cdb /gdb/compile/compile-object-run.c | |
parent | e616f60a6bc233acdb9ad1c37833a976f21aecec (diff) | |
download | binutils-92677124d90f0690ec5ffb6ee0a7b5097f95b135.zip binutils-92677124d90f0690ec5ffb6ee0a7b5097f95b135.tar.gz binutils-92677124d90f0690ec5ffb6ee0a7b5097f95b135.tar.bz2 |
Simplify compile_module cleanup
This simplifies compile_module cleanup by removing the need to
explicitly free anything. struct setup_sections_data is also cleaned
up a bit.
gdb/ChangeLog
2020-09-23 Tom Tromey <tom@tromey.com>
* compile/compile-object-run.c (do_module_cleanup)
<~do_module_cleanup> :Remove.
(do_module_cleanup): Update.
* compile/compile-object-load.h (struct munmap_list): Add move
assignment operator.
<source_file>: Now a std::string.
<munmap_list>: Rename. No longer a pointer.
* compile/compile-object-load.c (struct setup_sections_data): Add
constructor.
<setup_one_section>: Declare.
<munmap_list>: Move earlier.
<m_bfd>: New member.
<m_last_size, m_last_section_first, m_last_prot,
m_last_max_alignment>: Rename, add initializers where needed.
(setup_sections_data::setup_one_section): Rename from
setup_sections. Update.
(compile_object_load): Update. Don't use bfd_map_over_sections.
Diffstat (limited to 'gdb/compile/compile-object-run.c')
-rw-r--r-- | gdb/compile/compile-object-run.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c index b43e0b6..f355624 100644 --- a/gdb/compile/compile-object-run.c +++ b/gdb/compile/compile-object-run.c @@ -38,12 +38,6 @@ struct do_module_cleanup { } - ~do_module_cleanup () - { - delete module->munmap_list_head; - xfree (module->source_file); - } - DISABLE_COPY_AND_ASSIGN (do_module_cleanup); /* Boolean to set true upon a call of do_module_cleanup. @@ -102,7 +96,7 @@ do_module_cleanup (void *arg, int registers_valid) } /* Delete the .c file. */ - unlink (data->module->source_file); + unlink (data->module->source_file.c_str ()); /* Delete the .o file. */ unlink (objfile_name_s.c_str ()); |