GDB (xrefs)
Classes | Defines | Enumerations | Functions | Variables
/home/stan/gdb/src/gdb/dwarf2-frame.c File Reference
#include "defs.h"
#include "dwarf2expr.h"
#include "dwarf2.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 "gdb_assert.h"
#include "gdb_string.h"
#include "complaints.h"
#include "dwarf2-frame.h"
#include "ax.h"
#include "dwarf2loc.h"
#include "exceptions.h"
#include "dwarf2-frame-tailcall.h"

Go to the source code of this file.

Classes

struct  dwarf2_cie
struct  dwarf2_cie_table
struct  dwarf2_fde
struct  dwarf2_fde_table
struct  comp_unit
struct  dwarf2_frame_state
struct  dwarf2_frame_state::dwarf2_frame_state_reg_info
struct  dwarf2_frame_ops
struct  dwarf2_frame_cache

Defines

#define cfa_exp_len   cfa_reg
#define DW64_CIE_ID   0xffffffffffffffffULL

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, CORE_ADDR *out_offset)
static int dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum, int eh_frame_p)
static CORE_ADDR read_encoded_value (struct comp_unit *unit, gdb_byte encoding, int ptr_len, const gdb_byte *buf, unsigned int *bytes_read_ptr, CORE_ADDR func_base)
static void dwarf2_frame_state_alloc_regs (struct dwarf2_frame_state_reg_info *rs, int num_regs)
static struct
dwarf2_frame_state_reg
dwarf2_frame_state_copy_regs (struct dwarf2_frame_state_reg_info *rs)
static void dwarf2_frame_state_free_regs (struct dwarf2_frame_state_reg_info *rs)
static void dwarf2_frame_state_free (void *p)
static CORE_ADDR read_reg (void *baton, int reg)
static void read_mem (void *baton, gdb_byte *buf, CORE_ADDR addr, size_t len)
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, CORE_ADDR offset, struct frame_info *this_frame, CORE_ADDR initial, int initial_in_stack_memory)
static const gdb_byteexecute_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)
static void dwarf2_frame_default_init_reg (struct gdbarch *gdbarch, int regnum, struct dwarf2_frame_state_reg *reg, struct frame_info *this_frame)
static void * dwarf2_frame_init (struct obstack *obstack)
void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, void(*init_reg)(struct gdbarch *, int, struct dwarf2_frame_state_reg *, struct frame_info *))
static void dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, struct dwarf2_frame_state_reg *reg, struct frame_info *this_frame)
void dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch, int(*signal_frame_p)(struct gdbarch *, struct frame_info *))
static int dwarf2_frame_signal_frame_p (struct gdbarch *gdbarch, struct frame_info *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)
void dwarf2_compile_cfa_to_ax (struct agent_expr *expr, struct axs_value *loc, struct gdbarch *gdbarch, CORE_ADDR pc, struct dwarf2_per_cu_data *data)
static void clear_pointer_cleanup (void *arg)
static struct dwarf2_frame_cachedwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
static enum unwind_stop_reason dwarf2_frame_unwind_stop_reason (struct frame_info *this_frame, void **this_cache)
static void dwarf2_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
static struct valuedwarf2_frame_prev_register (struct frame_info *this_frame, void **this_cache, int regnum)
static void dwarf2_frame_dealloc_cache (struct frame_info *self, void *this_cache)
static int dwarf2_frame_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, void **this_cache)
void dwarf2_append_unwinders (struct gdbarch *gdbarch)
static CORE_ADDR dwarf2_frame_base_address (struct frame_info *this_frame, void **this_cache)
struct frame_basedwarf2_frame_base_sniffer (struct frame_info *this_frame)
CORE_ADDR dwarf2_frame_cfa (struct frame_info *this_frame)
static unsigned int read_1_byte (bfd *abfd, const gdb_byte *buf)
static unsigned int read_4_bytes (bfd *abfd, const gdb_byte *buf)
static ULONGEST read_8_bytes (bfd *abfd, const gdb_byte *buf)
static ULONGEST read_initial_length (bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read_ptr)
static gdb_byte encoding_for_size (unsigned int size)
static int bsearch_cie_cmp (const void *key, const void *element)
static struct dwarf2_ciefind_cie (struct dwarf2_cie_table *cie_table, ULONGEST cie_pointer)
static void add_cie (struct dwarf2_cie_table *cie_table, struct dwarf2_cie *cie)
static int bsearch_fde_cmp (const void *key, const void *element)
static void add_fde (struct dwarf2_fde_table *fde_table, struct dwarf2_fde *fde)
static const gdb_bytedecode_frame_entry (struct comp_unit *unit, const gdb_byte *start, int eh_frame_p, struct dwarf2_cie_table *cie_table, struct dwarf2_fde_table *fde_table, enum eh_frame_type entry_type)
static const gdb_bytedecode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, int eh_frame_p, struct dwarf2_cie_table *cie_table, struct dwarf2_fde_table *fde_table, enum eh_frame_type entry_type)
static int qsort_fde_cmp (const void *a, const void *b)
void dwarf2_build_frame_info (struct objfile *objfile)
void _initialize_dwarf2_frame (void)

Variables

static struct
dwarf_expr_context_funcs 
dwarf2_frame_ctx_funcs
static struct gdbarch_datadwarf2_frame_data
static struct frame_unwind dwarf2_frame_unwind
static struct frame_unwind dwarf2_signal_frame_unwind
static struct frame_base dwarf2_frame_base
struct objfile_data * dwarf2_frame_objfile_data

Define Documentation

#define cfa_exp_len   cfa_reg

Definition at line 220 of file dwarf2-frame.c.

#define DW64_CIE_ID   0xffffffffffffffffULL

Definition at line 1806 of file dwarf2-frame.c.

Referenced by decode_frame_entry_1().


Enumeration Type Documentation

Enumerator:
EH_CIE_TYPE_ID 
EH_FDE_TYPE_ID 
EH_CIE_OR_FDE_TYPE_ID 

Definition at line 1811 of file dwarf2-frame.c.


Function Documentation

void _initialize_dwarf2_frame ( void  )
static void add_cie ( struct dwarf2_cie_table cie_table,
struct dwarf2_cie cie 
) [static]
static void add_fde ( struct dwarf2_fde_table fde_table,
struct dwarf2_fde fde 
) [static]
static int bsearch_cie_cmp ( const void *  key,
const void *  element 
) [static]

Definition at line 1684 of file dwarf2-frame.c.

References dwarf2_cie::cie_pointer, and ULONGEST.

Referenced by find_cie().

static int bsearch_fde_cmp ( const void *  key,
const void *  element 
) [static]

Definition at line 1732 of file dwarf2-frame.c.

References dwarf2_fde::address_range, and dwarf2_fde::initial_location.

Referenced by dwarf2_frame_find_fde().

static void clear_pointer_cleanup ( void *  arg) [static]

Definition at line 998 of file dwarf2-frame.c.

Referenced by dwarf2_frame_cache().

static const gdb_byte * decode_frame_entry ( struct comp_unit unit,
const gdb_byte start,
int  eh_frame_p,
struct dwarf2_cie_table cie_table,
struct dwarf2_fde_table fde_table,
enum eh_frame_type  entry_type 
) [static]
static const gdb_byte* decode_frame_entry_1 ( struct comp_unit unit,
const gdb_byte start,
int  eh_frame_p,
struct dwarf2_cie_table cie_table,
struct dwarf2_fde_table fde_table,
enum eh_frame_type  entry_type 
) [static]
void dwarf2_append_unwinders ( struct gdbarch gdbarch)
void dwarf2_build_frame_info ( struct objfile objfile)
void dwarf2_compile_cfa_to_ax ( struct agent_expr expr,
struct axs_value loc,
struct gdbarch gdbarch,
CORE_ADDR  pc,
struct dwarf2_per_cu_data data 
)
static int dwarf2_frame_adjust_regnum ( struct gdbarch gdbarch,
int  regnum,
int  eh_frame_p 
) [static]
static CORE_ADDR dwarf2_frame_base_address ( struct frame_info this_frame,
void **  this_cache 
) [static]

Definition at line 1464 of file dwarf2-frame.c.

References dwarf2_frame_cache::cfa, and dwarf2_frame_cache().

struct frame_base* dwarf2_frame_base_sniffer ( struct frame_info this_frame) [read]
static struct dwarf2_frame_cache* dwarf2_frame_cache ( struct frame_info this_frame,
void **  this_cache 
) [static, read]

Definition at line 1006 of file dwarf2-frame.c.

References _, dwarf2_cie::addr_size, dwarf2_frame_cache::addr_size, dwarf2_frame_state::armcc_cfa_offsets_reversed, dwarf2_frame_cache::cfa, dwarf2_frame_state::dwarf2_frame_state_reg_info::cfa_exp, dwarf2_frame_state::dwarf2_frame_state_reg_info::cfa_how, dwarf2_frame_state::dwarf2_frame_state_reg_info::cfa_offset, dwarf2_frame_state::dwarf2_frame_state_reg_info::cfa_reg, dwarf2_fde::cie, clear_pointer_cleanup(), dwarf2_frame_state::code_align, dwarf2_cie::code_alignment_factor, complaint(), dwarf2_frame_state::data_align, dwarf2_cie::data_alignment_factor, discard_cleanups(), do_cleanups(), 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_frame_state_copy_regs(), dwarf2_frame_state_free(), dwarf2_tailcall_sniffer_first(), dwarf2_cie::end, dwarf2_fde::end, gdb_exception::error, execute_cfa_program(), execute_stack_op(), FRAME_OBSTACK_CALLOC, FRAME_OBSTACK_ZALLOC, gdb_assert, gdbarch_dwarf2_reg_to_regnum(), gdbarch_num_pseudo_regs(), gdbarch_num_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_frame_state::initial, dwarf2_cie::initial_instructions, dwarf2_fde::instructions, internal_error(), dwarf2_frame_state_reg::loc, LONGEST, make_cleanup(), NOT_AVAILABLE_ERROR, gdbarch::num_regs, dwarf2_frame_state::dwarf2_frame_state_reg_info::num_regs, paddress(), dwarf2_frame_state::pc, read_reg(), gdb_exception::reason, dwarf2_frame_state_reg::reg, dwarf2_frame_state::dwarf2_frame_state_reg_info::reg, dwarf2_frame_cache::reg, regnum, dwarf2_frame_state::regs, dwarf2_frame_state::retaddr_column, dwarf2_frame_cache::retaddr_reg, dwarf2_cie::return_address_register, RETURN_MASK_ERROR, symfile_complaints, dwarf2_frame_cache::tailcall_cache, dwarf2_frame_cache::text_offset, throw_exception(), TRY_CATCH, dwarf2_frame_cache::unavailable_retaddr, dwarf2_frame_cache::undefined_retaddr, and XZALLOC.

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

CORE_ADDR dwarf2_frame_cfa ( struct frame_info this_frame)
static void dwarf2_frame_dealloc_cache ( struct frame_info self,
void *  this_cache 
) [static]
static void dwarf2_frame_default_init_reg ( struct gdbarch gdbarch,
int  regnum,
struct dwarf2_frame_state_reg reg,
struct frame_info this_frame 
) [static]
static struct dwarf2_fde * dwarf2_frame_find_fde ( CORE_ADDR pc,
CORE_ADDR out_offset 
) [static, read]
static void dwarf2_frame_find_quirks ( struct dwarf2_frame_state fs,
struct dwarf2_fde fde 
) [static]
static void* dwarf2_frame_init ( struct obstack *  obstack) [static]
static void dwarf2_frame_init_reg ( struct gdbarch gdbarch,
int  regnum,
struct dwarf2_frame_state_reg reg,
struct frame_info this_frame 
) [static]

Definition at line 788 of file dwarf2-frame.c.

References gdbarch_data(), and dwarf2_frame_ops::init_reg.

Referenced by dwarf2_frame_cache().

static struct value* dwarf2_frame_prev_register ( struct frame_info this_frame,
void **  this_cache,
int  regnum 
) [static, read]
void dwarf2_frame_set_adjust_regnum ( struct gdbarch gdbarch,
int(*)(struct gdbarch *, int, int adjust_regnum 
)

Definition at line 828 of file dwarf2-frame.c.

References dwarf2_frame_ops::adjust_regnum, and gdbarch_data().

Referenced by rs6000_gdbarch_init(), and s390_gdbarch_init().

void dwarf2_frame_set_init_reg ( struct gdbarch gdbarch,
void(*)(struct gdbarch *, int, struct dwarf2_frame_state_reg *, struct frame_info *)  init_reg 
)
void dwarf2_frame_set_signal_frame_p ( struct gdbarch gdbarch,
int(*)(struct gdbarch *, struct frame_info *)  signal_frame_p 
)
static int dwarf2_frame_signal_frame_p ( struct gdbarch gdbarch,
struct frame_info this_frame 
) [static]

Definition at line 814 of file dwarf2-frame.c.

References gdbarch_data(), and dwarf2_frame_ops::signal_frame_p.

Referenced by dwarf2_frame_sniffer().

static int dwarf2_frame_sniffer ( const struct frame_unwind self,
struct frame_info this_frame,
void **  this_cache 
) [static]
static void dwarf2_frame_state_alloc_regs ( struct dwarf2_frame_state_reg_info *  rs,
int  num_regs 
) [static]

Definition at line 226 of file dwarf2-frame.c.

References memset(), size, and xrealloc().

Referenced by dwarf2_restore_rule(), and execute_cfa_program().

static struct dwarf2_frame_state_reg* dwarf2_frame_state_copy_regs ( struct dwarf2_frame_state_reg_info *  rs) [static, read]
static void dwarf2_frame_state_free ( void *  p) [static]
static void dwarf2_frame_state_free_regs ( struct dwarf2_frame_state_reg_info *  rs) [static]

Definition at line 260 of file dwarf2-frame.c.

References xfree().

Referenced by dwarf2_frame_state_free(), and execute_cfa_program().

static void dwarf2_frame_this_id ( struct frame_info this_frame,
void **  this_cache,
struct frame_id this_id 
) [static]
static enum unwind_stop_reason dwarf2_frame_unwind_stop_reason ( struct frame_info this_frame,
void **  this_cache 
) [static]
static void dwarf2_restore_rule ( struct gdbarch gdbarch,
ULONGEST  reg_num,
struct dwarf2_frame_state fs,
int  eh_frame_p 
) [static]
static gdb_byte encoding_for_size ( unsigned int  size) [static]

Definition at line 1569 of file dwarf2-frame.c.

References _, and internal_error().

Referenced by read_encoded_value().

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 
) [static]

Definition at line 408 of file dwarf2-frame.c.

References _, ANOFFSET, dwarf2_frame_state::armcc_cfa_offsets_sf, dwarf2_frame_state::dwarf2_frame_state_reg_info::cfa_exp, dwarf2_frame_state::dwarf2_frame_state_reg_info::cfa_how, dwarf2_frame_state::dwarf2_frame_state_reg_info::cfa_offset, dwarf2_frame_state::dwarf2_frame_state_reg_info::cfa_reg, dwarf2_fde::cie, dwarf2_frame_state::code_align, complaint(), dwarf2_frame_state::data_align, dwarf2_frame_adjust_regnum(), DWARF2_FRAME_REG_SAME_VALUE, DWARF2_FRAME_REG_SAVED_EXP, DWARF2_FRAME_REG_SAVED_OFFSET, DWARF2_FRAME_REG_SAVED_REG, DWARF2_FRAME_REG_SAVED_VAL_EXP, DWARF2_FRAME_REG_SAVED_VAL_OFFSET, DWARF2_FRAME_REG_UNDEFINED, dwarf2_frame_state_alloc_regs(), dwarf2_frame_state_copy_regs(), dwarf2_frame_state_free_regs(), dwarf2_restore_rule(), dwarf2_fde::eh_frame_p, dwarf2_cie::encoding, dwarf2_frame_state_reg::exp, dwarf2_frame_state_reg::exp_len, extract_unsigned_integer(), gdbarch_byte_order(), dwarf2_frame_state_reg::how, dwarf2_frame_state::initial, dwarf2_fde::initial_location, internal_error(), dwarf2_frame_state_reg::loc, comp_unit::objfile, offset, dwarf2_frame_state_reg::offset, paddress(), dwarf2_frame_state::pc, dwarf2_frame_state::dwarf2_frame_state_reg_info::prev, dwarf2_cie::ptr_size, read_encoded_value(), dwarf2_frame_state_reg::reg, dwarf2_frame_state::dwarf2_frame_state_reg_info::reg, register_size(), dwarf2_frame_state::regs, safe_read_sleb128(), safe_read_uleb128(), SECT_OFF_TEXT, objfile::section_offsets, size, symfile_complaints, dwarf2_cie::unit, xfree(), and XMALLOC.

Referenced by dwarf2_compile_cfa_to_ax(), and dwarf2_frame_cache().

static CORE_ADDR execute_stack_op ( const gdb_byte exp,
ULONGEST  len,
int  addr_size,
CORE_ADDR  offset,
struct frame_info this_frame,
CORE_ADDR  initial,
int  initial_in_stack_memory 
) [static]
static struct dwarf2_cie* find_cie ( struct dwarf2_cie_table cie_table,
ULONGEST  cie_pointer 
) [static, read]
static int qsort_fde_cmp ( const void *  a,
const void *  b 
) [static]
static unsigned int read_1_byte ( bfd *  abfd,
const gdb_byte buf 
) [static]

Definition at line 1516 of file dwarf2-frame.c.

Referenced by decode_frame_entry_1().

static unsigned int read_4_bytes ( bfd *  abfd,
const gdb_byte buf 
) [static]

Definition at line 1522 of file dwarf2-frame.c.

Referenced by decode_frame_entry_1().

static ULONGEST read_8_bytes ( bfd *  abfd,
const gdb_byte buf 
) [static]

Definition at line 1528 of file dwarf2-frame.c.

Referenced by decode_frame_entry_1().

static CORE_ADDR read_encoded_value ( struct comp_unit unit,
gdb_byte  encoding,
int  ptr_len,
const gdb_byte buf,
unsigned int bytes_read_ptr,
CORE_ADDR  func_base 
) [static]
static ULONGEST read_initial_length ( bfd *  abfd,
const gdb_byte buf,
unsigned int bytes_read_ptr 
) [static]

Definition at line 1534 of file dwarf2-frame.c.

References LONGEST.

Referenced by decode_frame_entry_1().

static void read_mem ( void *  baton,
gdb_byte buf,
CORE_ADDR  addr,
size_t  len 
) [static]

Definition at line 310 of file dwarf2-frame.c.

References read_memory().

static CORE_ADDR read_reg ( void *  baton,
int  reg 
) [static]

Variable Documentation

struct frame_base dwarf2_frame_base [static]
Initial value:

Definition at line 1472 of file dwarf2-frame.c.

Referenced by dwarf2_frame_base_sniffer().

struct gdbarch_data* dwarf2_frame_data [static]

Definition at line 703 of file dwarf2-frame.c.

struct objfile_data* dwarf2_frame_objfile_data

Definition at line 1513 of file dwarf2-frame.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines