Make the objfile destructor private
[deliverable/binutils-gdb.git] / gdb / jit.c
index b6e51e4f8b4dc45aababed6d5ed5b7c20edddb3c..59da4e0cee1d8c2e42d680f3ba3bb73ab3d86bd4 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -786,8 +786,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
 
   priv_data = (jit_dbg_reader_data *) cb->priv_data;
 
-  objfile = new struct objfile (NULL, "<< JIT compiled code >>",
-                               OBJF_NOT_FILENAME);
+  objfile = objfile::make (nullptr, "<< JIT compiled code >>",
+                          OBJF_NOT_FILENAME);
   objfile->per_bfd->gdbarch = target_gdbarch ();
 
   j = NULL;
@@ -951,18 +951,6 @@ jit_register_code (struct gdbarch *gdbarch,
     jit_bfd_try_read_symtab (code_entry, entry_addr, gdbarch);
 }
 
-/* This function unregisters JITed code and frees the corresponding
-   objfile.  */
-
-static void
-jit_unregister_code (struct objfile *objfile)
-{
-  if (jit_debug)
-    fprintf_unfiltered (gdb_stdlog, "jit_unregister_code (%s)\n",
-                       host_address_to_string (objfile));
-  delete objfile;
-}
-
 /* Look up the objfile with this code entry address.  */
 
 static struct objfile *
@@ -1380,7 +1368,7 @@ jit_inferior_exit_hook (struct inferior *inf)
        = (struct jit_objfile_data *) objfile_data (objf, jit_objfile_data);
 
       if (objf_data != NULL && objf_data->addr != 0)
-       jit_unregister_code (objf);
+       objf->unlink ();
     }
 }
 
@@ -1414,7 +1402,7 @@ jit_event_handler (struct gdbarch *gdbarch)
                             "entry at address: %s\n"),
                           paddress (gdbarch, entry_addr));
       else
-        jit_unregister_code (objf);
+        objf->unlink ();
 
       break;
     default:
This page took 0.025361 seconds and 4 git commands to generate.