コード例 #1
0
static ptid_t
hpux_thread_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
    ptid_t rtnval;
    struct cleanup *old_chain;

    old_chain = save_inferior_ptid ();

    inferior_ptid = main_ptid;

    if (!ptid_equal (ptid, minus_one_ptid))
        ptid = main_ptid;

    rtnval = deprecated_child_ops.to_wait (ptid, ourstatus);

    rtnval = find_active_thread ();

    do_cleanups (old_chain);

    return rtnval;
}
コード例 #2
0
ファイル: nbsd-thread.c プロジェクト: ryo/netbsd-src
static void
nbsd_thread_fetch_registers (struct target_ops *ops, struct regcache *cache,
    int regno)
{
  struct target_ops *beneath = find_target_beneath (ops);
  td_thread_t *thread;
  gregset_t gregs;
#ifdef HAVE_FPREGS
  fpregset_t fpregs;
#endif
  int val;
  struct cleanup *old_chain;

  old_chain = save_inferior_ptid ();

  if (!target_has_execution)
    {
      inferior_ptid = pid_to_ptid ((ptid_get_lwp (inferior_ptid) << 16) | 
				    ptid_get_pid (inferior_ptid));
    }
    beneath->to_fetch_registers (beneath, cache, regno);
  
  do_cleanups (old_chain);
}
コード例 #3
0
static void
hpux_thread_store_registers (struct regcache *regcache, int regno)
{
    cma__t_int_tcb tcb, *tcb_ptr;
    struct cleanup *old_chain;
    int i;
    int first_regno, last_regno;

    tcb_ptr = find_tcb (inferior_ptid);

    old_chain = save_inferior_ptid ();

    inferior_ptid = main_ptid;

    if (tcb_ptr->state == cma__c_state_running)
    {
        deprecated_child_ops.to_store_registers (regcache, regno);

        do_cleanups (old_chain);

        return;
    }

    if (regno == -1)
    {
        first_regno = 0;
        last_regno = gdbarch_num_regs (current_gdbarch) - 1;
    }
    else
    {
        first_regno = regno;
        last_regno = regno;
    }

    for (regno = first_regno; regno <= last_regno; regno++)
    {
        if (regmap[regno] == -1)
            deprecated_child_ops.to_store_registers (regcache, regno);
        else
        {
            unsigned char buf[MAX_REGISTER_SIZE];
            CORE_ADDR sp;

            sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;

            if (regno == HPPA_FLAGS_REGNUM)
                deprecated_child_ops.to_store_registers (regcache, regno);	/* Let lower layer handle this... */
            else if (regno == HPPA_SP_REGNUM)
            {
                regcache_raw_collect (regcache, regno, buf);
                write_memory ((CORE_ADDR) &tcb_ptr->static_ctx.sp, buf,
                              register_size (current_gdbarch, regno));
                tcb_ptr->static_ctx.sp
                    = (cma__t_hppa_regs *) ((CORE_ADDR) buf + 160);
            }
            else if (regno == HPPA_PCOQ_HEAD_REGNUM)
            {
                regcache_raw_collect (regcache, regno, buf);
                write_memory (sp - 20, buf,
                              register_size (current_gdbarch, regno));
            }
            else
            {
                regcache_raw_collect (regcache, regno, buf);
                write_memory (sp + regmap[regno], buf,
                              register_size (current_gdbarch, regno));
            }
        }
    }

    do_cleanups (old_chain);
}
コード例 #4
0
static void
hpux_thread_fetch_registers (struct regcache *regcache, int regno)
{
    cma__t_int_tcb tcb, *tcb_ptr;
    struct cleanup *old_chain;
    int i;
    int first_regno, last_regno;

    tcb_ptr = find_tcb (inferior_ptid);

    old_chain = save_inferior_ptid ();

    inferior_ptid = main_ptid;

    if (tcb_ptr->state == cma__c_state_running)
    {
        deprecated_child_ops.to_fetch_registers (regcache, regno);

        do_cleanups (old_chain);

        return;
    }

    if (regno == -1)
    {
        first_regno = 0;
        last_regno = gdbarch_num_regs (current_gdbarch) - 1;
    }
    else
    {
        first_regno = regno;
        last_regno = regno;
    }

    for (regno = first_regno; regno <= last_regno; regno++)
    {
        if (regmap[regno] == -1)
            deprecated_child_ops.to_fetch_registers (regcache, regno);
        else
        {
            unsigned char buf[MAX_REGISTER_SIZE];
            CORE_ADDR sp;

            sp = (CORE_ADDR) tcb_ptr->static_ctx.sp - 160;

            if (regno == HPPA_FLAGS_REGNUM)
                /* Flags must be 0 to avoid bogus value for SS_INSYSCALL */
                memset (buf, '\000', register_size (current_gdbarch, regno));
            else if (regno == HPPA_SP_REGNUM)
                store_unsigned_integer (buf, sizeof sp, sp);
            else if (regno == HPPA_PCOQ_HEAD_REGNUM)
                read_memory (sp - 20, buf, register_size (current_gdbarch, regno));
            else
                read_memory (sp + regmap[regno], buf, register_size (current_gdbarch, regno));

            regcache_raw_supply (regcache, regno, buf);
        }
    }

    do_cleanups (old_chain);
}
コード例 #5
0
static ps_err_e
rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
	   char *buf, int size)
{
  struct cleanup *old_chain;

  old_chain = save_inferior_ptid ();

  if (is_thread (inferior_ptid) ||	/* A thread */
      !target_thread_alive (inferior_ptid))	/* An lwp, but not alive */
    inferior_ptid = procfs_first_available ();	/* Find any live lwp.  */
  /* Note: don't need to call switch_to_thread; we're just reading memory.  */

#if defined (__sparcv9)
  /* For Sparc64 cross Sparc32, make sure the address has not been
     accidentally sign-extended (or whatever) to beyond 32 bits.  */
  if (bfd_get_arch_size (exec_bfd) == 32)
    addr &= 0xffffffff;
#endif

  while (size > 0)
    {
      int cc;

      /* FIXME: passing 0 as attrib argument.  */
      if (target_has_execution)
	cc = procfs_ops.to_xfer_memory (addr, buf, size,
					dowrite, 0, &procfs_ops);
      else
	cc = orig_core_ops.to_xfer_memory (addr, buf, size,
					   dowrite, 0, &core_ops);

      if (cc < 0)
	{
	  if (dowrite == 0)
	    print_sys_errmsg ("rw_common (): read", errno);
	  else
	    print_sys_errmsg ("rw_common (): write", errno);

	  do_cleanups (old_chain);

	  return PS_ERR;
	}
      else if (cc == 0)
	{
	  if (dowrite == 0)
	    warning ("rw_common (): unable to read at addr 0x%lx",
		     (long) addr);
	  else
	    warning ("rw_common (): unable to write at addr 0x%lx",
		     (long) addr);

	  do_cleanups (old_chain);

	  return PS_ERR;
	}

      size -= cc;
      buf += cc;
    }

  do_cleanups (old_chain);

  return PS_OK;
}