projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace xmalloc/xfree with vector in jit.c
[deliverable/binutils-gdb.git]
/
gdb
/
jit.c
diff --git
a/gdb/jit.c
b/gdb/jit.c
index 5fef03700c1fbe689c98091e1f4e16d2035e9bab..b6e51e4f8b4dc45aababed6d5ed5b7c20edddb3c 100644
(file)
--- a/
gdb/jit.c
+++ b/
gdb/jit.c
@@
-42,7
+42,7
@@
#include "readline/tilde.h"
#include "completer.h"
#include "readline/tilde.h"
#include "completer.h"
-static
const char *jit_reader_dir = NULL
;
+static
std::string jit_reader_dir
;
static const struct objfile_data *jit_objfile_data;
static const struct objfile_data *jit_objfile_data;
@@
-76,7
+76,7
@@
struct target_buffer
ULONGEST size;
};
ULONGEST size;
};
-/* Open
n
ing the file is a no-op. */
+/* Opening the file is a no-op. */
static void *
mem_bfd_iovec_open (struct bfd *abfd, void *open_closure)
static void *
mem_bfd_iovec_open (struct bfd *abfd, void *open_closure)
@@
-216,7
+216,7
@@
jit_reader_load_command (const char *args, int from_tty)
error (_("JIT reader already loaded. Run jit-reader-unload first."));
if (!IS_ABSOLUTE_PATH (file.get ()))
error (_("JIT reader already loaded. Run jit-reader-unload first."));
if (!IS_ABSOLUTE_PATH (file.get ()))
- file.reset (xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING,
+ file.reset (xstrprintf ("%s%s%s", jit_reader_dir
.c_str ()
, SLASH_STRING,
file.get ()));
loaded_jit_reader = jit_reader_load (file.get ());
file.get ()));
loaded_jit_reader = jit_reader_load (file.get ());
@@
-700,8
+700,8
@@
finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
SYMBOL_BLOCK_VALUE (block_name) = new_block;
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
SYMBOL_BLOCK_VALUE (block_name) = new_block;
- block_name->
ginfo.
name = obstack_strdup (&objfile->objfile_obstack,
-
gdb_block_iter->name);
+ block_name->name = obstack_strdup (&objfile->objfile_obstack,
+ gdb_block_iter->name);
BLOCK_FUNCTION (new_block) = block_name;
BLOCK_FUNCTION (new_block) = block_name;
@@
-808,7
+808,6
@@
static int
jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
CORE_ADDR entry_addr)
{
jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
CORE_ADDR entry_addr)
{
- gdb_byte *gdb_mem;
int status;
jit_dbg_reader_data priv_data;
struct gdb_reader_funcs *funcs;
int status;
jit_dbg_reader_data priv_data;
struct gdb_reader_funcs *funcs;
@@
-831,12
+830,12
@@
jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
if (!loaded_jit_reader)
return 0;
if (!loaded_jit_reader)
return 0;
- gdb
_mem = (gdb_byte *) xmalloc
(code_entry->symfile_size);
+ gdb
::byte_vector gdb_mem
(code_entry->symfile_size);
status = 1;
try
{
status = 1;
try
{
- if (target_read_memory (code_entry->symfile_addr, gdb_mem,
+ if (target_read_memory (code_entry->symfile_addr, gdb_mem
.data ()
,
code_entry->symfile_size))
status = 0;
}
code_entry->symfile_size))
status = 0;
}
@@
-848,12
+847,12
@@
jit_reader_try_read_symtab (struct jit_code_entry *code_entry,
if (status)
{
funcs = loaded_jit_reader->functions;
if (status)
{
funcs = loaded_jit_reader->functions;
- if (funcs->read (funcs, &callbacks, gdb_mem, code_entry->symfile_size)
+ if (funcs->read (funcs, &callbacks, gdb_mem.data (),
+ code_entry->symfile_size)
!= GDB_SUCCESS)
status = 0;
}
!= GDB_SUCCESS)
status = 0;
}
- xfree (gdb_mem);
if (jit_debug && status == 0)
fprintf_unfiltered (gdb_stdlog,
"Could not read symtab using the loaded JIT reader.\n");
if (jit_debug && status == 0)
fprintf_unfiltered (gdb_stdlog,
"Could not read symtab using the loaded JIT reader.\n");
@@
-874,7
+873,7
@@
jit_bfd_try_read_symtab (struct jit_code_entry *code_entry,
if (jit_debug)
fprintf_unfiltered (gdb_stdlog,
if (jit_debug)
fprintf_unfiltered (gdb_stdlog,
- "jit_
register_code
, symfile_addr = %s, "
+ "jit_
bfd_try_read_symtab
, symfile_addr = %s, "
"symfile_size = %s\n",
paddress (gdbarch, code_entry->symfile_addr),
pulongest (code_entry->symfile_size));
"symfile_size = %s\n",
paddress (gdbarch, code_entry->symfile_addr),
pulongest (code_entry->symfile_size));
@@
-910,12
+909,12
@@
JITed symbol file is not an object file, ignoring it.\n"));
addresses that we care about. */
section_addr_info sai;
for (sec = nbfd->sections; sec != NULL; sec = sec->next)
addresses that we care about. */
section_addr_info sai;
for (sec = nbfd->sections; sec != NULL; sec = sec->next)
- if ((bfd_
get_section_flags (nbfd.get (),
sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
+ if ((bfd_
section_flags (
sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
{
/* We assume that these virtual addresses are absolute, and do not
treat them as offsets. */
{
/* We assume that these virtual addresses are absolute, and do not
treat them as offsets. */
- sai.emplace_back (bfd_
get_section_vma (nbfd.get (),
sec),
- bfd_
get_section_name (nbfd.get (),
sec),
+ sai.emplace_back (bfd_
section_vma (
sec),
+ bfd_
section_name (
sec),
sec->index);
}
sec->index);
}
@@
-958,6
+957,9
@@
jit_register_code (struct gdbarch *gdbarch,
static void
jit_unregister_code (struct objfile *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;
}
delete objfile;
}
This page took
0.026661 seconds
and
4
git commands to generate.