예제 #1
0
static void
sparc_write_pc (CORE_ADDR pc, ptid_t ptid)
{
  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);

  write_register_pid (tdep->pc_regnum, pc, ptid);
  write_register_pid (tdep->npc_regnum, pc + 4, ptid);
}
static void
amd64_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
{
  write_register_pid (AMD64_RIP_REGNUM, pc, ptid);

  /* We must be careful with modifying the program counter.  If we
     just interrupted a system call, the kernel might try to restart
     it when we resume the inferior.  On restarting the system call,
     the kernel will try backing up the program counter even though it
     no longer points at the system call.  This typically results in a
     SIGSEGV or SIGILL.  We can prevent this by writing `-1' in the
     "orig_rax" pseudo-register.

     Note that "orig_rax" is saved when setting up a dummy call frame.
     This means that it is properly restored when that frame is
     popped, and that the interrupted system call will be restarted
     when we resume the inferior on return from a function call from
     within GDB.  In all other cases the system call will not be
     restarted.  */
  write_register_pid (AMD64_LINUX_ORIG_RAX_REGNUM, -1, ptid);
}
예제 #3
0
static void
m88k_write_pc (CORE_ADDR pc, ptid_t ptid)
{
  /* According to the MC88100 RISC Microprocessor User's Manual,
     section 6.4.3.1.2:

     "... can be made to return to a particular instruction by placing
     a valid instruction address in the SNIP and the next sequential
     instruction address in the SFIP (with V bits set and E bits
     clear).  The rte resumes execution at the instruction pointed to
     by the SNIP, then the SFIP."

     The E bit is the least significant bit (bit 0).  The V (valid)
     bit is bit 1.  This is why we logical or 2 into the values we are
     writing below.  It turns out that SXIP plays no role when
     returning from an exception so nothing special has to be done
     with it.  We could even (presumably) give it a totally bogus
     value.  */

  write_register_pid (M88K_SXIP_REGNUM, pc, ptid);
  write_register_pid (M88K_SNIP_REGNUM, pc | 2, ptid);
  write_register_pid (M88K_SFIP_REGNUM, (pc + 4) | 2, ptid);
}
예제 #4
0
static void
mn10300_write_pc (CORE_ADDR val, ptid_t ptid)
{
  return write_register_pid (E_PC_REGNUM, val, ptid);
}