本文整理汇总了C++中PIDGET函数的典型用法代码示例。如果您正苦于以下问题:C++ PIDGET函数的具体用法?C++ PIDGET怎么用?C++ PIDGET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PIDGET函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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) ®s, 0) == -1)
perror_with_name ("Couldn't get registers");
ppcobsd_collect_gregset (&ppcobsd_gregset, current_regcache,
regnum, ®s, sizeof regs);
if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 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) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
i386bsd_supply_gregset (regcache, ®s);
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
示例16: 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
示例17: sparc_xfer_wcookie
LONGEST
sparc_xfer_wcookie (struct target_ops *ops, enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
unsigned long wcookie = 0;
char *buf = (char *)&wcookie;
gdb_assert (object == TARGET_OBJECT_WCOOKIE);
gdb_assert (readbuf && writebuf == NULL);
if (offset == sizeof (unsigned long))
return 0; /* Signal EOF. */
if (offset > sizeof (unsigned long))
return -1;
#ifdef PT_WCOOKIE
/* If PT_WCOOKIE is defined (by <sys/ptrace.h>), assume we're
running on an OpenBSD release that uses StackGhost (3.1 or
later). Since release 3.6, OpenBSD uses a fully randomized
cookie. */
{
int pid;
pid = TIDGET (inferior_ptid);
if (pid == 0)
pid = PIDGET (inferior_ptid);
/* Sanity check. The proper type for a cookie is register_t, but
we can't assume that this type exists on all systems supported
by the code in this file. */
gdb_assert (sizeof (wcookie) == sizeof (register_t));
/* Fetch the cookie. */
if (ptrace (PT_WCOOKIE, pid, (PTRACE_TYPE_ARG3) &wcookie, 0) == -1)
{
if (errno != EINVAL)
perror_with_name (_("Couldn't get StackGhost cookie"));
/* Although PT_WCOOKIE is defined on OpenBSD 3.1 and later,
the request wasn't implemented until after OpenBSD 3.4. If
the kernel doesn't support the PT_WCOOKIE request, assume
we're running on a kernel that uses non-randomized cookies. */
wcookie = 0x3;
}
}
#endif /* PT_WCOOKIE */
if (len > sizeof (unsigned long) - offset)
len = sizeof (unsigned long) - offset;
memcpy (readbuf, buf + offset, len);
return len;
}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:54,代码来源:sparc-nat.c
示例18: 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) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
sparc_supply_gregset (sparc_gregset, regcache, -1, ®s);
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
示例19: i386_linux_read_description
static const struct target_desc *
i386_linux_read_description (struct target_ops *ops)
{
int tid;
static uint64_t xcr0;
/* GNU/Linux LWP ID's are process ID's. */
tid = TIDGET (inferior_ptid);
if (tid == 0)
tid = PIDGET (inferior_ptid); /* Not a threaded program. */
#ifdef HAVE_PTRACE_GETFPXREGS
if (have_ptrace_getfpxregs == -1)
{
elf_fpxregset_t fpxregs;
if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
{
have_ptrace_getfpxregs = 0;
have_ptrace_getregset = 0;
return tdesc_i386_mmx_linux;
}
}
#endif
if (have_ptrace_getregset == -1)
{
uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))];
struct iovec iov;
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
/* Check if PTRACE_GETREGSET works. */
if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
&iov) < 0)
have_ptrace_getregset = 0;
else
{
have_ptrace_getregset = 1;
/* Get XCR0 from XSAVE extended state. */
xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
/ sizeof (long long))];
}
}
/* Check the native XCR0 only if PTRACE_GETREGSET is available. */
if (have_ptrace_getregset
&& (xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK)
return tdesc_i386_avx_linux;
else
return tdesc_i386_linux;
}
开发者ID:CyberGrandChallenge,项目名称:gdb,代码行数:54,代码来源:i386-linux-nat.c
示例20: vaxbsd_fetch_inferior_registers
static void
vaxbsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
vaxbsd_supply_gregset (regcache, ®s);
}
开发者ID:gygy,项目名称:asuswrt,代码行数:11,代码来源:vaxbsd-nat.c
注:本文中的PIDGET函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论