libiberty/md5: fix strict alias warnings
[deliverable/binutils-gdb.git] / gdb / jit.c
index a76cca1f1dfa44113cf910764ea68d3bffd63ecd..cdd9f49e071a9e1cb37e0fb3fe198247efd5928b 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -38,6 +38,7 @@
 #include "gdb-dlfcn.h"
 #include "gdb_stat.h"
 #include "exceptions.h"
+#include "gdb_bfd.h"
 
 static const char *jit_reader_dir = NULL;
 
@@ -132,17 +133,16 @@ mem_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb)
 static struct bfd *
 bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size, char *target)
 {
-  const char *filename = xstrdup ("<in-memory>");
   struct target_buffer *buffer = xmalloc (sizeof (struct target_buffer));
 
   buffer->base = addr;
   buffer->size = size;
-  return bfd_openr_iovec (filename, target,
-                          mem_bfd_iovec_open,
-                          buffer,
-                          mem_bfd_iovec_pread,
-                          mem_bfd_iovec_close,
-                          mem_bfd_iovec_stat);
+  return gdb_bfd_openr_iovec ("<in-memory>", target,
+                             mem_bfd_iovec_open,
+                             buffer,
+                             mem_bfd_iovec_pread,
+                             mem_bfd_iovec_close,
+                             mem_bfd_iovec_stat);
 }
 
 /* One reader that has been loaded successfully, and can potentially be used to
@@ -200,7 +200,6 @@ static void
 jit_reader_load_command (char *args, int from_tty)
 {
   char *so_name;
-  int len;
   struct cleanup *prev_cleanup;
 
   if (args == NULL)
@@ -280,7 +279,6 @@ get_jit_objfile_data (struct objfile *objf)
 static void
 add_objfile_entry (struct objfile *objfile, CORE_ADDR entry)
 {
-  CORE_ADDR *entry_addr_ptr;
   struct jit_objfile_data *objf_data;
 
   objf_data = get_jit_objfile_data (objfile);
@@ -662,6 +660,10 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
       struct block *new_block = allocate_block (&objfile->objfile_obstack);
       struct symbol *block_name = obstack_alloc (&objfile->objfile_obstack,
                                                  sizeof (struct symbol));
+      struct type *block_type = arch_type (get_objfile_arch (objfile),
+                                          TYPE_CODE_VOID,
+                                          1,
+                                          "void");
 
       BLOCK_DICT (new_block) = dict_create_linear (&objfile->objfile_obstack,
                                                    NULL);
@@ -674,6 +676,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
       SYMBOL_DOMAIN (block_name) = VAR_DOMAIN;
       SYMBOL_CLASS (block_name) = LOC_BLOCK;
       SYMBOL_SYMTAB (block_name) = symtab;
+      SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
       SYMBOL_BLOCK_VALUE (block_name) = new_block;
 
       block_name->ginfo.name = obsavestring (gdb_block_iter->name,
@@ -781,7 +784,6 @@ jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
 {
   void *gdb_mem;
   int status;
-  struct jit_dbg_reader *i;
   jit_dbg_reader_data priv_data;
   struct gdb_reader_funcs *funcs;
   volatile struct gdb_exception e;
@@ -866,7 +868,7 @@ jit_bfd_try_read_symtab (struct jit_code_entry *code_entry,
     {
       printf_unfiltered (_("\
 JITed symbol file is not an object file, ignoring it.\n"));
-      bfd_close (nbfd);
+      gdb_bfd_unref (nbfd);
       return;
     }
 
@@ -894,7 +896,8 @@ JITed symbol file is not an object file, ignoring it.\n"));
         ++i;
       }
 
-  /* This call takes ownership of NBFD.  It does not take ownership of SAI.  */
+  /* 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);
 
   do_cleanups (old_cleanups);
@@ -942,7 +945,6 @@ static struct objfile *
 jit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
 {
   struct objfile *objf;
-  CORE_ADDR *objf_entry_addr;
 
   ALL_OBJFILES (objf)
     {
@@ -1102,7 +1104,6 @@ jit_frame_sniffer (const struct frame_unwind *self,
 {
   struct jit_inferior_data *inf_data;
   struct jit_unwind_private *priv_data;
-  struct jit_dbg_reader *iter;
   struct gdb_unwind_callbacks callbacks;
   struct gdb_reader_funcs *funcs;
 
@@ -1244,7 +1245,6 @@ jit_inferior_init (struct gdbarch *gdbarch)
   struct jit_code_entry cur_entry;
   struct jit_inferior_data *inf_data;
   CORE_ADDR cur_entry_addr;
-  struct jit_objfile_data *objf_data;
 
   if (jit_debug)
     fprintf_unfiltered (gdb_stdlog, "jit_inferior_init\n");
This page took 0.025029 seconds and 4 git commands to generate.