GDB/MI: Document support for -exec-run --start in -list-features
[deliverable/binutils-gdb.git] / gdb / jit.c
index 8225540c2d54f90a12d41d477a77364be2d356cb..fde79e57df3fd787eaaa4f7dc094274a05216a12 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -37,7 +37,7 @@
 #include "symtab.h"
 #include "target.h"
 #include "gdb-dlfcn.h"
-#include "gdb_stat.h"
+#include <sys/stat.h>
 #include "exceptions.h"
 #include "gdb_bfd.h"
 
@@ -90,7 +90,9 @@ static int
 mem_bfd_iovec_close (struct bfd *abfd, void *stream)
 {
   xfree (stream);
-  return 1;
+
+  /* Zero means success.  */
+  return 0;
 }
 
 /* For reading the file, we just need to pass through to target_read_memory and
@@ -663,7 +665,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
 
   /* (begin, end) will contain the PC range this entire blockvector
      spans.  */
-  symtab->primary = 1;
+  set_symtab_primary (symtab, 1);
   BLOCKVECTOR_MAP (symtab->blockvector) = NULL;
   begin = stab->blocks->begin;
   end = stab->blocks->end;
@@ -783,13 +785,12 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
 
   priv_data = cb->priv_data;
 
-  objfile = allocate_objfile (NULL, 0);
-  objfile->gdbarch = target_gdbarch ();
+  objfile = allocate_objfile (NULL, "<< JIT compiled code >>",
+                             OBJF_NOT_FILENAME);
+  objfile->per_bfd->gdbarch = target_gdbarch ();
 
   terminate_minimal_symbol_table (objfile);
 
-  objfile->name = "<< JIT compiled code >>";
-
   j = NULL;
   for (i = obj->symtabs; i; i = j)
     {
@@ -925,7 +926,8 @@ JITed symbol file is not an object file, ignoring it.\n"));
 
   /* This call does not take ownership of SAI.  */
   make_cleanup_bfd_unref (nbfd);
-  objfile = symbol_file_add_from_bfd (nbfd, 0, sai, OBJF_SHARED, NULL);
+  objfile = symbol_file_add_from_bfd (nbfd, bfd_get_filename (nbfd), 0, sai,
+                                     OBJF_SHARED | OBJF_NOT_FILENAME, NULL);
 
   do_cleanups (old_cleanups);
   add_objfile_entry (objfile, entry_addr);
@@ -1013,8 +1015,8 @@ static int
 jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
                                struct jit_program_space_data *ps_data)
 {
-  struct minimal_symbol *reg_symbol, *desc_symbol;
-  struct objfile *objf;
+  struct bound_minimal_symbol reg_symbol;
+  struct minimal_symbol *desc_symbol;
   struct jit_objfile_data *objf_data;
   CORE_ADDR addr;
 
@@ -1022,19 +1024,21 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
     {
       /* Lookup the registration symbol.  If it is missing, then we
         assume we are not attached to a JIT.  */
-      reg_symbol = lookup_minimal_symbol_and_objfile (jit_break_name, &objf);
-      if (reg_symbol == NULL || SYMBOL_VALUE_ADDRESS (reg_symbol) == 0)
+      reg_symbol = lookup_minimal_symbol_and_objfile (jit_break_name);
+      if (reg_symbol.minsym == NULL
+         || SYMBOL_VALUE_ADDRESS (reg_symbol.minsym) == 0)
        return 1;
 
-      desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL, objf);
+      desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL,
+                                          reg_symbol.objfile);
       if (desc_symbol == NULL || SYMBOL_VALUE_ADDRESS (desc_symbol) == 0)
        return 1;
 
-      objf_data = get_jit_objfile_data (objf);
-      objf_data->register_code = reg_symbol;
+      objf_data = get_jit_objfile_data (reg_symbol.objfile);
+      objf_data->register_code = reg_symbol.minsym;
       objf_data->descriptor = desc_symbol;
 
-      ps_data->objfile = objf;
+      ps_data->objfile = reg_symbol.objfile;
     }
   else
     objf_data = get_jit_objfile_data (ps_data->objfile);
This page took 0.024425 seconds and 4 git commands to generate.