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


C++ TIDGET函数代码示例

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


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

示例1: i386_linux_dr_get

static unsigned long
i386_linux_dr_get (ptid_t ptid, int regnum)
{
  int tid;
  unsigned long value;

  tid = TIDGET (ptid);
  if (tid == 0)
    tid = PIDGET (ptid);

  /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
     ptrace call fails breaks debugging remote targets.  The correct
     way to fix this is to add the hardware breakpoint and watchpoint
     stuff to the target vector.  For now, just return zero if the
     ptrace call fails.  */
  errno = 0;
  value = ptrace (PTRACE_PEEKUSER, tid,
		  offsetof (struct user, u_debugreg[regnum]), 0);
  if (errno != 0)
#if 0
    perror_with_name (_("Couldn't read debug register"));
#else
    return 0;
#endif

  return value;
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:27,代码来源:i386-linux-nat.c

示例2: 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

示例3: amd64_linux_fetch_inferior_registers

static void
amd64_linux_fetch_inferior_registers (int regnum)
{
  int tid;

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

  if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
    {
      elf_gregset_t regs;

      if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
	perror_with_name (_("Couldn't get registers"));

      amd64_supply_native_gregset (current_regcache, &regs, -1);
      if (regnum != -1)
	return;
    }

  if (regnum == -1 || !amd64_native_gregset_supplies_p (regnum))
    {
      elf_fpregset_t fpregs;

      if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
	perror_with_name (_("Couldn't get floating point status"));

      amd64_supply_fxsave (current_regcache, -1, &fpregs);
    }
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:32,代码来源:amd64-linux-nat.c

示例4: fetch_register

static void
fetch_register (int regno)
{
  int tid;
  int val;

  if (CANNOT_FETCH_REGISTER (regno))
    {
      regcache_raw_supply (current_regcache, regno, NULL);
      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.  */

  errno = 0;
  val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0);
  if (errno != 0)
    error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno),
	   regno, safe_strerror (errno));

  regcache_raw_supply (current_regcache, regno, &val);
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:25,代码来源:hppa-linux-nat.c

示例5: fetch_register

static void
fetch_register (struct regcache *regcache, int regno)
{
  int tid;
  int val;

  gdb_assert (!have_ptrace_getregs);
  if (i386_linux_gregset_reg_offset[regno] == -1)
    {
      regcache_raw_supply (regcache, regno, NULL);
      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.  */

  errno = 0;
  val = ptrace (PTRACE_PEEKUSER, tid,
		i386_linux_gregset_reg_offset[regno], 0);
  if (errno != 0)
    error (_("Couldn't read register %s (#%d): %s."), 
	   gdbarch_register_name (get_regcache_arch (regcache), regno),
	   regno, safe_strerror (errno));

  regcache_raw_supply (regcache, regno, &val);
}
开发者ID:CyberGrandChallenge,项目名称:gdb,代码行数:28,代码来源:i386-linux-nat.c

示例6: fetch_register

static void
fetch_register (struct regcache *regcache, int regno)
{
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  long regaddr, val;
  int i;
  gdb_byte 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:GoldStoneProd2010,项目名称:gdb-7.6,代码行数:29,代码来源:m68klinux-nat.c

示例7: 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;
  gdb_byte 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:GoldStoneProd2010,项目名称:gdb-7.6,代码行数:33,代码来源:m68klinux-nat.c

示例8: fetch_register

static void
fetch_register (struct regcache *regcache, int regno)
{
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  int tid;
  int val;

  if (gdbarch_cannot_fetch_register (gdbarch, regno))
    {
      regcache_raw_supply (regcache, regno, NULL);
      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.  */

  errno = 0;
  val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
  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, &val);
}
开发者ID:GunioRobot,项目名称:macgdb,代码行数:27,代码来源:hppa-linux-nat.c

示例9: ppc_linux_insert_watchpoint

/* Set a watchpoint of type TYPE at address ADDR.  */
static int
ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw)
{
  int tid;
  long dabr_value;
  ptid_t ptid = inferior_ptid;

  dabr_value = addr & ~7;
  switch (rw)
    {
    case hw_read:
      /* Set read and translate bits.  */
      dabr_value |= 5;
      break;
    case hw_write:
      /* Set write and translate bits.  */
      dabr_value |= 6;
      break;
    case hw_access:
      /* Set read, write and translate bits.  */
      dabr_value |= 7;
      break;
    }

  tid = TIDGET (ptid);
  if (tid == 0)
    tid = PIDGET (ptid);

  return ptrace (PTRACE_SET_DEBUGREG, tid, 0, dabr_value);
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:31,代码来源:ppc-linux-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: 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

示例12: 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

示例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: sparc_fetch_inferior_registers

void
sparc_fetch_inferior_registers (struct target_ops *ops,
				struct regcache *regcache, int regnum)
{
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  int pid;

  /* NOTE: cagney/2002-12-03: This code assumes that the currently
     selected light weight processes' registers can be written
     directly into the selected thread's register cache.  This works
     fine when given an 1:1 LWP:thread model (such as found on
     GNU/Linux) but will, likely, have problems when used on an N:1
     (userland threads) or N:M (userland multiple LWP) model.  In the
     case of the latter two, the LWP's registers do not necessarily
     belong to the selected thread (the LWP could be in the middle of
     executing the thread switch code).

     These functions should instead be paramaterized with an explicit
     object (struct regcache, struct thread_info?) into which the LWPs
     registers can be written.  */
  pid = TIDGET (inferior_ptid);
  if (pid == 0)
    pid = PIDGET (inferior_ptid);

  if (regnum == SPARC_G0_REGNUM)
    {
      gdb_byte zero[8] = { 0 };

      regcache_raw_supply (regcache, SPARC_G0_REGNUM, &zero);
      return;
    }

  if (regnum == -1 || sparc_gregset_supplies_p (gdbarch, regnum))
    {
      gregset_t regs;

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

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

  if (regnum == -1 || sparc_fpregset_supplies_p (gdbarch, regnum))
    {
      fpregset_t fpregs;

      if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
	perror_with_name (_("Couldn't get floating point status"));

      sparc_supply_fpregset (regcache, -1, &fpregs);
    }
}
开发者ID:ArmstrongJ,项目名称:insight-debugger,代码行数:54,代码来源:sparc-nat.c

示例15: store_debug_register

static void
store_debug_register (ptid_t ptid, int idx, long val)
{
  int tid;

  tid = TIDGET (ptid);
  if (tid == 0)
    tid = PIDGET (ptid);

  (void) ptrace (PT_WRITE_U, tid, (PTRACE_TYPE_ARG3) (PT_DBR + 8 * idx), val);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:11,代码来源:ia64-linux-nat.c


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