* hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence): Use
[deliverable/binutils-gdb.git] / gdb / jit.c
index 7bd6b36bb89ee1324e6b76332c55a8b4f803e31a..c1274237259e8aff9220339fc58db760898c3eab 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -239,7 +239,8 @@ struct jit_inferior_data
   CORE_ADDR descriptor_addr;  /* &__jit_debug_descriptor  */
 };
 
-/* Remember a mapping from entry_addr to objfile.  */
+/* Remember OBJFILE has been created for struct jit_code_entry located
+   at inferior address ENTRY.  */
 
 static void
 add_objfile_entry (struct objfile *objfile, CORE_ADDR entry)
@@ -693,9 +694,7 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
   objfile = allocate_objfile (NULL, 0);
   objfile->gdbarch = target_gdbarch;
 
-  objfile->msymbols = obstack_alloc (&objfile->objfile_obstack,
-                                     sizeof (struct minimal_symbol));
-  memset (objfile->msymbols, 0, sizeof (struct minimal_symbol));
+  terminate_minimal_symbol_table (objfile);
 
   xfree (objfile->name);
   objfile->name = xstrdup ("<< JIT compiled code >>");
@@ -710,10 +709,13 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
   xfree (obj);
 }
 
-/* Try to read CODE_ENTRY using the loaded jit reader (if any).  */
+/* Try to read CODE_ENTRY using the loaded jit reader (if any).
+   ENTRY_ADDR is the address of the struct jit_code_entry in the
+   inferior address space.  */
 
 static int
-jit_reader_try_read_symtab (struct jit_code_entry *code_entry)
+jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
+                            CORE_ADDR entry_addr)
 {
   void *gdb_mem;
   int status;
@@ -735,7 +737,7 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry)
       &priv_data
     };
 
-  priv_data = code_entry->symfile_addr;
+  priv_data = entry_addr;
 
   if (!loaded_jit_reader)
     return 0;
@@ -765,10 +767,12 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry)
   return status;
 }
 
-/* Try to read CODE_ENTRY using BFD.  */
+/* Try to read CODE_ENTRY using BFD.  ENTRY_ADDR is the address of the
+   struct jit_code_entry in the inferior address space.  */
 
 static void
 jit_bfd_try_read_symtab (struct jit_code_entry *code_entry,
+                         CORE_ADDR entry_addr,
                          struct gdbarch *gdbarch)
 {
   bfd *nbfd;
@@ -832,7 +836,7 @@ JITed symbol file is not an object file, ignoring it.\n"));
   objfile = symbol_file_add_from_bfd (nbfd, 0, sai, OBJF_SHARED, NULL);
 
   do_cleanups (old_cleanups);
-  add_objfile_entry (objfile, code_entry->symfile_addr);
+  add_objfile_entry (objfile, entry_addr);
 }
 
 /* This function registers code associated with a JIT code entry.  It uses the
@@ -855,10 +859,10 @@ jit_register_code (struct gdbarch *gdbarch,
                         paddress (gdbarch, code_entry->symfile_addr),
                         pulongest (code_entry->symfile_size));
 
-  success = jit_reader_try_read_symtab (code_entry);
+  success = jit_reader_try_read_symtab (code_entry, entry_addr);
 
   if (!success)
-    jit_bfd_try_read_symtab (code_entry, gdbarch);
+    jit_bfd_try_read_symtab (code_entry, entry_addr, gdbarch);
 }
 
 /* This function unregisters JITed code and frees the corresponding
This page took 0.02367 seconds and 4 git commands to generate.