GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
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 "observable.h"
#include "objfiles.h"
#include "regcache.h"
#include "symfile.h"
#include "symtab.h"
#include "target.h"
#include "gdbsupport/gdb-dlfcn.h"
#include <sys/stat.h>
#include "gdb_bfd.h"
#include "readline/tilde.h"
#include "completer.h"
#include <forward_list>

Go to the source code of this file.

Classes

struct  jit_reader
 
struct  gdb_block
 
struct  gdb_symtab
 
struct  gdb_object
 
struct  jit_dbg_reader_data
 
struct  jit_unwind_private
 
struct  jit_gdbarch_data_type
 

Macros

#define jit_debug_printf(fmt, ...)    debug_prefixed_printf_cond (jit_debug, "jit", fmt, ##__VA_ARGS__)
 

Typedefs

typedef struct gdb_reader_funcsreader_init_fn_type(void)
 

Functions

static void jit_inferior_created_hook (inferior *inf)
 
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 maint_info_jit_cmd (const char *args, int from_tty)
 
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 jiter_objfile_dataget_jiter_objfile_data (objfile *objf)
 
static void add_objfile_entry (struct objfile *objfile, CORE_ADDR entry, CORE_ADDR symfile_addr, ULONGEST symfile_size)
 
static bool jit_read_descriptor (gdbarch *gdbarch, jit_descriptor *descriptor, objfile *jiter)
 
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 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 (gdbarch *gdbarch, 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 struct objfilejit_find_objf_with_entry_addr (CORE_ADDR entry_addr)
 
static void jit_breakpoint_deleted (struct breakpoint *b)
 
static void jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
 
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 (frame_info *this_frame, void *cache)
 
static int jit_frame_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame, void **cache)
 
static void jit_frame_this_id (frame_info_ptr this_frame, void **cache, struct frame_id *this_id)
 
static struct valuejit_frame_prev_register (frame_info_ptr this_frame, void **cache, int reg)
 
static void jit_prepend_unwinder (struct gdbarch *gdbarch)
 
static void jit_inferior_init (inferior *inf)
 
static void jit_inferior_execd_hook (inferior *exec_inf, inferior *follow_inf)
 
void jit_breakpoint_re_set (void)
 
void jit_event_handler (gdbarch *gdbarch, objfile *jiter)
 
void _initialize_jit ()
 

Variables

static std::string jit_reader_dir
 
static const char jit_break_name [] = "__jit_debug_register_code"
 
static const char jit_descriptor_name [] = "__jit_debug_descriptor"
 
static bool jit_debug = false
 
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
 
static const registry< gdbarch >::key< jit_gdbarch_data_typejit_gdbarch_data
 

Macro Definition Documentation

◆ jit_debug_printf

#define jit_debug_printf ( fmt,
... )    debug_prefixed_printf_cond (jit_debug, "jit", fmt, ##__VA_ARGS__)

Typedef Documentation

◆ reader_init_fn_type

typedef struct gdb_reader_funcs * reader_init_fn_type(void)

Definition at line 142 of file jit.c.

Function Documentation

◆ _initialize_jit()

void _initialize_jit ( )

Definition at line 1299 of file jit.c.

Referenced by initialize_all_files().

◆ add_objfile_entry()

static void add_objfile_entry ( struct objfile * objfile,
CORE_ADDR entry,
CORE_ADDR symfile_addr,
ULONGEST symfile_size )
static

Definition at line 234 of file jit.c.

References objfile::jited_data.

Referenced by jit_bfd_try_read_symtab(), and jit_object_close_impl().

◆ finalize_symtab()

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

◆ get_jiter_objfile_data()

static jiter_objfile_data * get_jiter_objfile_data ( objfile * objf)
static

Definition at line 222 of file jit.c.

References objfile::jiter_data.

Referenced by jit_breakpoint_re_set_internal().

◆ 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

Definition at line 462 of file jit.c.

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

Referenced by jit_reader_try_read_symtab().

◆ jit_breakpoint_deleted()

static void jit_breakpoint_deleted ( struct breakpoint * b)
static

◆ jit_breakpoint_re_set()

void jit_breakpoint_re_set ( void )

Definition at line 1230 of file jit.c.

References current_program_space, jit_breakpoint_re_set_internal(), and target_gdbarch().

Referenced by breakpoint_re_set().

◆ jit_breakpoint_re_set_internal()

static void jit_breakpoint_re_set_internal ( struct gdbarch * gdbarch,
program_space * pspace )
static

◆ jit_dealloc_cache()

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

Definition at line 995 of file jit.c.

Referenced by jit_frame_sniffer().

◆ jit_event_handler()

void jit_event_handler ( gdbarch * gdbarch,
objfile * jiter )

◆ jit_find_objf_with_entry_addr()

static struct objfile * jit_find_objf_with_entry_addr ( CORE_ADDR entry_addr)
static

Definition at line 829 of file jit.c.

References current_program_space, and program_space::objfiles().

Referenced by jit_event_handler(), and jit_inferior_init().

◆ jit_frame_prev_register()

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

◆ jit_frame_sniffer()

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

◆ jit_frame_this_id()

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

◆ jit_inferior_created_hook()

static void jit_inferior_created_hook ( inferior * inf)
static

Definition at line 1213 of file jit.c.

References jit_inferior_init().

Referenced by jit_reader_load_command().

◆ jit_inferior_execd_hook()

static void jit_inferior_execd_hook ( inferior * exec_inf,
inferior * follow_inf )
static

Definition at line 1221 of file jit.c.

References jit_inferior_init().

◆ jit_inferior_exit_hook()

static void jit_inferior_exit_hook ( struct inferior * inf)
static

Definition at line 1240 of file jit.c.

References current_program_space, and program_space::objfiles_safe().

Referenced by jit_reader_unload_command().

◆ jit_inferior_init()

static void jit_inferior_init ( inferior * inf)
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 435 of file jit.c.

Referenced by jit_reader_try_read_symtab().

◆ jit_prepend_unwinder()

static void jit_prepend_unwinder ( struct gdbarch * gdbarch)
static

◆ 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 bool jit_read_descriptor ( gdbarch * gdbarch,
jit_descriptor * descriptor,
objfile * jiter )
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 ( gdbarch * gdbarch,
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 505 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

Definition at line 478 of file jit.c.

References gdb_line_mapping::line, gdb_symtab::linetable, and linetable_entry::pc().

Referenced by jit_reader_try_read_symtab().

◆ 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 447 of file jit.c.

References gdb_symtab::file_name.

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 420 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_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

◆ maint_info_jit_cmd()

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

Definition at line 74 of file jit.c.

References current_inferior(), current_uiout, gdbarch_ptr_bit(), and ui_left.

◆ reg_value_free_impl()

static void reg_value_free_impl ( struct gdb_reg_value * value)
static

Definition at line 962 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 65 of file jit.c.

References gdb_printf().

Variable Documentation

◆ jit_break_name

const char jit_break_name[] = "__jit_debug_register_code"
static

Definition at line 48 of file jit.c.

Referenced by jit_breakpoint_re_set_internal().

◆ jit_debug

bool jit_debug = false
static

Definition at line 57 of file jit.c.

◆ jit_descriptor_name

const char jit_descriptor_name[] = "__jit_debug_descriptor"
static

Definition at line 50 of file jit.c.

Referenced by jit_breakpoint_re_set_internal().

◆ jit_frame_unwind

const struct frame_unwind jit_frame_unwind
static
Initial value:
=
{
"jit",
NULL,
}
enum unwind_stop_reason default_frame_unwind_stop_reason(frame_info_ptr this_frame, void **this_cache)
@ NORMAL_FRAME
Definition frame.h:187
static int jit_frame_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **cache)
Definition jit.c:1010
static void jit_frame_this_id(frame_info_ptr this_frame, void **cache, struct frame_id *this_id)
Definition jit.c:1057
static struct value * jit_frame_prev_register(frame_info_ptr this_frame, void **cache, int reg)
Definition jit.c:1086
static void jit_dealloc_cache(frame_info *this_frame, void *cache)
Definition jit.c:995

Definition at line 1107 of file jit.c.

Referenced by jit_prepend_unwinder().

◆ jit_gdbarch_data

const registry<gdbarch>::key<jit_gdbarch_data_type> jit_gdbarch_data
static

Definition at line 1133 of file jit.c.

Referenced by jit_prepend_unwinder().

◆ jit_reader_dir

std::string jit_reader_dir
static

Definition at line 46 of file jit.c.

Referenced by 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 145 of file jit.c.

Referenced by jit_reader_load().