GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
frame.c File Reference
#include "defs.h"
#include "dwarf2/expr.h"
#include "dwarf2.h"
#include "dwarf2/leb.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
#include "gdbcore.h"
#include "gdbtypes.h"
#include "symtab.h"
#include "objfiles.h"
#include "regcache.h"
#include "value.h"
#include "record.h"
#include "complaints.h"
#include "dwarf2/read.h"
#include "dwarf2/public.h"
#include "ax.h"
#include "dwarf2/loc.h"
#include "dwarf2/frame-tailcall.h"
#include "gdbsupport/gdb_binary_search.h"
#include <unordered_map>
#include <algorithm>

Go to the source code of this file.

Classes

struct  dwarf2_cie
 
struct  dwarf2_fde
 
struct  comp_unit
 
struct  dwarf2_frame_ops
 
struct  dwarf2_frame_fn_data
 
struct  dwarf2_frame_cache
 

Macros

#define cfa_exp_len   cfa_reg
 
#define DW64_CIE_ID   0xffffffffffffffffULL
 

Typedefs

typedef std::unordered_map< ULONGEST, dwarf2_cie * > dwarf2_cie_table
 
typedef std::vector< dwarf2_fde * > dwarf2_fde_table
 

Enumerations

enum  eh_frame_type { EH_CIE_TYPE_ID = 1 << 0 , EH_FDE_TYPE_ID = 1 << 1 , EH_CIE_OR_FDE_TYPE_ID = EH_CIE_TYPE_ID | EH_FDE_TYPE_ID }
 

Functions

static struct dwarf2_fdedwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile)
 
static int dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum, int eh_frame_p)
 
static ULONGEST read_encoded_value (struct comp_unit *unit, gdb_byte encoding, int ptr_len, const gdb_byte *buf, unsigned int *bytes_read_ptr, unrelocated_addr func_base)
 
static void dwarf2_restore_rule (struct gdbarch *gdbarch, ULONGEST reg_num, struct dwarf2_frame_state *fs, int eh_frame_p)
 
static CORE_ADDR execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size, frame_info_ptr this_frame, CORE_ADDR initial, int initial_in_stack_memory, dwarf2_per_objfile *per_objfile)
 
static const gdb_byte * execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr, const gdb_byte *insn_end, struct gdbarch *gdbarch, CORE_ADDR pc, struct dwarf2_frame_state *fs, CORE_ADDR text_offset)
 
static void dwarf2_frame_default_init_reg (struct gdbarch *gdbarch, int regnum, struct dwarf2_frame_state_reg *reg, frame_info_ptr this_frame)
 
static dwarf2_frame_opsget_frame_ops (struct gdbarch *gdbarch)
 
void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, void(*init_reg)(struct gdbarch *, int, struct dwarf2_frame_state_reg *, frame_info_ptr))
 
static void dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, struct dwarf2_frame_state_reg *reg, frame_info_ptr this_frame)
 
void dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch, int(*signal_frame_p)(struct gdbarch *, frame_info_ptr))
 
static int dwarf2_frame_signal_frame_p (struct gdbarch *gdbarch, frame_info_ptr this_frame)
 
void dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch, int(*adjust_regnum)(struct gdbarch *, int, int))
 
static void dwarf2_frame_find_quirks (struct dwarf2_frame_state *fs, struct dwarf2_fde *fde)
 
int dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc, struct dwarf2_per_cu_data *data, int *regnum_out, LONGEST *offset_out, CORE_ADDR *text_offset_out, const gdb_byte **cfa_start_out, const gdb_byte **cfa_end_out)
 
static struct dwarf2_frame_cache * dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache)
 
static enum unwind_stop_reason dwarf2_frame_unwind_stop_reason (frame_info_ptr this_frame, void **this_cache)
 
static void dwarf2_frame_this_id (frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
 
static struct valuedwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache, int regnum)
 
void * dwarf2_frame_get_fn_data (frame_info_ptr this_frame, void **this_cache, fn_prev_register cookie)
 
void * dwarf2_frame_allocate_fn_data (frame_info_ptr this_frame, void **this_cache, fn_prev_register cookie, unsigned long size)
 
static void dwarf2_frame_dealloc_cache (frame_info *self, void *this_cache)
 
static int dwarf2_frame_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame, void **this_cache)
 
void dwarf2_append_unwinders (struct gdbarch *gdbarch)
 
static CORE_ADDR dwarf2_frame_base_address (frame_info_ptr this_frame, void **this_cache)
 
const struct frame_basedwarf2_frame_base_sniffer (frame_info_ptr this_frame)
 
CORE_ADDR dwarf2_frame_cfa (frame_info_ptr this_frame)
 
static gdb_byte encoding_for_size (unsigned int size)
 
static struct dwarf2_ciefind_cie (const dwarf2_cie_table &cie_table, ULONGEST cie_pointer)
 
static int bsearch_fde_cmp (const dwarf2_fde *fde, unrelocated_addr seek_pc)
 
static comp_unitfind_comp_unit (struct objfile *objfile)
 
static void set_comp_unit (struct objfile *objfile, struct comp_unit *unit)
 
static void add_fde (dwarf2_fde_table *fde_table, struct dwarf2_fde *fde)
 
static const gdb_byte * decode_frame_entry (struct gdbarch *gdbarch, struct comp_unit *unit, const gdb_byte *start, int eh_frame_p, dwarf2_cie_table &cie_table, dwarf2_fde_table *fde_table, enum eh_frame_type entry_type)
 
static const gdb_byte * decode_frame_entry_1 (struct gdbarch *gdbarch, struct comp_unit *unit, const gdb_byte *start, int eh_frame_p, dwarf2_cie_table &cie_table, dwarf2_fde_table *fde_table, enum eh_frame_type entry_type)
 
static bool fde_is_less_than (const dwarf2_fde *aa, const dwarf2_fde *bb)
 
void dwarf2_build_frame_info (struct objfile *objfile)
 
static void show_dwarf_unwinders_enabled_p (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
void _initialize_dwarf2_frame ()
 

Variables

bool dwarf2_frame_unwinders_enabled_p = true
 
static const registry< gdbarch >::key< dwarf2_frame_opsdwarf2_frame_data
 
static const struct frame_unwind dwarf2_frame_unwind
 
static const struct frame_unwind dwarf2_signal_frame_unwind
 
static const struct frame_base dwarf2_frame_base
 
static const registry< bfd >::key< comp_unitdwarf2_frame_bfd_data
 
static const registry< objfile >::key< comp_unitdwarf2_frame_objfile_data
 

Macro Definition Documentation

◆ cfa_exp_len

#define cfa_exp_len   cfa_reg

Definition at line 194 of file frame.c.

◆ DW64_CIE_ID

#define DW64_CIE_ID   0xffffffffffffffffULL

Definition at line 1678 of file frame.c.

Referenced by decode_frame_entry_1().

Typedef Documentation

◆ dwarf2_cie_table

typedef std::unordered_map<ULONGEST, dwarf2_cie *> dwarf2_cie_table

Definition at line 109 of file frame.c.

◆ dwarf2_fde_table

typedef std::vector<dwarf2_fde *> dwarf2_fde_table

Definition at line 140 of file frame.c.

Enumeration Type Documentation

◆ eh_frame_type

Enumerator
EH_CIE_TYPE_ID 
EH_FDE_TYPE_ID 
EH_CIE_OR_FDE_TYPE_ID 

Definition at line 1683 of file frame.c.

Function Documentation

◆ _initialize_dwarf2_frame()

void _initialize_dwarf2_frame ( )

Definition at line 2268 of file frame.c.

Referenced by initialize_all_files().

◆ add_fde()

static void add_fde ( dwarf2_fde_table * fde_table,
struct dwarf2_fde * fde )
static

Definition at line 1669 of file frame.c.

References dwarf2_fde::address_range.

Referenced by decode_frame_entry_1().

◆ bsearch_fde_cmp()

static int bsearch_fde_cmp ( const dwarf2_fde * fde,
unrelocated_addr seek_pc )
inlinestatic

Definition at line 1586 of file frame.c.

References dwarf2_fde::end_addr(), and dwarf2_fde::initial_location.

Referenced by dwarf2_frame_find_fde().

◆ decode_frame_entry()

static const gdb_byte * decode_frame_entry ( struct gdbarch * gdbarch,
struct comp_unit * unit,
const gdb_byte * start,
int eh_frame_p,
dwarf2_cie_table & cie_table,
dwarf2_fde_table * fde_table,
enum eh_frame_type entry_type )
static

◆ decode_frame_entry_1()

static const gdb_byte * decode_frame_entry_1 ( struct gdbarch * gdbarch,
struct comp_unit * unit,
const gdb_byte * start,
int eh_frame_p,
dwarf2_cie_table & cie_table,
dwarf2_fde_table * fde_table,
enum eh_frame_type entry_type )
static

◆ dwarf2_append_unwinders()

void dwarf2_append_unwinders ( struct gdbarch * gdbarch)

◆ dwarf2_build_frame_info()

void dwarf2_build_frame_info ( struct objfile * objfile)

◆ dwarf2_fetch_cfa_info()

int dwarf2_fetch_cfa_info ( struct gdbarch * gdbarch,
CORE_ADDR pc,
struct dwarf2_per_cu_data * data,
int * regnum_out,
LONGEST * offset_out,
CORE_ADDR * text_offset_out,
const gdb_byte ** cfa_start_out,
const gdb_byte ** cfa_end_out )

◆ dwarf2_frame_adjust_regnum()

static int dwarf2_frame_adjust_regnum ( struct gdbarch * gdbarch,
int regnum,
int eh_frame_p )
static

◆ dwarf2_frame_allocate_fn_data()

void * dwarf2_frame_allocate_fn_data ( frame_info_ptr this_frame,
void ** this_cache,
fn_prev_register cookie,
unsigned long size )

◆ dwarf2_frame_base_address()

static CORE_ADDR dwarf2_frame_base_address ( frame_info_ptr this_frame,
void ** this_cache )
static

Definition at line 1383 of file frame.c.

References dwarf2_frame_cache::cfa, and dwarf2_frame_cache().

◆ dwarf2_frame_base_sniffer()

const struct frame_base * dwarf2_frame_base_sniffer ( frame_info_ptr this_frame)

◆ dwarf2_frame_cache()

static struct dwarf2_frame_cache * dwarf2_frame_cache ( frame_info_ptr this_frame,
void ** this_cache )
static

Definition at line 893 of file frame.c.

References dwarf2_cie::addr_size, dwarf2_frame_cache::addr_size, dwarf2_frame_state::armcc_cfa_offsets_reversed, dwarf2_frame_cache::cfa, CFA_EXP, CFA_REG_OFFSET, dwarf2_fde::cie, complaint, dwarf2_frame_find_fde(), dwarf2_frame_find_quirks(), dwarf2_frame_init_reg(), DWARF2_FRAME_REG_RA, DWARF2_FRAME_REG_RA_OFFSET, DWARF2_FRAME_REG_SAME_VALUE, DWARF2_FRAME_REG_SAVED_REG, DWARF2_FRAME_REG_UNDEFINED, DWARF2_FRAME_REG_UNSPECIFIED, dwarf2_tailcall_sniffer_first(), dwarf_reg_to_regnum(), dwarf2_cie::end, dwarf2_fde::end, dwarf2_fde::end_addr(), execute_cfa_program(), execute_stack_op(), FRAME_OBSTACK_CALLOC, FRAME_OBSTACK_ZALLOC, gdbarch_num_cooked_regs(), gdbarch_register_name(), gdbarch_sp_regnum(), get_frame_address_in_block(), get_frame_arch(), get_frame_func_if_available(), dwarf2_frame_state_reg::how, dwarf2_cie::initial_instructions, dwarf2_fde::initial_location, dwarf2_fde::instructions, dwarf2_frame_state_reg::loc, dwarf2_per_objfile::objfile, paddress(), dwarf2_frame_state::pc, dwarf2_frame_cache::per_objfile, read_addr_from_reg(), dwarf2_frame_cache::reg, dwarf2_frame_state_reg::reg, regnum, dwarf2_frame_state::retaddr_column, dwarf2_frame_cache::retaddr_reg, dwarf2_frame_cache::tailcall_cache, objfile::text_section_offset(), dwarf2_frame_cache::unavailable_retaddr, and dwarf2_frame_cache::undefined_retaddr.

Referenced by dwarf2_frame_allocate_fn_data(), dwarf2_frame_base_address(), dwarf2_frame_dealloc_cache(), dwarf2_frame_get_fn_data(), dwarf2_frame_prev_register(), dwarf2_frame_this_id(), and dwarf2_frame_unwind_stop_reason().

◆ dwarf2_frame_cfa()

CORE_ADDR dwarf2_frame_cfa ( frame_info_ptr this_frame)

◆ dwarf2_frame_dealloc_cache()

static void dwarf2_frame_dealloc_cache ( frame_info * self,
void * this_cache )
static

◆ dwarf2_frame_default_init_reg()

static void dwarf2_frame_default_init_reg ( struct gdbarch * gdbarch,
int regnum,
struct dwarf2_frame_state_reg * reg,
frame_info_ptr this_frame )
static

◆ dwarf2_frame_find_fde()

static struct dwarf2_fde * dwarf2_frame_find_fde ( CORE_ADDR * pc,
dwarf2_per_objfile ** out_per_objfile )
static

◆ dwarf2_frame_find_quirks()

static void dwarf2_frame_find_quirks ( struct dwarf2_frame_state * fs,
struct dwarf2_fde * fde )
static

◆ dwarf2_frame_get_fn_data()

void * dwarf2_frame_get_fn_data ( frame_info_ptr this_frame,
void ** this_cache,
fn_prev_register cookie )

◆ dwarf2_frame_init_reg()

static void dwarf2_frame_init_reg ( struct gdbarch * gdbarch,
int regnum,
struct dwarf2_frame_state_reg * reg,
frame_info_ptr this_frame )
static

Definition at line 679 of file frame.c.

References get_frame_ops(), dwarf2_frame_ops::init_reg, and regnum.

Referenced by dwarf2_frame_cache().

◆ dwarf2_frame_prev_register()

static struct value * dwarf2_frame_prev_register ( frame_info_ptr this_frame,
void ** this_cache,
int regnum )
static

◆ dwarf2_frame_set_adjust_regnum()

void dwarf2_frame_set_adjust_regnum ( struct gdbarch * gdbarch,
int(*)(struct gdbarch *, int, int) adjust_regnum )

Definition at line 719 of file frame.c.

References dwarf2_frame_ops::adjust_regnum, and get_frame_ops().

Referenced by rs6000_gdbarch_init(), and s390_gdbarch_init().

◆ dwarf2_frame_set_init_reg()

void dwarf2_frame_set_init_reg ( struct gdbarch * gdbarch,
void(*)(struct gdbarch *, int, struct dwarf2_frame_state_reg *, frame_info_ptr) init_reg )

◆ dwarf2_frame_set_signal_frame_p()

void dwarf2_frame_set_signal_frame_p ( struct gdbarch * gdbarch,
int(*)(struct gdbarch *, frame_info_ptr) signal_frame_p )

◆ dwarf2_frame_signal_frame_p()

static int dwarf2_frame_signal_frame_p ( struct gdbarch * gdbarch,
frame_info_ptr this_frame )
static

Definition at line 705 of file frame.c.

References get_frame_ops(), and dwarf2_frame_ops::signal_frame_p.

Referenced by dwarf2_frame_sniffer().

◆ dwarf2_frame_sniffer()

static int dwarf2_frame_sniffer ( const struct frame_unwind * self,
frame_info_ptr this_frame,
void ** this_cache )
static

◆ dwarf2_frame_this_id()

static void dwarf2_frame_this_id ( frame_info_ptr this_frame,
void ** this_cache,
struct frame_id * this_id )
static

◆ dwarf2_frame_unwind_stop_reason()

static enum unwind_stop_reason dwarf2_frame_unwind_stop_reason ( frame_info_ptr this_frame,
void ** this_cache )
static

◆ dwarf2_restore_rule()

static void dwarf2_restore_rule ( struct gdbarch * gdbarch,
ULONGEST reg_num,
struct dwarf2_frame_state * fs,
int eh_frame_p )
static

◆ encoding_for_size()

static gdb_byte encoding_for_size ( unsigned int size)
static

Definition at line 1464 of file frame.c.

References size.

Referenced by read_encoded_value().

◆ execute_cfa_program()

static const gdb_byte * execute_cfa_program ( struct dwarf2_fde * fde,
const gdb_byte * insn_ptr,
const gdb_byte * insn_end,
struct gdbarch * gdbarch,
CORE_ADDR pc,
struct dwarf2_frame_state * fs,
CORE_ADDR text_offset )
static

◆ execute_stack_op()

static CORE_ADDR execute_stack_op ( const gdb_byte * exp,
ULONGEST len,
int addr_size,
frame_info_ptr this_frame,
CORE_ADDR initial,
int initial_in_stack_memory,
dwarf2_per_objfile * per_objfile )
static

◆ fde_is_less_than()

static bool fde_is_less_than ( const dwarf2_fde * aa,
const dwarf2_fde * bb )
static

◆ find_cie()

static struct dwarf2_cie * find_cie ( const dwarf2_cie_table & cie_table,
ULONGEST cie_pointer )
static

Definition at line 1577 of file frame.c.

References dwarf2_cie::cie_pointer.

Referenced by decode_frame_entry_1().

◆ find_comp_unit()

static comp_unit * find_comp_unit ( struct objfile * objfile)
static

◆ get_frame_ops()

static dwarf2_frame_ops * get_frame_ops ( struct gdbarch * gdbarch)
static

◆ read_encoded_value()

static ULONGEST read_encoded_value ( struct comp_unit * unit,
gdb_byte encoding,
int ptr_len,
const gdb_byte * buf,
unsigned int * bytes_read_ptr,
unrelocated_addr func_base )
static

◆ set_comp_unit()

static void set_comp_unit ( struct objfile * objfile,
struct comp_unit * unit )
static

◆ show_dwarf_unwinders_enabled_p()

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

Definition at line 2257 of file frame.c.

References gdb_printf().

Variable Documentation

◆ dwarf2_frame_base

const struct frame_base dwarf2_frame_base
static
Initial value:
=
{
}
static const struct frame_unwind dwarf2_frame_unwind
Definition frame.c:1340
static CORE_ADDR dwarf2_frame_base_address(frame_info_ptr this_frame, void **this_cache)
Definition frame.c:1383

Definition at line 1391 of file frame.c.

Referenced by dwarf2_frame_base_sniffer().

◆ dwarf2_frame_bfd_data

const registry<bfd>::key<comp_unit> dwarf2_frame_bfd_data
static

Definition at line 1439 of file frame.c.

Referenced by find_comp_unit(), and set_comp_unit().

◆ dwarf2_frame_data

const registry<gdbarch>::key<dwarf2_frame_ops> dwarf2_frame_data
static

Definition at line 610 of file frame.c.

Referenced by get_frame_ops().

◆ dwarf2_frame_objfile_data

const registry<objfile>::key<comp_unit> dwarf2_frame_objfile_data
static

Definition at line 1444 of file frame.c.

Referenced by find_comp_unit(), and set_comp_unit().

◆ dwarf2_frame_unwind

const struct frame_unwind dwarf2_frame_unwind
static
Initial value:
=
{
"dwarf2",
NULL,
}
static void dwarf2_frame_dealloc_cache(frame_info *self, void *this_cache)
Definition frame.c:1296
static enum unwind_stop_reason dwarf2_frame_unwind_stop_reason(frame_info_ptr this_frame, void **this_cache)
Definition frame.c:1123
static struct value * dwarf2_frame_prev_register(frame_info_ptr this_frame, void **this_cache, int regnum)
Definition frame.c:1154
static void dwarf2_frame_this_id(frame_info_ptr this_frame, void **this_cache, struct frame_id *this_id)
Definition frame.c:1139
static int dwarf2_frame_sniffer(const struct frame_unwind *self, frame_info_ptr this_frame, void **this_cache)
Definition frame.c:1306
@ NORMAL_FRAME
Definition frame.h:187

Definition at line 1340 of file frame.c.

Referenced by dwarf2_append_unwinders().

◆ dwarf2_frame_unwinders_enabled_p

bool dwarf2_frame_unwinders_enabled_p = true

Definition at line 190 of file frame.c.

Referenced by dwarf2_frame_sniffer(), and tailcall_frame_sniffer().

◆ dwarf2_signal_frame_unwind

const struct frame_unwind dwarf2_signal_frame_unwind
static
Initial value:

Definition at line 1352 of file frame.c.

Referenced by dwarf2_append_unwinders().