当前位置: 首页>>代码示例>>C++>>正文


C++ PIDGET函数代码示例

本文整理汇总了C++中PIDGET函数的典型用法代码示例。如果您正苦于以下问题:C++ PIDGET函数的具体用法?C++ PIDGET怎么用?C++ PIDGET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PIDGET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: store_register

static void
store_register (const struct regcache *regcache, int regno)
{
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  long regaddr, val;
  int i;
  int tid;
  char buf[MAX_REGISTER_SIZE];

  /* Overload thread id onto process id.  */
  tid = TIDGET (inferior_ptid);
  if (tid == 0)
    tid = PIDGET (inferior_ptid);	/* no thread id, just use
					   process id.  */

  regaddr = 4 * regmap[regno];

  /* Put the contents of regno into a local buffer.  */
  regcache_raw_collect (regcache, regno, buf);

  /* Store the local buffer into the inferior a chunk at the time.  */
  for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
    {
      errno = 0;
      memcpy (&val, &buf[i], sizeof (long));
      ptrace (PTRACE_POKEUSER, tid, regaddr, val);
      regaddr += sizeof (long);
      if (errno != 0)
	error (_("Couldn't write register %s (#%d): %s."),
	       gdbarch_register_name (gdbarch, regno),
	       regno, safe_strerror (errno));
    }
}
开发者ID:ArmstrongJ,项目名称:insight-debugger,代码行数:33,代码来源:m68klinux-nat.c

示例2: thread_to_lwp

static ptid_t
thread_to_lwp (ptid_t thread_id, int default_lwp)
{
  td_thrinfo_t ti;
  td_thrhandle_t th;
  td_err_e val;

  if (is_lwp (thread_id))
    return thread_id;		/* It's already an LWP id */

  /* It's a thread.  Convert to lwp */

  val = p_td_ta_map_id2thr (main_ta, GET_THREAD (thread_id), &th);
  if (val == TD_NOTHR)
    return pid_to_ptid (-1);		/* thread must have terminated */
  else if (val != TD_OK)
    error ("thread_to_lwp: td_ta_map_id2thr %s", td_err_string (val));

  val = p_td_thr_get_info (&th, &ti);
  if (val == TD_NOTHR)
    return pid_to_ptid (-1);		/* thread must have terminated */
  else if (val != TD_OK)
    error ("thread_to_lwp: td_thr_get_info: %s", td_err_string (val));

  if (ti.ti_state != TD_THR_ACTIVE)
    {
      if (default_lwp != -1)
	return pid_to_ptid (default_lwp);
      error ("thread_to_lwp: thread state not active: %s",
	     td_state_string (ti.ti_state));
    }

  return BUILD_LWP (ti.ti_lid, PIDGET (thread_id));
}
开发者ID:jichu4n,项目名称:prc-tools-remix,代码行数:34,代码来源:sol-thread.c

示例3: fetch_register

static void
fetch_register (struct regcache *regcache, int regno)
{
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  long regaddr, val;
  int i;
  char buf[MAX_REGISTER_SIZE];
  int tid;

  /* Overload thread id onto process id.  */
  tid = TIDGET (inferior_ptid);
  if (tid == 0)
    tid = PIDGET (inferior_ptid);	/* no thread id, just use
					   process id.  */

  regaddr = 4 * regmap[regno];
  for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long))
    {
      errno = 0;
      val = ptrace (PTRACE_PEEKUSER, tid, regaddr, 0);
      memcpy (&buf[i], &val, sizeof (long));
      regaddr += sizeof (long);
      if (errno != 0)
	error (_("Couldn't read register %s (#%d): %s."), 
	       gdbarch_register_name (gdbarch, regno),
	       regno, safe_strerror (errno));
    }
  regcache_raw_supply (regcache, regno, buf);
}
开发者ID:ArmstrongJ,项目名称:insight-debugger,代码行数:29,代码来源:m68klinux-nat.c

示例4: fetch_fp_register

static void
fetch_fp_register (int regno)
{
  struct fpreg inferior_fp_registers;
#ifndef CROSS_DEBUGGER
  int ret;

  ret = ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
		(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);

  if (ret < 0)
    {
      warning ("unable to fetch floating-point register");
      return;
    }
#endif

  switch (regno)
    {
    case ARM_FPS_REGNUM:
      supply_register (ARM_FPS_REGNUM,
		       (char *) &inferior_fp_registers.fpr_fpsr);
      break;

    default:
      supply_register
	(regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
      break;
    }
}
开发者ID:coyizumi,项目名称:cs111,代码行数:30,代码来源:armfbsd-nat.c

示例5: store_inferior_registers

void
store_inferior_registers (int regnum)
{
    struct reg regs;

    if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
                (PTRACE_TYPE_ARG3) &regs, 0) == -1)
        perror_with_name ("Couldn't get registers");

    ppcobsd_collect_gregset (&ppcobsd_gregset, current_regcache,
                             regnum, &regs, sizeof regs);

    if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
                (PTRACE_TYPE_ARG3) &regs, 0) == -1)
        perror_with_name ("Couldn't write registers");
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:16,代码来源:ppcobsd-nat.c

示例6: sol_thread_detach

static void
sol_thread_detach (char *args, int from_tty)
{
  inferior_ptid = pid_to_ptid (PIDGET (main_ph.ptid));
  unpush_target (&sol_thread_ops);
  procfs_ops.to_detach (args, from_tty);
}
开发者ID:jichu4n,项目名称:prc-tools-remix,代码行数:7,代码来源:sol-thread.c

示例7: pass_signal

static void
pass_signal (int signo)
{
#ifndef _WIN32
  kill (PIDGET (inferior_ptid), SIGINT);
#endif
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:7,代码来源:inflow.c

示例8: fetch_fp_register

static void
fetch_fp_register (struct regcache *regcache, int regno)
{
  struct fpreg inferior_fp_registers;
  int ret;

  ret = ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
		(PTRACE_TYPE_ARG3) &inferior_fp_registers, TIDGET (inferior_ptid));

  if (ret < 0)
    {
      warning (_("unable to fetch floating-point register"));
      return;
    }

  switch (regno)
    {
    case ARM_FPS_REGNUM:
      regcache_raw_supply (regcache, ARM_FPS_REGNUM,
			   (char *) &inferior_fp_registers.fpr_fpsr);
      break;

    default:
      regcache_raw_supply (regcache, regno,
			   (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
      break;
    }
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:28,代码来源:armnbsd-nat.c

示例9: i386bsd_fetch_inferior_registers

static void
i386bsd_fetch_inferior_registers (struct target_ops *ops,
				  struct regcache *regcache, int regnum)
{
  if (regnum == -1 || GETREGS_SUPPLIES (regnum))
    {
      struct reg regs;

      if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
		  (PTRACE_TYPE_ARG3) &regs, 0) == -1)
	perror_with_name (_("Couldn't get registers"));

      i386bsd_supply_gregset (regcache, &regs);
      if (regnum != -1)
	return;
    }

  if (regnum == -1 || regnum >= I386_ST0_REGNUM)
    {
      struct fpreg fpregs;
#ifdef HAVE_PT_GETXMMREGS
      char xmmregs[512];

      if (have_ptrace_xmmregs != 0
	  && ptrace(PT_GETXMMREGS, PIDGET (inferior_ptid),
		    (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
	{
	  have_ptrace_xmmregs = 1;
	  i387_supply_fxsave (regcache, -1, xmmregs);
	}
      else
	{
          if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
		      (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
	    perror_with_name (_("Couldn't get floating point status"));

	  i387_supply_fsave (regcache, -1, &fpregs);
	}
#else
      if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
		  (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
	perror_with_name (_("Couldn't get floating point status"));

      i387_supply_fsave (regcache, -1, &fpregs);
#endif
    }
}
开发者ID:ArmstrongJ,项目名称:insight-debugger,代码行数:47,代码来源:i386bsd-nat.c

示例10: get_thread_id

int
get_thread_id (ptid_t ptid)
{
  int tid = TIDGET (ptid);
  if (0 == tid)
    tid = PIDGET (ptid);
  return tid;
}
开发者ID:anshus012,项目名称:binutils,代码行数:8,代码来源:arm-linux-nat.c

示例11: child_pid_to_str

char *
child_pid_to_str (ptid_t ptid)
{
  static char buf[40];

  sprintf (buf, "process %d thread %d", PIDGET (ptid), TIDGET (ptid));

  return buf;
}
开发者ID:sjohnston-adventiumlabs,项目名称:xen-micart-scheduler,代码行数:9,代码来源:lynx-nat.c

示例12: registers

/* Store register REGNO back into the child process.  If REGNO is -1,
   do this for all registers (including the floating point and SSE
   registers).  */
static void
i386_linux_store_inferior_registers (struct target_ops *ops,
				     struct regcache *regcache, int regno)
{
  int tid;

  /* Use the old method of poking around in `struct user' if the
     SETREGS request isn't available.  */
  if (!have_ptrace_getregs)
    {
      int i;

      for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
	if (regno == -1 || regno == i)
	  store_register (regcache, i);

      return;
    }

  /* GNU/Linux LWP ID's are process ID's.  */
  tid = TIDGET (inferior_ptid);
  if (tid == 0)
    tid = PIDGET (inferior_ptid); /* Not a threaded program.  */

  /* Use the PTRACE_SETFPXREGS requests whenever possible, since it
     transfers more registers in one system call.  But remember that
     store_fpxregs can fail, and return zero.  */
  if (regno == -1)
    {
      store_regs (regcache, tid, regno);
      if (store_fpxregs (regcache, tid, regno))
	return;
      store_fpregs (regcache, tid, regno);
      return;
    }

  if (GETREGS_SUPPLIES (regno))
    {
      store_regs (regcache, tid, regno);
      return;
    }

  if (GETFPXREGS_SUPPLIES (regno))
    {
      if (store_fpxregs (regcache, tid, regno))
	return;

      /* Either our processor or our kernel doesn't support the SSE
	 registers, so just write the FP registers in the traditional
	 way.  */
      store_fpregs (regcache, tid, regno);
      return;
    }

  internal_error (__FILE__, __LINE__,
		  _("Got request to store bad register number %d."), regno);
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:60,代码来源:i386-linux-nat.c

示例13: s390_inferior_tid

/* Find the TID for the current inferior thread to use with ptrace.  */
static int
s390_inferior_tid (void)
{
  /* GNU/Linux LWP ID's are process ID's.  */
  int tid = TIDGET (inferior_ptid);
  if (tid == 0)
    tid = PIDGET (inferior_ptid); /* Not a threaded program.  */

  return tid;
}
开发者ID:0mp,项目名称:freebsd,代码行数:11,代码来源:s390-nat.c

示例14: fetch_inferior_registers

void
fetch_inferior_registers (int regno)
{
  int reglo, reghi;
  int i;
  unsigned long ecp;

  if (regno == -1)
    {
      reglo = 0;
      reghi = NUM_REGS - 1;
    }
  else
    reglo = reghi = regno;

  ecp = registers_addr (PIDGET (inferior_ptid));

  {
    char buf[MAX_REGISTER_SIZE];
    for (regno = reglo; regno <= reghi; regno++)
      {
	int ptrace_fun = PTRACE_PEEKTHREAD;
	
#ifdef M68K
	ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD;
#endif
	
	for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int))
	  {
	    unsigned int reg;
	    
	    errno = 0;
	    reg = ptrace (ptrace_fun, PIDGET (inferior_ptid),
			  (PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), 0);
	    if (errno)
	      perror_with_name ("ptrace(PTRACE_PEEKUSP)");
	    
	    *(int *) &buf[i] = reg;
	  }
	supply_register (regno, buf);
      }
  }
}
开发者ID:sjohnston-adventiumlabs,项目名称:xen-micart-scheduler,代码行数:43,代码来源:lynx-nat.c

示例15: store_inferior_registers

void
store_inferior_registers (int regno)
{
  int reglo, reghi;
  int i;
  unsigned long ecp;

  if (regno == -1)
    {
      reglo = 0;
      reghi = NUM_REGS - 1;
    }
  else
    reglo = reghi = regno;

  ecp = registers_addr (PIDGET (inferior_ptid));

  for (regno = reglo; regno <= reghi; regno++)
    {
      int ptrace_fun = PTRACE_POKEUSER;

      if (CANNOT_STORE_REGISTER (regno))
	continue;

#ifdef M68K
      ptrace_fun = regno == SP_REGNUM ? PTRACE_POKEUSP : PTRACE_POKEUSER;
#endif

      for (i = 0; i < DEPRECATED_REGISTER_RAW_SIZE (regno); i += sizeof (int))
	{
	  unsigned int reg;

	  reg = *(unsigned int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno) + i];

	  errno = 0;
	  ptrace (ptrace_fun, PIDGET (inferior_ptid),
		  (PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), reg);
	  if (errno)
	    perror_with_name ("ptrace(PTRACE_POKEUSP)");
	}
    }
}
开发者ID:sjohnston-adventiumlabs,项目名称:xen-micart-scheduler,代码行数:42,代码来源:lynx-nat.c


注:本文中的PIDGET函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。