GDB (xrefs)
Defines | Functions | Variables
/home/stan/gdb/src/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 "gdb_assert.h"
#include "gdb_string.h"
#include "sparc-tdep.h"
#include "sparc-ravenscar-thread.h"

Go to the source code of this file.

Defines

#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 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)
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)
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 struct regsetsparc_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size)
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_gregset *gregset, struct regcache *regcache, int regnum, const void *gregs)
void sparc32_collect_gregset (const struct sparc_gregset *gregset, const struct regcache *regcache, int regnum, void *gregs)
void sparc32_supply_fpregset (const struct sparc_fpregset *fpregset, struct regcache *regcache, int regnum, const void *fpregs)
void sparc32_collect_fpregset (const struct sparc_fpregset *fpregset, 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 struct frame_unwind sparc32_frame_unwind
static struct frame_base sparc32_frame_base
struct sparc_gregset sparc32_sunos4_gregset
struct sparc_fpregset sparc32_sunos4_fpregset
struct sparc_fpregset sparc32_bsd_fpregset

Define Documentation

#define BIAS   2047

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

Referenced by sparc32_gdbarch_init().

Definition at line 296 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 284 of file sparc-tdep.c.

Referenced by sparc32_gdbarch_init(), and sparc32_register_name().

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

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

Referenced by sparc_analyze_control_transfer().

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

Definition at line 79 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 89 of file sparc-tdep.c.

Referenced by sparc_analyze_control_transfer().

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

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

Referenced by sparc_analyze_control_transfer().

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

Definition at line 87 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 81 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_RS1 (   i)    (((i) >> 14) & 0x1f)
#define X_RS2 (   i)    ((i) & 0x1f)

Definition at line 84 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  )
void sparc32_collect_fpregset ( const struct sparc_fpregset fpregset,
const struct regcache regcache,
int  regnum,
void *  fpregs 
)
void sparc32_collect_gregset ( const struct sparc_gregset gregset,
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 426 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 1220 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 
) [read]
static struct value* sparc32_frame_prev_register ( struct frame_info this_frame,
void **  this_cache,
int  regnum 
) [static, read]
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, read]

Definition at line 1615 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_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_regset_from_core_section(), 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_regset_from_core_section(), sparc_software_single_step(), SPARC_SP_REGNUM, sparc_step_trap(), sparc_unwind_pc(), sparc_write_pc(), gdbarch_tdep::step_trap, and XZALLOC.

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, read]
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_fpregset fpregset,
struct regcache regcache,
int  regnum,
const void *  fpregs 
)
void sparc32_supply_gregset ( const struct sparc_gregset gregset,
struct regcache regcache,
int  regnum,
const void *  gregs 
)
static struct sparc_frame_cache* sparc_alloc_frame_cache ( void  ) [static, read]
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 591 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, read]
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 
) [read]
static struct type* sparc_fsr_type ( struct gdbarch gdbarch) [static, read]
static int sparc_integral_or_pointer_p ( const struct type type) [static]
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 struct type* sparc_psr_type ( struct gdbarch gdbarch) [static, read]
void sparc_record_save_insn ( struct sparc_frame_cache cache)
static struct regset* sparc_regset_from_core_section ( struct gdbarch gdbarch,
const char *  sect_name,
size_t  sect_size 
) [static, read]
static CORE_ADDR sparc_skip_stack_check ( const CORE_ADDR  start_pc) [static]
static CORE_ADDR sparc_step_trap ( struct frame_info frame,
unsigned long  insn 
) [static]

Definition at line 1550 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

struct frame_base sparc32_frame_base [static]
Initial value:

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

Initial value:
{
  "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
  "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30"
}

Definition at line 289 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 268 of file sparc-tdep.c.

Referenced by sparc32_register_name().

Initial value:
{
  0 * 4,                        
  33 * 4,                       
}

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

Referenced by _initialize_sparc_nat().

Initial value:
{
  0 * 4,                        
  1 * 4,                        
  2 * 4,                        
  3 * 4,                        
  -1,                           
  -1,                           
  4 * 4,                        
  -1                            
}

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

Referenced by _initialize_sparc_nat().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines