GDB (xrefs)
Macros | Functions | Variables
/tmp/gdb-7.10/gdb/sparc-tdep.c File Reference
#include "defs.h"
#include "arch-utils.h"
#include "dis-asm.h"
#include "dwarf2-frame.h"
#include "floatformat.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
#include "gdbcore.h"
#include "gdbtypes.h"
#include "inferior.h"
#include "symtab.h"
#include "objfiles.h"
#include "osabi.h"
#include "regcache.h"
#include "target.h"
#include "value.h"
#include "sparc-tdep.h"
#include "sparc-ravenscar-thread.h"

Go to the source code of this file.

Macros

#define floatformats_sparc_quad   floatformats_ia64_quad
 
#define BIAS   2047
 
#define X_OP(i)   (((i) >> 30) & 0x3)
 
#define X_RD(i)   (((i) >> 25) & 0x1f)
 
#define X_A(i)   (((i) >> 29) & 1)
 
#define X_COND(i)   (((i) >> 25) & 0xf)
 
#define X_OP2(i)   (((i) >> 22) & 0x7)
 
#define X_IMM22(i)   ((i) & 0x3fffff)
 
#define X_OP3(i)   (((i) >> 19) & 0x3f)
 
#define X_RS1(i)   (((i) >> 14) & 0x1f)
 
#define X_RS2(i)   ((i) & 0x1f)
 
#define X_I(i)   (((i) >> 13) & 1)
 
#define X_DISP22(i)   ((X_IMM22 (i) ^ 0x200000) - 0x200000)
 
#define X_DISP19(i)   ((((i) & 0x7ffff) ^ 0x40000) - 0x40000)
 
#define X_DISP10(i)   ((((((i) >> 11) && 0x300) | (((i) >> 5) & 0xff)) ^ 0x200) - 0x200)
 
#define X_SIMM13(i)   ((((i) & 0x1fff) ^ 0x1000) - 0x1000)
 
#define X_RETTURN(i)   ((X_OP (i) == 0x2) && (X_OP3 (i) == 0x39))
 
#define SPARC32_NUM_REGS   ARRAY_SIZE (sparc32_register_names)
 
#define SPARC32_NUM_PSEUDO_REGS   ARRAY_SIZE (sparc32_pseudo_register_names)
 

Functions

unsigned long sparc_fetch_instruction (CORE_ADDR pc)
 
static int sparc_is_unimp_insn (CORE_ADDR pc)
 
int sparc_is_annulled_branch_insn (CORE_ADDR pc)
 
ULONGEST sparc_fetch_wcookie (struct gdbarch *gdbarch)
 
static int sparc_integral_or_pointer_p (const struct type *type)
 
static int sparc_floating_p (const struct type *type)
 
static int sparc_complex_floating_p (const struct type *type)
 
static int sparc_structure_or_union_p (const struct type *type)
 
static const char * sparc32_register_name (struct gdbarch *gdbarch, int regnum)
 
static struct typesparc_psr_type (struct gdbarch *gdbarch)
 
static struct typesparc_fsr_type (struct gdbarch *gdbarch)
 
static struct typesparc32_register_type (struct gdbarch *gdbarch, int regnum)
 
static enum register_status sparc32_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, gdb_byte *buf)
 
static void sparc32_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const gdb_byte *buf)
 
int sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
 
static CORE_ADDR sparc32_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
 
static CORE_ADDR sparc32_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funcaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache)
 
static CORE_ADDR sparc32_store_arguments (struct regcache *regcache, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
 
static CORE_ADDR sparc32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
 
static const gdb_bytesparc_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc, int *len)
 
static struct sparc_frame_cachesparc_alloc_frame_cache (void)
 
static CORE_ADDR sparc_skip_stack_check (const CORE_ADDR start_pc)
 
void sparc_record_save_insn (struct sparc_frame_cache *cache)
 
CORE_ADDR sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct sparc_frame_cache *cache)
 
static CORE_ADDR sparc_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
 
static CORE_ADDR sparc32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
 
struct sparc_frame_cachesparc_frame_cache (struct frame_info *this_frame, void **this_cache)
 
static int sparc32_struct_return_from_sym (struct symbol *sym)
 
struct sparc_frame_cachesparc32_frame_cache (struct frame_info *this_frame, void **this_cache)
 
static void sparc32_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
 
static struct valuesparc32_frame_prev_register (struct frame_info *this_frame, void **this_cache, int regnum)
 
static CORE_ADDR sparc32_frame_base_address (struct frame_info *this_frame, void **this_cache)
 
static struct frame_id sparc_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 
static void sparc32_extract_return_value (struct type *type, struct regcache *regcache, gdb_byte *valbuf)
 
static void sparc32_store_return_value (struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
 
static enum return_value_convention sparc32_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
 
static int sparc32_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
 
static int sparc32_dwarf2_struct_return_p (struct frame_info *this_frame)
 
static void sparc32_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, struct dwarf2_frame_state_reg *reg, struct frame_info *this_frame)
 
static CORE_ADDR sparc_analyze_control_transfer (struct frame_info *frame, CORE_ADDR pc, CORE_ADDR *npc)
 
static CORE_ADDR sparc_step_trap (struct frame_info *frame, unsigned long insn)
 
int sparc_software_single_step (struct frame_info *frame)
 
static void sparc_write_pc (struct regcache *regcache, CORE_ADDR pc)
 
static void sparc_iterate_over_regset_sections (struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
 
static struct gdbarchsparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
void sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum)
 
void sparc_collect_rwindow (const struct regcache *regcache, CORE_ADDR sp, int regnum)
 
void sparc32_supply_gregset (const struct sparc_gregmap *gregmap, struct regcache *regcache, int regnum, const void *gregs)
 
void sparc32_collect_gregset (const struct sparc_gregmap *gregmap, const struct regcache *regcache, int regnum, void *gregs)
 
void sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap, struct regcache *regcache, int regnum, const void *fpregs)
 
void sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap, const struct regcache *regcache, int regnum, void *fpregs)
 
void _initialize_sparc_tdep (void)
 

Variables

static const char * sparc32_register_names []
 
static const char * sparc32_pseudo_register_names []
 
static const struct frame_unwind sparc32_frame_unwind
 
static const struct frame_base sparc32_frame_base
 
const struct sparc_gregmap sparc32_sunos4_gregmap
 
const struct sparc_fpregmap sparc32_sunos4_fpregmap
 
const struct sparc_fpregmap sparc32_bsd_fpregmap
 

Macro Definition Documentation

#define BIAS   2047
#define floatformats_sparc_quad   floatformats_ia64_quad

Definition at line 64 of file sparc-tdep.c.

Referenced by sparc32_gdbarch_init().

#define SPARC32_NUM_PSEUDO_REGS   ARRAY_SIZE (sparc32_pseudo_register_names)

Definition at line 327 of file sparc-tdep.c.

Referenced by sparc32_gdbarch_init(), and sparc32_register_name().

#define SPARC32_NUM_REGS   ARRAY_SIZE (sparc32_register_names)

Definition at line 315 of file sparc-tdep.c.

Referenced by sparc32_gdbarch_init(), and sparc32_register_name().

#define X_A (   i)    (((i) >> 29) & 1)

Definition at line 75 of file sparc-tdep.c.

Referenced by sparc_analyze_control_transfer(), and sparc_is_annulled_branch_insn().

#define X_COND (   i)    (((i) >> 25) & 0xf)

Definition at line 76 of file sparc-tdep.c.

Referenced by sparc_analyze_control_transfer(), and sparc_skip_stack_check().

#define X_DISP10 (   i)    ((((((i) >> 11) && 0x300) | (((i) >> 5) & 0xff)) ^ 0x200) - 0x200)

Definition at line 86 of file sparc-tdep.c.

Referenced by sparc_analyze_control_transfer().

#define X_DISP19 (   i)    ((((i) & 0x7ffff) ^ 0x40000) - 0x40000)

Definition at line 85 of file sparc-tdep.c.

Referenced by sparc_analyze_control_transfer().

#define X_DISP22 (   i)    ((X_IMM22 (i) ^ 0x200000) - 0x200000)

Definition at line 84 of file sparc-tdep.c.

Referenced by sparc_analyze_control_transfer().

#define X_I (   i)    (((i) >> 13) & 1)
#define X_IMM22 (   i)    ((i) & 0x3fffff)

Definition at line 78 of file sparc-tdep.c.

#define X_OP (   i)    (((i) >> 30) & 0x3)
#define X_OP2 (   i)    (((i) >> 22) & 0x7)
#define X_OP3 (   i)    (((i) >> 19) & 0x3f)
#define X_RD (   i)    (((i) >> 25) & 0x1f)
#define X_RETTURN (   i)    ((X_OP (i) == 0x2) && (X_OP3 (i) == 0x39))

Definition at line 90 of file sparc-tdep.c.

Referenced by sparc_stack_frame_destroyed_p().

#define X_RS1 (   i)    (((i) >> 14) & 0x1f)
#define X_RS2 (   i)    ((i) & 0x1f)

Definition at line 81 of file sparc-tdep.c.

Referenced by sparc_analyze_prologue(), and sparc_skip_stack_check().

#define X_SIMM13 (   i)    ((((i) & 0x1fff) ^ 0x1000) - 0x1000)

Function Documentation

void _initialize_sparc_tdep ( void  )

Definition at line 2086 of file sparc-tdep.c.

References register_gdbarch_init(), and sparc32_gdbarch_init().

void sparc32_collect_fpregset ( const struct sparc_fpregmap fpregmap,
const struct regcache regcache,
int  regnum,
void *  fpregs 
)
void sparc32_collect_gregset ( const struct sparc_gregmap gregmap,
const struct regcache regcache,
int  regnum,
void *  gregs 
)
static void sparc32_dwarf2_frame_init_reg ( struct gdbarch gdbarch,
int  regnum,
struct dwarf2_frame_state_reg reg,
struct frame_info this_frame 
)
static
static int sparc32_dwarf2_struct_return_p ( struct frame_info this_frame)
static
static void sparc32_extract_return_value ( struct type type,
struct regcache regcache,
gdb_byte valbuf 
)
static
static CORE_ADDR sparc32_frame_align ( struct gdbarch gdbarch,
CORE_ADDR  address 
)
static

Definition at line 480 of file sparc-tdep.c.

Referenced by sparc32_gdbarch_init().

static CORE_ADDR sparc32_frame_base_address ( struct frame_info this_frame,
void **  this_cache 
)
static

Definition at line 1274 of file sparc-tdep.c.

References sparc_frame_cache::base, and sparc32_frame_cache().

struct sparc_frame_cache* sparc32_frame_cache ( struct frame_info this_frame,
void **  this_cache 
)
static struct value* sparc32_frame_prev_register ( struct frame_info this_frame,
void **  this_cache,
int  regnum 
)
static
static void sparc32_frame_this_id ( struct frame_info this_frame,
void **  this_cache,
struct frame_id this_id 
)
static
static struct gdbarch* sparc32_gdbarch_init ( struct gdbarch_info  info,
struct gdbarch_list arches 
)
static

Definition at line 1664 of file sparc-tdep.c.

References core_addr_lessthan(), dwarf2_frame_set_init_reg(), floatformats_sparc_quad, frame_base_set_default(), frame_unwind_append_unwinder(), gdbarch_list::gdbarch, gdbarch_alloc(), gdbarch_init_osabi(), gdbarch_list_lookup_by_info(), gdbarch_tdep::gregset, gdbarch_tdep::npc_regnum, ON_STACK, gdbarch_tdep::pc_regnum, register_sparc_ravenscar_ops(), set_gdbarch_breakpoint_from_pc(), set_gdbarch_call_dummy_location(), set_gdbarch_dummy_id(), set_gdbarch_fp0_regnum(), set_gdbarch_frame_align(), set_gdbarch_frame_args_skip(), set_gdbarch_inner_than(), set_gdbarch_iterate_over_regset_sections(), set_gdbarch_long_double_bit(), set_gdbarch_long_double_format(), set_gdbarch_num_pseudo_regs(), set_gdbarch_num_regs(), set_gdbarch_pc_regnum(), set_gdbarch_print_insn(), set_gdbarch_pseudo_register_read(), set_gdbarch_pseudo_register_write(), set_gdbarch_push_dummy_call(), set_gdbarch_push_dummy_code(), set_gdbarch_register_name(), set_gdbarch_register_type(), set_gdbarch_return_value(), set_gdbarch_skip_prologue(), set_gdbarch_software_single_step(), set_gdbarch_sp_regnum(), set_gdbarch_stabs_argument_has_addr(), set_gdbarch_unwind_pc(), set_gdbarch_write_pc(), sparc32_dwarf2_frame_init_reg(), sparc32_frame_align(), SPARC32_NPC_REGNUM, SPARC32_NUM_PSEUDO_REGS, SPARC32_NUM_REGS, SPARC32_PC_REGNUM, sparc32_pseudo_register_read(), sparc32_pseudo_register_write(), sparc32_push_dummy_call(), sparc32_push_dummy_code(), sparc32_register_name(), sparc32_register_type(), sparc32_return_value(), sparc32_skip_prologue(), sparc32_stabs_argument_has_addr(), sparc_breakpoint_from_pc(), sparc_dummy_id(), SPARC_F0_REGNUM, sparc_iterate_over_regset_sections(), sparc_software_single_step(), SPARC_SP_REGNUM, sparc_step_trap(), sparc_unwind_pc(), sparc_write_pc(), and gdbarch_tdep::step_trap.

Referenced by _initialize_sparc_tdep().

static enum register_status sparc32_pseudo_register_read ( struct gdbarch gdbarch,
struct regcache regcache,
int  regnum,
gdb_byte buf 
)
static
static void sparc32_pseudo_register_write ( struct gdbarch gdbarch,
struct regcache regcache,
int  regnum,
const gdb_byte buf 
)
static
static CORE_ADDR sparc32_push_dummy_call ( struct gdbarch gdbarch,
struct value function,
struct regcache regcache,
CORE_ADDR  bp_addr,
int  nargs,
struct value **  args,
CORE_ADDR  sp,
int  struct_return,
CORE_ADDR  struct_addr 
)
static
static CORE_ADDR sparc32_push_dummy_code ( struct gdbarch gdbarch,
CORE_ADDR  sp,
CORE_ADDR  funcaddr,
struct value **  args,
int  nargs,
struct type value_type,
CORE_ADDR real_pc,
CORE_ADDR bp_addr,
struct regcache regcache 
)
static
static const char* sparc32_register_name ( struct gdbarch gdbarch,
int  regnum 
)
static
static struct type* sparc32_register_type ( struct gdbarch gdbarch,
int  regnum 
)
static
static enum return_value_convention sparc32_return_value ( struct gdbarch gdbarch,
struct value function,
struct type type,
struct regcache regcache,
gdb_byte readbuf,
const gdb_byte writebuf 
)
static
static CORE_ADDR sparc32_skip_prologue ( struct gdbarch gdbarch,
CORE_ADDR  start_pc 
)
static
static int sparc32_stabs_argument_has_addr ( struct gdbarch gdbarch,
struct type type 
)
static
static CORE_ADDR sparc32_store_arguments ( struct regcache regcache,
int  nargs,
struct value **  args,
CORE_ADDR  sp,
int  struct_return,
CORE_ADDR  struct_addr 
)
static
static void sparc32_store_return_value ( struct type type,
struct regcache regcache,
const gdb_byte valbuf 
)
static
static int sparc32_struct_return_from_sym ( struct symbol sym)
static
void sparc32_supply_fpregset ( const struct sparc_fpregmap fpregmap,
struct regcache regcache,
int  regnum,
const void *  fpregs 
)
void sparc32_supply_gregset ( const struct sparc_gregmap gregmap,
struct regcache regcache,
int  regnum,
const void *  gregs 
)
static struct sparc_frame_cache* sparc_alloc_frame_cache ( void  )
static
static CORE_ADDR sparc_analyze_control_transfer ( struct frame_info frame,
CORE_ADDR  pc,
CORE_ADDR npc 
)
static
CORE_ADDR sparc_analyze_prologue ( struct gdbarch gdbarch,
CORE_ADDR  pc,
CORE_ADDR  current_pc,
struct sparc_frame_cache cache 
)
static const gdb_byte* sparc_breakpoint_from_pc ( struct gdbarch gdbarch,
CORE_ADDR pc,
int len 
)
static

Definition at line 645 of file sparc-tdep.c.

Referenced by sparc32_gdbarch_init().

void sparc_collect_rwindow ( const struct regcache regcache,
CORE_ADDR  sp,
int  regnum 
)
static int sparc_complex_floating_p ( const struct type type)
static
static struct frame_id sparc_dummy_id ( struct gdbarch gdbarch,
struct frame_info this_frame 
)
static
unsigned long sparc_fetch_instruction ( CORE_ADDR  pc)
ULONGEST sparc_fetch_wcookie ( struct gdbarch gdbarch)
static int sparc_floating_p ( const struct type type)
static
struct sparc_frame_cache* sparc_frame_cache ( struct frame_info this_frame,
void **  this_cache 
)
static struct type* sparc_fsr_type ( struct gdbarch gdbarch)
static
static int sparc_integral_or_pointer_p ( const struct type type)
static
int sparc_is_annulled_branch_insn ( CORE_ADDR  pc)

Definition at line 128 of file sparc-tdep.c.

References sparc_fetch_instruction(), X_A, X_OP, and X_OP2.

Referenced by sparc64_linux_get_longjmp_target().

static int sparc_is_unimp_insn ( CORE_ADDR  pc)
static

Definition at line 117 of file sparc-tdep.c.

References sparc_fetch_instruction().

Referenced by sparc32_frame_cache().

static void sparc_iterate_over_regset_sections ( struct gdbarch gdbarch,
iterate_over_regset_sections_cb cb,
void *  cb_data,
const struct regcache regcache 
)
static
static struct type* sparc_psr_type ( struct gdbarch gdbarch)
static
void sparc_record_save_insn ( struct sparc_frame_cache cache)
static CORE_ADDR sparc_skip_stack_check ( const CORE_ADDR  start_pc)
static
int sparc_software_single_step ( struct frame_info frame)
int sparc_stack_frame_destroyed_p ( struct gdbarch gdbarch,
CORE_ADDR  pc 
)

Definition at line 458 of file sparc-tdep.c.

References sparc_fetch_instruction(), and X_RETTURN.

Referenced by sparc64_init_abi().

static CORE_ADDR sparc_step_trap ( struct frame_info frame,
unsigned long  insn 
)
static

Definition at line 1603 of file sparc-tdep.c.

Referenced by sparc32_gdbarch_init().

static int sparc_structure_or_union_p ( const struct type type)
static
void sparc_supply_rwindow ( struct regcache regcache,
CORE_ADDR  sp,
int  regnum 
)
static CORE_ADDR sparc_unwind_pc ( struct gdbarch gdbarch,
struct frame_info this_frame 
)
static
static void sparc_write_pc ( struct regcache regcache,
CORE_ADDR  pc 
)
static

Variable Documentation

const struct sparc_fpregmap sparc32_bsd_fpregmap
const struct frame_base sparc32_frame_base
static
Initial value:
=
{
sparc32_frame_base_address
}
static CORE_ADDR sparc32_frame_base_address(struct frame_info *this_frame, void **this_cache)
Definition: sparc-tdep.c:1274
static const struct frame_unwind sparc32_frame_unwind
Definition: sparc-tdep.c:1262

Definition at line 1282 of file sparc-tdep.c.

const struct frame_unwind sparc32_frame_unwind
static
Initial value:
=
{
NULL,
}
static struct value * sparc32_frame_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
Definition: sparc-tdep.c:1205
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
Definition: frame-unwind.c:170
static void sparc32_frame_this_id(struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
Definition: sparc-tdep.c:1191
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
Definition: frame-unwind.c:180

Definition at line 1262 of file sparc-tdep.c.

const char* sparc32_pseudo_register_names[]
static
Initial value:
=
{
"d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
"d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30"
}

Definition at line 320 of file sparc-tdep.c.

Referenced by sparc32_register_name().

const char* sparc32_register_names[]
static
Initial value:
=
{
"g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
"o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
"l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
"i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
"y", "psr", "wim", "tbr", "pc", "npc", "fsr", "csr"
}

Definition at line 299 of file sparc-tdep.c.

Referenced by sparc32_register_name().

const struct sparc_fpregmap sparc32_sunos4_fpregmap
Initial value:
=
{
0 * 4,
33 * 4,
}

Definition at line 2069 of file sparc-tdep.c.

Referenced by _initialize_sparc_nat().

const struct sparc_gregmap sparc32_sunos4_gregmap
Initial value:
=
{
0 * 4,
1 * 4,
2 * 4,
3 * 4,
-1,
-1,
4 * 4,
-1
}

Definition at line 2057 of file sparc-tdep.c.

Referenced by _initialize_sparc_nat().