From bde539c2f9e19271d6d6c740f875b4129e03eba3 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 24 May 2022 15:17:19 -0600 Subject: Change allocation of type-copying hash table When an objfile is destroyed, types that are still in use and allocated on that objfile are copied. A temporary hash map is created during this process, and it is allocated on the destroyed objfile's obstack -- which normally is fine, as that is going to be destroyed shortly anyway. However, this approach requires that the objfile be passed to registry destruction, and this won't be possible in the rewritten registry. This patch changes the copied type hash table to simply use the heap instead. It also removes the 'objfile' parameter from copy_type_recursive, to make this all more clear. This patch also fixes an apparent bug in copy_type_recursive. Previously it was copying the dynamic property list to the dying objfile's obstack: - = copy_dynamic_prop_list (&objfile->objfile_obstack, However I think this is incorrect -- that obstack is about to be destroyed. --- gdb/compile/compile-object-run.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/compile/compile-object-run.c') diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c index 331ae35..6fcd10b 100644 --- a/gdb/compile/compile-object-run.c +++ b/gdb/compile/compile-object-run.c @@ -109,8 +109,8 @@ do_module_cleanup (void *arg, int registers_valid) static type * create_copied_type_recursive (objfile *objfile, type *func_type) { - htab_up copied_types = create_copied_types_hash (objfile); - func_type = copy_type_recursive (objfile, func_type, copied_types.get ()); + htab_up copied_types = create_copied_types_hash (); + func_type = copy_type_recursive (func_type, copied_types.get ()); return func_type; } -- cgit v1.1