summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d61df89)
I'm currently studying that code and noticed this manual memory
management, which could easily be replaced with a vector, so here it is.
gdb/ChangeLog:
* jit.c (jit_reader_try_read_symtab): Replace xmalloc/xfree with
gdb::byte_vector.
+2019-12-12 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * jit.c (jit_reader_try_read_symtab): Replace xmalloc/xfree with
+ gdb::byte_vector.
+
2019-12-12 Tom Tromey <tromey@adacore.com>
* xml-support.c (xml_fetch_content_from_file): Don't call
2019-12-12 Tom Tromey <tromey@adacore.com>
* xml-support.c (xml_fetch_content_from_file): Don't call
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)
{
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;
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);
- 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;
}
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;
}
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");