From 92677124d90f0690ec5ffb6ee0a7b5097f95b135 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 23 Sep 2020 09:32:54 -0600 Subject: 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 * 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. : Now a std::string. : Rename. No longer a pointer. * compile/compile-object-load.c (struct setup_sections_data): Add constructor. : Declare. : Move earlier. : New member. : 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. --- gdb/compile/compile-object-load.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gdb/compile/compile-object-load.h') diff --git a/gdb/compile/compile-object-load.h b/gdb/compile/compile-object-load.h index 9def29e..0254390 100644 --- a/gdb/compile/compile-object-load.h +++ b/gdb/compile/compile-object-load.h @@ -29,6 +29,8 @@ public: DISABLE_COPY_AND_ASSIGN (munmap_list); + munmap_list &operator= (munmap_list &&) = default; + /* Add a region to the list. */ void add (CORE_ADDR addr, CORE_ADDR size); @@ -56,8 +58,8 @@ struct compile_module /* objfile for the compiled module. */ struct objfile *objfile; - /* .c file OBJFILE was built from. It needs to be xfree-d. */ - char *source_file; + /* .c file OBJFILE was built from. */ + std::string source_file; /* Inferior function GCC_FE_WRAPPER_FUNCTION. */ struct symbol *func_sym; @@ -81,7 +83,7 @@ struct compile_module CORE_ADDR out_value_addr; /* Track inferior memory reserved by inferior mmap. */ - struct munmap_list *munmap_list_head; + struct munmap_list munmap_list; }; /* A unique pointer for a compile_module. */ -- cgit v1.1