GDB (xrefs)
Classes | Typedefs | Functions | Variables
/tmp/gdb-8.1/gdb/jit.c File Reference
#include "defs.h"
#include "jit.h"
#include "jit-reader.h"
#include "block.h"
#include "breakpoint.h"
#include "command.h"
#include "dictionary.h"
#include "filenames.h"
#include "frame-unwind.h"
#include "gdbcmd.h"
#include "gdbcore.h"
#include "inferior.h"
#include "observer.h"
#include "objfiles.h"
#include "regcache.h"
#include "symfile.h"
#include "symtab.h"
#include "target.h"
#include "gdb-dlfcn.h"
#include <sys/stat.h>
#include "gdb_bfd.h"
#include "readline/tilde.h"
#include "completer.h"

Go to the source code of this file.

Classes

struct  target_buffer
 
struct  jit_reader
 
struct  jit_program_space_data
 
struct  jit_objfile_data
 
struct  gdb_block
 
struct  gdb_symtab
 
struct  gdb_object
 
struct  jit_unwind_private
 
struct  jit_gdbarch_data_type
 

Typedefs

typedef struct gdb_reader_funcs *() reader_init_fn_type(void)
 
typedef CORE_ADDR jit_dbg_reader_data
 

Functions

static void jit_inferior_init (struct gdbarch *gdbarch)
 
static void jit_inferior_exit_hook (struct inferior *inf)
 
static void show_jit_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
static void * mem_bfd_iovec_open (struct bfd *abfd, void *open_closure)
 
static int mem_bfd_iovec_close (struct bfd *abfd, void *stream)
 
static file_ptr mem_bfd_iovec_pread (struct bfd *abfd, void *stream, void *buf, file_ptr nbytes, file_ptr offset)
 
static int mem_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb)
 
static gdb_bfd_ref_ptr bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size, char *target)
 
static struct jit_readerjit_reader_load (const char *file_name)
 
static void jit_reader_load_command (const char *args, int from_tty)
 
static void jit_reader_unload_command (const char *args, int from_tty)
 
static struct jit_objfile_dataget_jit_objfile_data (struct objfile *objf)
 
static void add_objfile_entry (struct objfile *objfile, CORE_ADDR entry)
 
static struct jit_program_space_dataget_jit_program_space_data (void)
 
static void jit_program_space_data_cleanup (struct program_space *ps, void *arg)
 
static int jit_read_descriptor (struct gdbarch *gdbarch, struct jit_descriptor *descriptor, struct jit_program_space_data *ps_data)
 
static void jit_read_code_entry (struct gdbarch *gdbarch, CORE_ADDR code_addr, struct jit_code_entry *code_entry)
 
static enum gdb_status jit_target_read_impl (GDB_CORE_ADDR target_mem, void *gdb_buf, int len)
 
static struct gdb_objectjit_object_open_impl (struct gdb_symbol_callbacks *cb)
 
static struct gdb_symtabjit_symtab_open_impl (struct gdb_symbol_callbacks *cb, struct gdb_object *object, const char *file_name)
 
static int compare_block (const struct gdb_block *const old, const struct gdb_block *const newobj)
 
static struct gdb_blockjit_block_open_impl (struct gdb_symbol_callbacks *cb, struct gdb_symtab *symtab, struct gdb_block *parent, GDB_CORE_ADDR begin, GDB_CORE_ADDR end, const char *name)
 
static void jit_symtab_line_mapping_add_impl (struct gdb_symbol_callbacks *cb, struct gdb_symtab *stab, int nlines, struct gdb_line_mapping *map)
 
static void jit_symtab_close_impl (struct gdb_symbol_callbacks *cb, struct gdb_symtab *stab)
 
static void finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
 
static void jit_object_close_impl (struct gdb_symbol_callbacks *cb, struct gdb_object *obj)
 
static int jit_reader_try_read_symtab (struct jit_code_entry *code_entry, CORE_ADDR entry_addr)
 
static void jit_bfd_try_read_symtab (struct jit_code_entry *code_entry, CORE_ADDR entry_addr, struct gdbarch *gdbarch)
 
static void jit_register_code (struct gdbarch *gdbarch, CORE_ADDR entry_addr, struct jit_code_entry *code_entry)
 
static void jit_unregister_code (struct objfile *objfile)
 
static struct objfilejit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
 
static void jit_breakpoint_deleted (struct breakpoint *b)
 
static int jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, struct jit_program_space_data *ps_data)
 
static void jit_unwind_reg_set_impl (struct gdb_unwind_callbacks *cb, int dwarf_regnum, struct gdb_reg_value *value)
 
static void reg_value_free_impl (struct gdb_reg_value *value)
 
static struct gdb_reg_valuejit_unwind_reg_get_impl (struct gdb_unwind_callbacks *cb, int regnum)
 
static void jit_dealloc_cache (struct frame_info *this_frame, void *cache)
 
static int jit_frame_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, void **cache)
 
static void jit_frame_this_id (struct frame_info *this_frame, void **cache, struct frame_id *this_id)
 
static struct valuejit_frame_prev_register (struct frame_info *this_frame, void **cache, int reg)
 
static void jit_prepend_unwinder (struct gdbarch *gdbarch)
 
static void jit_inferior_created (struct target_ops *ops, int from_tty)
 
void jit_inferior_created_hook (void)
 
void jit_breakpoint_re_set (void)
 
void jit_event_handler (struct gdbarch *gdbarch)
 
static void free_objfile_data (struct objfile *objfile, void *data)
 
static void * jit_gdbarch_data_init (struct obstack *obstack)
 
void _initialize_jit (void)
 

Variables

static const char * jit_reader_dir = NULL
 
static const struct objfile_data * jit_objfile_data
 
static const char *const jit_break_name = "__jit_debug_register_code"
 
static const char *const jit_descriptor_name = "__jit_debug_descriptor"
 
static const struct program_space_data * jit_program_space_data = NULL
 
static struct gdbarch_datajit_gdbarch_data
 
static unsigned int jit_debug = 0
 
static struct jit_readerloaded_jit_reader = NULL
 
static const char * reader_init_fn_sym = "gdb_init_reader"
 
static const struct frame_unwind jit_frame_unwind
 

Typedef Documentation

◆ jit_dbg_reader_data

Definition at line 491 of file jit.c.

◆ reader_init_fn_type

typedef struct gdb_reader_funcs*() reader_init_fn_type(void)

Definition at line 177 of file jit.c.

Function Documentation

◆ _initialize_jit()

void _initialize_jit ( void  )

◆ add_objfile_entry()

static void add_objfile_entry ( struct objfile objfile,
CORE_ADDR  entry 
)
static

Definition at line 307 of file jit.c.

References jit_objfile_data::addr, and get_jit_objfile_data().

Referenced by jit_bfd_try_read_symtab(), and jit_object_close_impl().

◆ bfd_open_from_target_memory()

static gdb_bfd_ref_ptr bfd_open_from_target_memory ( CORE_ADDR  addr,
ULONGEST  size,
char *  target 
)
static

◆ compare_block()

static int compare_block ( const struct gdb_block *const  old,
const struct gdb_block *const  newobj 
)
static

Definition at line 543 of file jit.c.

References gdb_block::begin, and gdb_block::end.

Referenced by jit_block_open_impl().

◆ finalize_symtab()

static void finalize_symtab ( struct gdb_symtab stab,
struct objfile objfile 
)
static

◆ free_objfile_data()

static void free_objfile_data ( struct objfile objfile,
void *  data 
)
static

◆ get_jit_objfile_data()

static struct jit_objfile_data* get_jit_objfile_data ( struct objfile objf)
static

Definition at line 289 of file jit.c.

References XCNEW.

Referenced by add_objfile_entry(), jit_breakpoint_re_set_internal(), and jit_read_descriptor().

◆ get_jit_program_space_data()

static struct jit_program_space_data* get_jit_program_space_data ( void  )
static

Definition at line 319 of file jit.c.

References current_program_space, and XCNEW.

Referenced by jit_breakpoint_re_set(), jit_event_handler(), and jit_inferior_init().

◆ jit_bfd_try_read_symtab()

static void jit_bfd_try_read_symtab ( struct jit_code_entry code_entry,
CORE_ADDR  entry_addr,
struct gdbarch gdbarch 
)
static

◆ jit_block_open_impl()

static struct gdb_block* jit_block_open_impl ( struct gdb_symbol_callbacks cb,
struct gdb_symtab symtab,
struct gdb_block parent,
GDB_CORE_ADDR  begin,
GDB_CORE_ADDR  end,
const char *  name 
)
static

◆ jit_breakpoint_deleted()

static void jit_breakpoint_deleted ( struct breakpoint b)
static

◆ jit_breakpoint_re_set()

void jit_breakpoint_re_set ( void  )

◆ jit_breakpoint_re_set_internal()

static int jit_breakpoint_re_set_internal ( struct gdbarch gdbarch,
struct jit_program_space_data ps_data 
)
static

◆ jit_dealloc_cache()

static void jit_dealloc_cache ( struct frame_info this_frame,
void *  cache 
)
static

Definition at line 1167 of file jit.c.

References gdb_assert, jit_unwind_private::regcache, and xfree().

Referenced by jit_frame_sniffer().

◆ jit_event_handler()

void jit_event_handler ( struct gdbarch gdbarch)

◆ jit_find_objf_with_entry_addr()

static struct objfile* jit_find_objf_with_entry_addr ( CORE_ADDR  entry_addr)
static

Definition at line 994 of file jit.c.

References jit_objfile_data::addr, and ALL_OBJFILES.

Referenced by jit_event_handler(), and jit_inferior_init().

◆ jit_frame_prev_register()

static struct value* jit_frame_prev_register ( struct frame_info this_frame,
void **  cache,
int  reg 
)
static

◆ jit_frame_sniffer()

static int jit_frame_sniffer ( const struct frame_unwind self,
struct frame_info this_frame,
void **  cache 
)
static

◆ jit_frame_this_id()

static void jit_frame_this_id ( struct frame_info this_frame,
void **  cache,
struct frame_id this_id 
)
static

◆ jit_gdbarch_data_init()

static void* jit_gdbarch_data_init ( struct obstack *  obstack)
static

Definition at line 1493 of file jit.c.

References jit_gdbarch_data_type::unwinder_registered.

Referenced by _initialize_jit().

◆ jit_inferior_created()

static void jit_inferior_created ( struct target_ops ops,
int  from_tty 
)
static

Definition at line 1382 of file jit.c.

References jit_inferior_created_hook().

Referenced by _initialize_jit().

◆ jit_inferior_created_hook()

void jit_inferior_created_hook ( void  )

Definition at line 1390 of file jit.c.

References jit_inferior_init(), and target_gdbarch().

Referenced by follow_exec(), jit_inferior_created(), and jit_reader_load_command().

◆ jit_inferior_exit_hook()

static void jit_inferior_exit_hook ( struct inferior inf)
static

◆ jit_inferior_init()

static void jit_inferior_init ( struct gdbarch gdbarch)
static

◆ jit_object_close_impl()

static void jit_object_close_impl ( struct gdb_symbol_callbacks cb,
struct gdb_object obj 
)
static

◆ jit_object_open_impl()

static struct gdb_object* jit_object_open_impl ( struct gdb_symbol_callbacks cb)
static

Definition at line 512 of file jit.c.

References XCNEW.

Referenced by jit_reader_try_read_symtab().

◆ jit_prepend_unwinder()

static void jit_prepend_unwinder ( struct gdbarch gdbarch)
static

◆ jit_program_space_data_cleanup()

static void jit_program_space_data_cleanup ( struct program_space ps,
void *  arg 
)
static

Definition at line 337 of file jit.c.

References xfree().

Referenced by _initialize_jit().

◆ jit_read_code_entry()

static void jit_read_code_entry ( struct gdbarch gdbarch,
CORE_ADDR  code_addr,
struct jit_code_entry code_entry 
)
static

◆ jit_read_descriptor()

static int jit_read_descriptor ( struct gdbarch gdbarch,
struct jit_descriptor descriptor,
struct jit_program_space_data ps_data 
)
static

◆ jit_reader_load()

static struct jit_reader* jit_reader_load ( const char *  file_name)
static

◆ jit_reader_load_command()

static void jit_reader_load_command ( const char *  args,
int  from_tty 
)
static

◆ jit_reader_try_read_symtab()

static int jit_reader_try_read_symtab ( struct jit_code_entry code_entry,
CORE_ADDR  entry_addr 
)
static

◆ jit_reader_unload_command()

static void jit_reader_unload_command ( const char *  args,
int  from_tty 
)
static

◆ jit_register_code()

static void jit_register_code ( struct gdbarch gdbarch,
CORE_ADDR  entry_addr,
struct jit_code_entry code_entry 
)
static

◆ jit_symtab_close_impl()

static void jit_symtab_close_impl ( struct gdb_symbol_callbacks cb,
struct gdb_symtab stab 
)
static

Definition at line 634 of file jit.c.

Referenced by jit_reader_try_read_symtab().

◆ jit_symtab_line_mapping_add_impl()

static void jit_symtab_line_mapping_add_impl ( struct gdb_symbol_callbacks cb,
struct gdb_symtab stab,
int  nlines,
struct gdb_line_mapping map 
)
static

◆ jit_symtab_open_impl()

static struct gdb_symtab* jit_symtab_open_impl ( struct gdb_symbol_callbacks cb,
struct gdb_object object,
const char *  file_name 
)
static

Definition at line 524 of file jit.c.

References gdb_symtab::file_name, gdb_symtab::next, and XCNEW.

Referenced by jit_reader_try_read_symtab().

◆ jit_target_read_impl()

static enum gdb_status jit_target_read_impl ( GDB_CORE_ADDR  target_mem,
void *  gdb_buf,
int  len 
)
static

Definition at line 497 of file jit.c.

References GDB_FAIL, GDB_SUCCESS, and target_read_memory().

Referenced by jit_frame_sniffer(), jit_frame_this_id(), and jit_reader_try_read_symtab().

◆ jit_unregister_code()

static void jit_unregister_code ( struct objfile objfile)
static

Definition at line 986 of file jit.c.

Referenced by jit_event_handler(), and jit_inferior_exit_hook().

◆ jit_unwind_reg_get_impl()

static struct gdb_reg_value* jit_unwind_reg_get_impl ( struct gdb_unwind_callbacks cb,
int  regnum 
)
static

◆ jit_unwind_reg_set_impl()

static void jit_unwind_reg_set_impl ( struct gdb_unwind_callbacks cb,
int  dwarf_regnum,
struct gdb_reg_value value 
)
static

◆ mem_bfd_iovec_close()

static int mem_bfd_iovec_close ( struct bfd *  abfd,
void *  stream 
)
static

Definition at line 92 of file jit.c.

References xfree().

Referenced by bfd_open_from_target_memory().

◆ mem_bfd_iovec_open()

static void* mem_bfd_iovec_open ( struct bfd *  abfd,
void *  open_closure 
)
static

Definition at line 84 of file jit.c.

Referenced by bfd_open_from_target_memory().

◆ mem_bfd_iovec_pread()

static file_ptr mem_bfd_iovec_pread ( struct bfd *  abfd,
void *  stream,
void *  buf,
file_ptr  nbytes,
file_ptr  offset 
)
static

Definition at line 104 of file jit.c.

References err, offset, and target_read_memory().

Referenced by bfd_open_from_target_memory().

◆ mem_bfd_iovec_stat()

static int mem_bfd_iovec_stat ( struct bfd *  abfd,
void *  stream,
struct stat *  sb 
)
static

Definition at line 128 of file jit.c.

References memset().

Referenced by bfd_open_from_target_memory().

◆ reg_value_free_impl()

static void reg_value_free_impl ( struct gdb_reg_value value)
static

Definition at line 1134 of file jit.c.

References xfree().

Referenced by jit_unwind_reg_get_impl().

◆ show_jit_debug()

static void show_jit_debug ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 69 of file jit.c.

References _, and fprintf_filtered().

Referenced by _initialize_jit().

Variable Documentation

◆ jit_break_name

const char* const jit_break_name = "__jit_debug_register_code"
static

Definition at line 49 of file jit.c.

Referenced by jit_breakpoint_re_set_internal().

◆ jit_debug

unsigned int jit_debug = 0
static

◆ jit_descriptor_name

const char* const jit_descriptor_name = "__jit_debug_descriptor"
static

Definition at line 51 of file jit.c.

Referenced by jit_breakpoint_re_set_internal().

◆ jit_frame_unwind

const struct frame_unwind jit_frame_unwind
static
Initial value:
=
{
NULL,
}
static void jit_dealloc_cache(struct frame_info *this_frame, void *cache)
Definition: jit.c:1167
static int jit_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **cache)
Definition: jit.c:1185
static void jit_frame_this_id(struct frame_info *this_frame, void **cache, struct frame_id *this_id)
Definition: jit.c:1236
static struct value * jit_frame_prev_register(struct frame_info *this_frame, void **cache, int reg)
Definition: jit.c:1265
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
Definition: frame-unwind.c:184

Definition at line 1292 of file jit.c.

Referenced by jit_prepend_unwinder().

◆ jit_gdbarch_data

struct gdbarch_data* jit_gdbarch_data
static

Definition at line 62 of file jit.c.

Referenced by _initialize_jit(), and jit_prepend_unwinder().

◆ jit_objfile_data

const struct objfile_data* jit_objfile_data
static

Definition at line 47 of file jit.c.

◆ jit_program_space_data

const struct program_space_data* jit_program_space_data = NULL
static

Definition at line 53 of file jit.c.

◆ jit_reader_dir

const char* jit_reader_dir = NULL
static

Definition at line 45 of file jit.c.

Referenced by _initialize_jit(), and jit_reader_load_command().

◆ loaded_jit_reader

struct jit_reader* loaded_jit_reader = NULL
static

◆ reader_init_fn_sym

const char* reader_init_fn_sym = "gdb_init_reader"
static

Definition at line 178 of file jit.c.

Referenced by jit_reader_load().