GDB (xrefs)

Macros | Functions | Variables
/tmp/gdb-8.1/gdb/microblaze-tdep.c File Reference
`#include "defs.h"`
`#include "arch-utils.h"`
`#include "dis-asm.h"`
`#include "frame.h"`
`#include "trad-frame.h"`
`#include "symtab.h"`
`#include "value.h"`
`#include "gdbcmd.h"`
`#include "breakpoint.h"`
`#include "inferior.h"`
`#include "regcache.h"`
`#include "target.h"`
`#include "frame-base.h"`
`#include "frame-unwind.h"`
`#include "dwarf2-frame.h"`
`#include "osabi.h"`
`#include "target-descriptions.h"`
`#include "opcodes/microblaze-opcm.h"`
`#include "opcodes/microblaze-dis.h"`
`#include "microblaze-tdep.h"`
`#include "remote.h"`
`#include "features/microblaze-with-stack-protect.c"`
`#include "features/microblaze.c"`

Go to the source code of this file.

## Macros
#define | IS_RETURN(op) (op == rtsd || op == rtid)
#define | IS_UPDATE_SP(op, rd, ra) ((op == addik || op == addi) && rd == REG_SP && ra == REG_SP)
#define | IS_SPILL_SP(op, rd, ra) ((op == swi || op == sw) && rd == REG_SP && ra == REG_SP)
#define | IS_SPILL_REG(op, rd, ra) ((op == swi || op == sw) && rd != REG_SP && ra == REG_SP)
#define | IS_ALSO_SPILL_REG(op, rd, ra, rb) ((op == swi || op == sw) && rd != REG_SP && ra == 0 && rb == REG_SP)
#define | IS_SETUP_FP(op, ra, rb) ((op == add || op == addik || op == addk) && ra == REG_SP && rb == 0)
#define | IS_SPILL_REG_FP(op, rd, ra, fpregnum) ((op == swi || op == sw) && rd != REG_SP && ra == fpregnum && ra != 0)
#define | IS_SAVE_HIDDEN_PTR(op, rd, ra, rb) ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)
#define | MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
#define | MICROBLAZE_MY_FRAME_IN_SP 0x1
#define | MICROBLAZE_MY_FRAME_IN_FP 0x2

## Functions
static void | ATTRIBUTE_PRINTF (1, 2)
static const char * | microblaze_register_name (struct gdbarch *gdbarch, int regnum)
static struct type * | microblaze_register_type (struct gdbarch *gdbarch, int regnum)
static unsigned long | microblaze_fetch_instruction (CORE_ADDR pc)
typedef | BP_MANIPULATION (microblaze_break_insn)
static CORE_ADDR | microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR current_pc, struct microblaze_frame_cache *cache)
static CORE_ADDR | microblaze_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
static CORE_ADDR | microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
static struct microblaze_frame_cache * | microblaze_frame_cache (struct frame_info *next_frame, void **this_cache)
static void | microblaze_frame_this_id (struct frame_info *next_frame, void **this_cache, struct frame_id *this_id)
static struct value * | microblaze_frame_prev_register (struct frame_info *this_frame, void **this_cache, int regnum)
static CORE_ADDR | microblaze_frame_base_address (struct frame_info *next_frame, void **this_cache)
static void | microblaze_extract_return_value (struct type *type, struct regcache *regcache, gdb_byte *valbuf)
static void | microblaze_store_return_value (struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
static enum return_value_convention | microblaze_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static int | microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
static void | microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
static int | microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
static void | microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
static struct gdbarch * | microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
void | _initialize_microblaze_tdep (void)

## Variables
static const char * | microblaze_register_names []
static unsigned int | microblaze_debug_flag = 0
constexpr gdb_byte | microblaze_break_insn [] = MICROBLAZE_BREAKPOINT
static const struct frame_unwind | microblaze_frame_unwind
static const struct frame_base | microblaze_frame_base
static int | dwarf2_to_reg_map [78]

## Macro Definition Documentation

## ◆ IS_ALSO_SPILL_REG

#define IS_ALSO_SPILL_REG | ( |  | op,
|  |  | rd,
|  |  | ra,
|  |  | rb
| ) |  | ((op == swi || op == sw) && rd != REG_SP && ra == 0 && rb == REG_SP)

Definition at line 57 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ IS_RETURN

#define IS_RETURN | ( |  | op | ) | (op == rtsd || op == rtid)

Definition at line 50 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ IS_SAVE_HIDDEN_PTR

#define IS_SAVE_HIDDEN_PTR | ( |  | op,
|  |  | rd,
|  |  | ra,
|  |  | rb
| ) |  | ((op == add || op == addik) && ra == MICROBLAZE_FIRST_ARGREG && rb == 0)

Definition at line 63 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ IS_SETUP_FP

#define IS_SETUP_FP | ( |  | op,
|  |  | ra,
|  |  | rb
| ) |  | ((op == add || op == addik || op == addk) && ra == REG_SP && rb == 0)

Definition at line 59 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ IS_SPILL_REG

#define IS_SPILL_REG | ( |  | op,
|  |  | rd,
|  |  | ra
| ) |  | ((op == swi || op == sw) && rd != REG_SP && ra == REG_SP)

Definition at line 55 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ IS_SPILL_REG_FP

#define IS_SPILL_REG_FP | ( |  | op,
|  |  | rd,
|  |  | ra,
|  |  | fpregnum
| ) |  | ((op == swi || op == sw) && rd != REG_SP && ra == fpregnum && ra != 0)

Definition at line 61 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ IS_SPILL_SP

#define IS_SPILL_SP | ( |  | op,
|  |  | rd,
|  |  | ra
| ) |  | ((op == swi || op == sw) && rd == REG_SP && ra == REG_SP)

Definition at line 53 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ IS_UPDATE_SP

#define IS_UPDATE_SP | ( |  | op,
|  |  | rd,
|  |  | ra
| ) |  | ((op == addik || op == addi) && rd == REG_SP && ra == REG_SP)

Definition at line 51 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ MICROBLAZE_MY_FRAME_IN_FP

#define MICROBLAZE_MY_FRAME_IN_FP 0x2

Definition at line 174 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ MICROBLAZE_MY_FRAME_IN_SP

#define MICROBLAZE_MY_FRAME_IN_SP 0x1

Definition at line 167 of file microblaze-tdep.c.

Referenced by microblaze_analyze_prologue().

## ◆ MICROBLAZE_NUM_REGS

#define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)

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

Referenced by microblaze_gdbarch_init(), microblaze_register_g_packet_guesses(), and microblaze_register_name().

## Function Documentation

## ◆ _initialize_microblaze_tdep()

void _initialize_microblaze_tdep | ( | void |  | ) |

Definition at line 763 of file microblaze-tdep.c.

References _, add_setshow_zuinteger_cmd(), class_maintenance, initialize_tdesc_microblaze(), initialize_tdesc_microblaze_with_stack_protect(), microblaze_debug_flag, microblaze_gdbarch_init(), register_gdbarch_init(), setdebuglist, and showdebuglist.

## ◆ ATTRIBUTE_PRINTF()

static void ATTRIBUTE_PRINTF | ( | 1 | ,
|  | 2 |
| ) |  |
| static

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

References microblaze_debug_flag, printf_unfiltered(), and vprintf_unfiltered().

## ◆ BP_MANIPULATION()

typedef BP_MANIPULATION | ( | microblaze_break_insn |  | ) |

Definition at line 139 of file microblaze-tdep.c.

References microblaze_frame_cache::base, FRAME_OBSTACK_ZALLOC, microblaze_frame_cache::frameless_p, and microblaze_frame_cache::pc.

## ◆ microblaze_analyze_prologue()

static CORE_ADDR microblaze_analyze_prologue | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | pc,
|  | CORE_ADDR | current_pc,
|  | struct microblaze_frame_cache * | cache
| ) |  |
| static

Definition at line 198 of file microblaze-tdep.c.

References find_pc_partial_function(), flags, microblaze_frame_cache::fp_regnum, microblaze_frame_cache::frameless_p, microblaze_frame_cache::framesize, INST_WORD_SIZE, IS_ALSO_SPILL_REG, IS_RETURN, IS_SAVE_HIDDEN_PTR, IS_SETUP_FP, IS_SPILL_REG, IS_SPILL_REG_FP, IS_SPILL_SP, IS_UPDATE_SP, microblaze_fetch_instruction(), MICROBLAZE_MY_FRAME_IN_FP, MICROBLAZE_MY_FRAME_IN_SP, MICROBLAZE_SP_REGNUM, name, paddress(), microblaze_frame_cache::pc, and microblaze_frame_cache::register_offsets.

Referenced by microblaze_skip_prologue().

## ◆ microblaze_dwarf2_reg_to_regnum()

static int microblaze_dwarf2_reg_to_regnum | ( | struct gdbarch * | gdbarch,
|  | int | reg
| ) |  |
| static

Definition at line 634 of file microblaze-tdep.c.

References dwarf2_to_reg_map.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_extract_return_value()

static void microblaze_extract_return_value | ( | struct type * | type,
|  | struct regcache * | regcache,
|  | gdb_byte * | valbuf
| ) |  |
| static

Definition at line 523 of file microblaze-tdep.c.

References _, internal_error(), MICROBLAZE_REGISTER_SIZE, MICROBLAZE_RETVAL_REGNUM, regcache_cooked_read(), and TYPE_LENGTH.

Referenced by microblaze_return_value().

## ◆ microblaze_fetch_instruction()

static unsigned long microblaze_fetch_instruction | ( | CORE_ADDR | pc | ) |
| static

Definition at line 125 of file microblaze-tdep.c.

References extract_unsigned_integer(), gdbarch_byte_order(), target_gdbarch(), and target_read_code().

Referenced by microblaze_analyze_prologue().

## ◆ microblaze_frame_base_address()

static CORE_ADDR microblaze_frame_base_address | ( | struct frame_info * | next_frame,
|  | void ** | this_cache
| ) |  |
| static

Definition at line 503 of file microblaze-tdep.c.

References microblaze_frame_cache::base, and microblaze_frame_cache().

## ◆ microblaze_frame_cache()

static struct microblaze_frame_cache* microblaze_frame_cache | ( | struct frame_info * | next_frame,
|  | void ** | this_cache
| ) |  |
| static

Definition at line 431 of file microblaze-tdep.c.

References gdbarch_num_regs(), get_frame_address_in_block(), get_frame_arch(), get_frame_func(), microblaze_frame_cache::pc, microblaze_frame_cache::register_offsets, microblaze_frame_cache::saved_regs, and trad_frame_alloc_saved_regs().

Referenced by microblaze_frame_base_address(), microblaze_frame_prev_register(), and microblaze_frame_this_id().

## ◆ microblaze_frame_prev_register()

static struct value* microblaze_frame_prev_register | ( | struct frame_info * | this_frame,
|  | void ** | this_cache,
|  | int | regnum
| ) |  |
| static

Definition at line 471 of file microblaze-tdep.c.

References microblaze_frame_cache::frameless_p, microblaze_frame_cache(), MICROBLAZE_PC_REGNUM, MICROBLAZE_SP_REGNUM, regnum, microblaze_frame_cache::saved_regs, and trad_frame_get_prev_register().

## ◆ microblaze_frame_this_id()

static void microblaze_frame_this_id | ( | struct frame_info * | next_frame,
|  | void ** | this_cache,
|  | struct frame_id * | this_id
| ) |  |
| static

Definition at line 457 of file microblaze-tdep.c.

References microblaze_frame_cache::base, frame_id_build(), microblaze_frame_cache(), and microblaze_frame_cache::pc.

## ◆ microblaze_gdbarch_init()

static struct gdbarch* microblaze_gdbarch_init | ( | struct gdbarch_info | info,
|  | struct gdbarch_list * | arches
| ) |  |
| static

Definition at line 654 of file microblaze-tdep.c.

References core_addr_lessthan(), dwarf2_append_unwinders(), dwarf2_frame_base_sniffer(), frame_base_append_sniffer(), frame_base_set_default(), frame_unwind_append_unwinder(), gdbarch_list::gdbarch, gdbarch_alloc(), gdbarch_init_osabi(), gdbarch_list_lookup_by_info(), microblaze_dwarf2_reg_to_regnum(), microblaze_frame_base, microblaze_frame_unwind, MICROBLAZE_NUM_CORE_REGS, MICROBLAZE_NUM_REGS, MICROBLAZE_PC_REGNUM, microblaze_register_g_packet_guesses(), microblaze_register_name(), microblaze_register_names, microblaze_register_type(), microblaze_return_value(), MICROBLAZE_SHR_REGNUM, microblaze_skip_prologue(), MICROBLAZE_SLR_REGNUM, MICROBLAZE_SP_REGNUM, microblaze_stabs_argument_has_addr(), microblaze_unwind_pc(), microblaze_write_pc(), ON_STACK, set_gdbarch_breakpoint_kind_from_pc(), set_gdbarch_call_dummy_location(), set_gdbarch_dwarf2_reg_to_regnum(), set_gdbarch_frame_args_skip(), set_gdbarch_inner_than(), set_gdbarch_long_double_bit(), set_gdbarch_num_regs(), set_gdbarch_pc_regnum(), set_gdbarch_register_name(), set_gdbarch_register_type(), set_gdbarch_return_value(), set_gdbarch_skip_prologue(), set_gdbarch_sp_regnum(), set_gdbarch_stabs_argument_has_addr(), set_gdbarch_sw_breakpoint_from_kind(), set_gdbarch_unwind_pc(), set_gdbarch_write_pc(), gdbarch_info::target_desc, tdesc_data, tdesc_data_alloc(), tdesc_data_cleanup(), tdesc_find_feature(), tdesc_has_registers(), tdesc_microblaze, tdesc_numbered_register(), tdesc_use_registers(), and XCNEW.

Referenced by _initialize_microblaze_tdep().

## ◆ microblaze_register_g_packet_guesses()

static void microblaze_register_g_packet_guesses | ( | struct gdbarch * | gdbarch | ) |
| static

Definition at line 642 of file microblaze-tdep.c.

References MICROBLAZE_NUM_CORE_REGS, MICROBLAZE_NUM_REGS, register_remote_g_packet_guess(), tdesc_microblaze, and tdesc_microblaze_with_stack_protect.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_register_name()

static const char* microblaze_register_name | ( | struct gdbarch * | gdbarch,
|  | int | regnum
| ) |  |
| static

Definition at line 102 of file microblaze-tdep.c.

References MICROBLAZE_NUM_REGS, microblaze_register_names, and regnum.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_register_type()

static struct type* microblaze_register_type | ( | struct gdbarch * | gdbarch,
|  | int | regnum
| ) |  |
| static

Definition at line 110 of file microblaze-tdep.c.

References builtin_type::builtin_data_ptr, builtin_type::builtin_func_ptr, builtin_type::builtin_int, builtin_type(), MICROBLAZE_PC_REGNUM, MICROBLAZE_SP_REGNUM, and regnum.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_return_value()

static enum return_value_convention microblaze_return_value | ( | struct gdbarch * | gdbarch,
|  | struct value * | function,
|  | struct type * | type,
|  | struct regcache * | regcache,
|  | gdb_byte * | readbuf,
|  | const gdb_byte * | writebuf
| ) |  |
| static

Definition at line 586 of file microblaze-tdep.c.

References microblaze_extract_return_value(), microblaze_store_return_value(), and RETURN_VALUE_REGISTER_CONVENTION.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_skip_prologue()

static CORE_ADDR microblaze_skip_prologue | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | start_pc
| ) |  |
| static

Definition at line 401 of file microblaze-tdep.c.

References symtab_and_line::end, find_pc_line(), find_pc_partial_function(), and microblaze_analyze_prologue().

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_stabs_argument_has_addr()

static int microblaze_stabs_argument_has_addr | ( | struct gdbarch * | gdbarch,
|  | struct type * | type
| ) |  |
| static

Definition at line 599 of file microblaze-tdep.c.

References TYPE_LENGTH.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_store_return_value()

static void microblaze_store_return_value | ( | struct type * | type,
|  | struct regcache * | regcache,
|  | const gdb_byte * | valbuf
| ) |  |
| static

Definition at line 562 of file microblaze-tdep.c.

References gdb_assert, memset(), MICROBLAZE_RETVAL_REGNUM, regcache_cooked_write(), and TYPE_LENGTH.

Referenced by microblaze_return_value().

## ◆ microblaze_unwind_pc()

static CORE_ADDR microblaze_unwind_pc | ( | struct gdbarch * | gdbarch,
|  | struct frame_info * | next_frame
| ) |  |
| static

Definition at line 382 of file microblaze-tdep.c.

References extract_typed_address(), frame_relative_level(), frame_unwind_register(), MICROBLAZE_PC_REGNUM, and microblaze_frame_cache::pc.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_write_pc()

static void microblaze_write_pc | ( | struct regcache * | regcache,
|  | CORE_ADDR | pc
| ) |  |
| static

Definition at line 605 of file microblaze-tdep.c.

References MICROBLAZE_PC_REGNUM, and regcache_cooked_write_unsigned().

Referenced by microblaze_gdbarch_init().

## Variable Documentation

## ◆ dwarf2_to_reg_map

int dwarf2_to_reg_map[78]
| static

Initial value:
=
{ 0 , 1 , 2 , 3 ,
4 , 5 , 6 , 7 ,
8 , 9 , 10 , 11 ,
12 , 13 , 14 , 15 ,
16 , 17 , 18 , 19 ,
20 , 21 , 22 , 23 ,
24 , 25 , 26 , 27 ,
28 , 29 , 30 , 31 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , 33 ,
-1 , -1 , -1 , -1 ,
-1 , -1 , -1 , -1 ,
-1 , -1
}

Definition at line 610 of file microblaze-tdep.c.

Referenced by microblaze_dwarf2_reg_to_regnum().

## ◆ microblaze_break_insn

constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT

Definition at line 137 of file microblaze-tdep.c.

## ◆ microblaze_debug_flag

unsigned int microblaze_debug_flag = 0
| static

Definition at line 83 of file microblaze-tdep.c.

Referenced by _initialize_microblaze_tdep(), and ATTRIBUTE_PRINTF().

## ◆ microblaze_frame_base

const struct frame_base microblaze_frame_base
| static

Initial value:
=
{
&microblaze_frame_unwind,
microblaze_frame_base_address,
microblaze_frame_base_address,
microblaze_frame_base_address
}
microblaze_frame_base_address
static CORE_ADDR microblaze_frame_base_address(struct frame_info *next_frame, void **this_cache)
Definition: microblaze-tdep.c:503
microblaze_frame_unwind
static const struct frame_unwind microblaze_frame_unwind
Definition: microblaze-tdep.c:492

Definition at line 512 of file microblaze-tdep.c.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_frame_unwind

const struct frame_unwind microblaze_frame_unwind
| static

Initial value:
=
{
NORMAL_FRAME,
default_frame_unwind_stop_reason,
microblaze_frame_this_id,
microblaze_frame_prev_register,
NULL,
default_frame_sniffer
}
microblaze_frame_this_id
static void microblaze_frame_this_id(struct frame_info *next_frame, void **this_cache, struct frame_id *this_id)
Definition: microblaze-tdep.c:457
NORMAL_FRAME
Definition: frame.h:244
default_frame_sniffer
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
Definition: frame-unwind.c:174
microblaze_frame_prev_register
static struct value * microblaze_frame_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
Definition: microblaze-tdep.c:471
default_frame_unwind_stop_reason
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
Definition: frame-unwind.c:184

Definition at line 492 of file microblaze-tdep.c.

Referenced by microblaze_gdbarch_init().

## ◆ microblaze_register_names

const char* microblaze_register_names[]
| static

Initial value:
=
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
"rpc", "rmsr", "rear", "resr", "rfsr", "rbtr",
"rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
"rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
"redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
"rslr", "rshr"
}

Definition at line 68 of file microblaze-tdep.c.

Referenced by microblaze_gdbarch_init(), and microblaze_register_name().