本文整理汇总了C++中regcache_cooked_read_unsigned函数的典型用法代码示例。如果您正苦于以下问题:C++ regcache_cooked_read_unsigned函数的具体用法?C++ regcache_cooked_read_unsigned怎么用?C++ regcache_cooked_read_unsigned使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了regcache_cooked_read_unsigned函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lm32_extract_return_value
static void
lm32_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int offset;
ULONGEST l;
CORE_ADDR return_buffer;
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_UNION
&& TYPE_CODE (type) != TYPE_CODE_ARRAY && TYPE_LENGTH (type) <= 4)
{
/* Return value is returned in a single register. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, l);
}
else if ((TYPE_CODE (type) == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8))
{
/* 64-bit values are returned in a register pair. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
memcpy (valbuf, &l, 4);
regcache_cooked_read_unsigned (regcache, SIM_LM32_R2_REGNUM, &l);
memcpy (valbuf + 4, &l, 4);
}
else
{
/* Aggregate types greater than a single register are returned in memory.
FIXME: Unless they are only 2 regs?. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
return_buffer = l;
read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
}
}
示例2: frv_fdpic_loadmap_addresses
/* Fetch the interpreter and executable loadmap addresses (for shared
library support) for the FDPIC ABI. Return 0 if successful, -1 if
not. (E.g, -1 will be returned if the ABI isn't the FDPIC ABI.) */
int
frv_fdpic_loadmap_addresses (struct gdbarch *gdbarch, CORE_ADDR *interp_addr,
CORE_ADDR *exec_addr)
{
if (frv_abi (gdbarch) != FRV_ABI_FDPIC)
return -1;
else
{
struct regcache *regcache = get_current_regcache ();
if (interp_addr != NULL)
{
ULONGEST val;
regcache_cooked_read_unsigned (regcache,
fdpic_loadmap_interp_regnum, &val);
*interp_addr = val;
}
if (exec_addr != NULL)
{
ULONGEST val;
regcache_cooked_read_unsigned (regcache,
fdpic_loadmap_exec_regnum, &val);
*exec_addr = val;
}
return 0;
}
}
示例3: arm_linux_cleanup_svc
static void
arm_linux_cleanup_svc (struct gdbarch *gdbarch,
struct regcache *regs,
struct displaced_step_closure *dsc)
{
CORE_ADDR from = dsc->insn_addr;
ULONGEST apparent_pc;
int within_scratch;
regcache_cooked_read_unsigned (regs, ARM_PC_REGNUM, &apparent_pc);
within_scratch = (apparent_pc >= dsc->scratch_base
&& apparent_pc < (dsc->scratch_base
+ DISPLACED_MODIFIED_INSNS * 4 + 4));
if (debug_displaced)
{
fprintf_unfiltered (gdb_stdlog, "displaced: PC is apparently %.8lx after "
"SVC step ", (unsigned long) apparent_pc);
if (within_scratch)
fprintf_unfiltered (gdb_stdlog, "(within scratch space)\n");
else
fprintf_unfiltered (gdb_stdlog, "(outside scratch space)\n");
}
if (within_scratch)
displaced_write_reg (regs, dsc, ARM_PC_REGNUM, from + 4, BRANCH_WRITE_PC);
}
示例4: d10v_ts3_imap_register
static unsigned long
d10v_ts3_imap_register (void *regcache, int reg_nr)
{
ULONGEST reg;
regcache_cooked_read_unsigned (regcache, TS3_IMAP0_REGNUM + reg_nr, ®);
return reg;
}
示例5: sparc_ravenscar_store_registers
static void
sparc_ravenscar_store_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int buf_size = register_size (gdbarch, regnum);
char buf [buf_size];
ULONGEST register_address;
if (register_in_thread_descriptor_p (regnum))
register_address =
ptid_get_tid (inferior_ptid) + sparc_register_offsets [regnum];
else if (register_on_stack_p (regnum))
{
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM,
®ister_address);
register_address += sparc_register_offsets [regnum];
}
else
return;
regcache_raw_collect (regcache, regnum, buf);
write_memory (register_address,
buf,
buf_size);
}
示例6: hppa_hpux_save_state_offset
LONGEST
hppa_hpux_save_state_offset (struct regcache *regcache, int regnum)
{
LONGEST offset;
if (regnum == HPPA_FLAGS_REGNUM)
return ssoff (ss_flags);
if (HPPA_R0_REGNUM < regnum && regnum < HPPA_FP0_REGNUM)
{
struct gdbarch *arch = get_regcache_arch (regcache);
size_t size = register_size (arch, HPPA_R1_REGNUM);
ULONGEST flags;
gdb_assert (size == 4 || size == 8);
regcache_cooked_read_unsigned (regcache, HPPA_FLAGS_REGNUM, &flags);
if (flags & SS_WIDEREGS)
offset = ssoff (ss_wide) + (8 - size) + (regnum - HPPA_R0_REGNUM) * 8;
else
offset = ssoff (ss_narrow) + (regnum - HPPA_R1_REGNUM) * 4;
}
else
{
struct gdbarch *arch = get_regcache_arch (regcache);
size_t size = register_size (arch, HPPA_FP0_REGNUM);
gdb_assert (size == 4 || size == 8);
gdb_assert (regnum >= HPPA_FP0_REGNUM);
offset = ssoff(ss_fpblock) + (regnum - HPPA_FP0_REGNUM) * size;
}
gdb_assert (offset < sizeof (save_state_t));
return offset;
}
示例7: sparc32_return_value
static enum return_value_convention
sparc32_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, gdb_byte *readbuf,
const gdb_byte *writebuf)
{
/* The psABI says that "...every stack frame reserves the word at
%fp+64. If a function returns a structure, union, or
quad-precision value, this word should hold the address of the
object into which the return value should be copied." This
guarantees that we can always find the return value, not just
before the function returns. */
if (sparc_structure_or_union_p (type)
|| (sparc_floating_p (type) && TYPE_LENGTH (type) == 16))
{
if (readbuf)
{
ULONGEST sp;
CORE_ADDR addr;
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
addr = read_memory_unsigned_integer (sp + 64, 4);
read_memory (addr, readbuf, TYPE_LENGTH (type));
}
return RETURN_VALUE_ABI_PRESERVES_ADDRESS;
}
if (readbuf)
sparc32_extract_return_value (type, regcache, readbuf);
if (writebuf)
sparc32_store_return_value (type, regcache, writebuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
示例8: arm_linux_get_syscall_number
static LONGEST
arm_linux_get_syscall_number (struct gdbarch *gdbarch,
ptid_t ptid)
{
struct regcache *regs = get_thread_regcache (ptid);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ULONGEST pc;
ULONGEST cpsr;
ULONGEST t_bit = arm_psr_thumb_bit (gdbarch);
int is_thumb;
ULONGEST svc_number = -1;
regcache_cooked_read_unsigned (regs, ARM_PC_REGNUM, &pc);
regcache_cooked_read_unsigned (regs, ARM_PS_REGNUM, &cpsr);
is_thumb = (cpsr & t_bit) != 0;
if (is_thumb)
{
regcache_cooked_read_unsigned (regs, 7, &svc_number);
}
else
{
enum bfd_endian byte_order_for_code =
gdbarch_byte_order_for_code (gdbarch);
/* PC gets incremented before the syscall-stop, so read the
previous instruction. */
unsigned long this_instr =
read_memory_unsigned_integer (pc - 4, 4, byte_order_for_code);
unsigned long svc_operand = (0x00ffffff & this_instr);
if (svc_operand)
{
/* OABI */
svc_number = svc_operand - 0x900000;
}
else
{
/* EABI */
regcache_cooked_read_unsigned (regs, 7, &svc_number);
}
}
return svc_number;
}
示例9: moxie_read_pc
static CORE_ADDR
moxie_read_pc (struct regcache *regcache)
{
ULONGEST pc;
regcache_cooked_read_unsigned (regcache, MOXIE_PC_REGNUM, &pc);
return pc;
}
示例10: sparc32_extract_struct_value_address
static CORE_ADDR
sparc32_extract_struct_value_address (struct regcache *regcache)
{
ULONGEST sp;
regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
return read_memory_unsigned_integer (sp + 64, 4);
}
示例11: sparc_address_from_register
CORE_ADDR
sparc_address_from_register (int regnum)
{
ULONGEST addr;
regcache_cooked_read_unsigned (current_regcache, regnum, &addr);
return addr;
}
示例12: ft32_read_pc
static CORE_ADDR
ft32_read_pc (struct regcache *regcache)
{
ULONGEST pc;
regcache_cooked_read_unsigned (regcache, FT32_PC_REGNUM, &pc);
return pc;
}
示例13: moxie_extract_return_value
static void
moxie_extract_return_value (struct type *type, struct regcache *regcache,
void *dst)
{
bfd_byte *valbuf = dst;
int len = TYPE_LENGTH (type);
ULONGEST tmp;
/* By using store_unsigned_integer we avoid having to do
anything special for small big-endian values. */
regcache_cooked_read_unsigned (regcache, RET1_REGNUM, &tmp);
store_unsigned_integer (valbuf, (len > 4 ? len - 4 : len), tmp);
/* Ignore return values more than 8 bytes in size because the moxie
returns anything more than 8 bytes in the stack. */
if (len > 4)
{
regcache_cooked_read_unsigned (regcache, RET1_REGNUM + 1, &tmp);
store_unsigned_integer (valbuf + len - 4, 4, tmp);
}
}
示例14: parse_spufs_run
/* If the PPU thread is currently stopped on a spu_run system call,
return to FD and ADDR the file handle and NPC parameter address
used with the system call. Return non-zero if successful. */
static int
parse_spufs_run (ptid_t ptid, int *fd, CORE_ADDR *addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
struct gdbarch_tdep *tdep;
struct regcache *regcache;
gdb_byte buf[4];
#ifdef ALLOW_UNUSED_VARIABLES
CORE_ADDR pc;
#endif /* ALLOW_UNUSED_VARIABLES */
ULONGEST regval;
/* If we're not on PPU, there's nothing to detect. */
if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_powerpc)
return 0;
/* Get PPU-side registers. */
regcache = get_thread_arch_regcache (ptid, target_gdbarch);
tdep = new_gdbarch_tdep(target_gdbarch);
/* Fetch instruction preceding current NIP. */
if (target_read_memory (regcache_read_pc (regcache) - 4, buf, 4) != 0)
return 0;
/* It should be a "sc" instruction. */
if (extract_unsigned_integer_with_byte_order(buf, 4, byte_order) != INSTR_SC)
return 0;
/* System call number should be NR_spu_run. */
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum, ®val);
if (regval != NR_spu_run)
return 0;
/* Register 3 contains fd, register 4 the NPC param pointer. */
regcache_cooked_read_unsigned (regcache, PPC_ORIG_R3_REGNUM, ®val);
*fd = (int) regval;
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 4, ®val);
*addr = (CORE_ADDR) regval;
return 1;
}
示例15: enable_watchpoints_in_psr
static void
enable_watchpoints_in_psr (ptid_t ptid)
{
struct regcache *regcache = get_thread_regcache (ptid);
ULONGEST psr;
regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);
if (!(psr & IA64_PSR_DB))
{
psr |= IA64_PSR_DB; /* Set the db bit - this enables hardware
watchpoints and breakpoints. */
regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr);
}
}