本文整理汇总了C++中ptid_get_lwp函数的典型用法代码示例。如果您正苦于以下问题:C++ ptid_get_lwp函数的具体用法?C++ ptid_get_lwp怎么用?C++ ptid_get_lwp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ptid_get_lwp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: i386_linux_dr_set
static void
i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
{
int tid;
tid = ptid_get_lwp (ptid);
if (tid == 0)
tid = ptid_get_pid (ptid);
errno = 0;
ptrace (PTRACE_POKEUSER, tid,
offsetof (struct user, u_debugreg[regnum]), value);
if (errno != 0)
perror_with_name (_("Couldn't write debug register"));
}
开发者ID:Levi-Armstrong,项目名称:gdb-7.7.1,代码行数:15,代码来源:i386-linux-nat.c
示例2: get_core_siginfo
static LONGEST
get_core_siginfo (bfd *abfd, gdb_byte *readbuf, ULONGEST offset, LONGEST len)
{
asection *section;
long pid;
char *section_name;
const char *name = ".note.linuxcore.siginfo";
if (ptid_get_lwp (inferior_ptid))
section_name = xstrprintf ("%s/%ld", name,
ptid_get_lwp (inferior_ptid));
else
section_name = xstrdup (name);
section = bfd_get_section_by_name (abfd, section_name);
xfree (section_name);
if (section == NULL)
return -1;
if (!bfd_get_section_contents (abfd, section, readbuf, offset, len))
return -1;
return len;
}
开发者ID:abidh,项目名称:gdb,代码行数:24,代码来源:corelow.c
示例3: fetch_xtregs
static void
fetch_xtregs (struct regcache *regcache, int regnum)
{
int tid = ptid_get_lwp (inferior_ptid);
const xtensa_regtable_t *ptr;
char xtregs [XTENSA_ELF_XTREG_SIZE];
if (ptrace (PTRACE_GETXTREGS, tid, 0, (long)&xtregs) < 0)
perror_with_name (_("Couldn't get extended registers"));
for (ptr = xtensa_regmap_table; ptr->name; ptr++)
if (regnum == ptr->gdb_regnum || regnum == -1)
regcache_raw_supply (regcache, ptr->gdb_regnum,
xtregs + ptr->ptrace_offset);
}
开发者ID:uglyoldbob,项目名称:binutils,代码行数:15,代码来源:xtensa-linux-nat.c
示例4: shnbsd_store_inferior_registers
static void
shnbsd_store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
{
struct reg inferior_registers;
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
(PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't get registers"));
sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno,
(char *) &inferior_registers,
SHNBSD_SIZEOF_GREGS);
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
(PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp (inferior_ptid)) == -1)
perror_with_name (_("Couldn't set registers"));
if (regno != -1)
return;
}
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:24,代码来源:shnbsd-nat.c
示例5: fetch_gregs
static void
fetch_gregs (struct regcache *regcache, int regnum)
{
int tid = ptid_get_lwp (inferior_ptid);
const gdb_gregset_t regs;
int areg;
if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0)
{
perror_with_name (_("Couldn't get registers"));
return;
}
supply_gregset_reg (regcache, ®s, regnum);
}
开发者ID:uglyoldbob,项目名称:binutils,代码行数:15,代码来源:xtensa-linux-nat.c
示例6: find_one_thread
static int
find_one_thread (ptid_t ptid)
{
td_thrhandle_t th;
td_thrinfo_t ti;
td_err_e err;
struct thread_info *inferior;
struct lwp_info *lwp;
struct thread_db *thread_db = current_process ()->priv->thread_db;
int lwpid = ptid_get_lwp (ptid);
inferior = (struct thread_info *) find_inferior_id (&all_threads, ptid);
lwp = get_thread_lwp (inferior);
if (lwp->thread_known)
return 1;
/* Get information about this thread. */
err = thread_db->td_ta_map_lwp2thr_p (thread_db->thread_agent, lwpid, &th);
if (err != TD_OK)
error ("Cannot get thread handle for LWP %d: %s",
lwpid, thread_db_err_str (err));
err = thread_db->td_thr_get_info_p (&th, &ti);
if (err != TD_OK)
error ("Cannot get thread info for LWP %d: %s",
lwpid, thread_db_err_str (err));
if (debug_threads)
debug_printf ("Found thread %ld (LWP %d)\n",
(unsigned long) ti.ti_tid, ti.ti_lid);
if (lwpid != ti.ti_lid)
{
warning ("PID mismatch! Expected %ld, got %ld",
(long) lwpid, (long) ti.ti_lid);
return 0;
}
/* If the new thread ID is zero, a final thread ID will be available
later. Do not enable thread debugging yet. */
if (ti.ti_tid == 0)
return 0;
lwp->thread_known = 1;
lwp->th = th;
return 1;
}
开发者ID:Manishearth,项目名称:gdb,代码行数:48,代码来源:thread-db.c
示例7: store_regs
static void
store_regs (const struct regcache *regcache)
{
int ret, regno, tid;
elf_gregset_t regs;
/* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (inferior_ptid);
/* Fetch the general registers. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
struct iovec iov;
iov.iov_base = ®s;
iov.iov_len = sizeof (regs);
ret = ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iov);
}
else
ret = ptrace (PTRACE_GETREGS, tid, 0, ®s);
if (ret < 0)
{
warning (_("Unable to fetch general registers."));
return;
}
aarch32_gp_regcache_collect (regcache, (uint32_t *) regs, arm_apcs_32);
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
struct iovec iov;
iov.iov_base = ®s;
iov.iov_len = sizeof (regs);
ret = ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, &iov);
}
else
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
if (ret < 0)
{
warning (_("Unable to store general registers."));
return;
}
}
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:48,代码来源:arm-linux-nat.c
示例8: mips64_linux_regsets_store_registers
static void
mips64_linux_regsets_store_registers (int regno)
{
int is_fp;
int tid;
if (regno >= mips_regnum (current_gdbarch)->fp0
&& regno <= mips_regnum (current_gdbarch)->fp0 + 32)
is_fp = 1;
else if (regno == mips_regnum (current_gdbarch)->fp_control_status)
is_fp = 1;
else if (regno == mips_regnum (current_gdbarch)->fp_implementation_revision)
is_fp = 1;
else
is_fp = 0;
tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
tid = ptid_get_pid (inferior_ptid);
if (regno == -1 || !is_fp)
{
mips64_elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1)
perror_with_name (_("Couldn't get registers"));
mips64_fill_gregset (®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1)
perror_with_name (_("Couldn't set registers"));
}
if (regno == -1 || is_fp)
{
mips64_elf_fpregset_t fp_regs;
if (ptrace (PTRACE_GETFPREGS, tid, 0L,
(PTRACE_TYPE_ARG3) &fp_regs) == -1)
perror_with_name (_("Couldn't get FP registers"));
mips64_fill_fpregset (&fp_regs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0L,
(PTRACE_TYPE_ARG3) &fp_regs) == -1)
perror_with_name (_("Couldn't set FP registers"));
}
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:48,代码来源:mips-linux-nat.c
示例9: store_vfp_regs
static void
store_vfp_regs (const struct regcache *regcache)
{
gdb_byte regbuf[VFP_REGS_SIZE];
int ret, regno, tid;
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (inferior_ptid);
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
struct iovec iov;
iov.iov_base = regbuf;
iov.iov_len = VFP_REGS_SIZE;
ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iov);
}
else
ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
if (ret < 0)
{
warning (_("Unable to fetch VFP registers (for update)."));
return;
}
aarch32_vfp_regcache_collect (regcache, regbuf,
tdep->vfp_register_count);
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
struct iovec iov;
iov.iov_base = regbuf;
iov.iov_len = VFP_REGS_SIZE;
ret = ptrace (PTRACE_SETREGSET, tid, NT_ARM_VFP, &iov);
}
else
ret = ptrace (PTRACE_SETVFPREGS, tid, 0, regbuf);
if (ret < 0)
{
warning (_("Unable to store VFP registers."));
return;
}
}
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:48,代码来源:arm-linux-nat.c
示例10: fetch_inferior_registers
static void
fetch_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
elf_gregset_t regs;
int tid;
tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
tid = ptid_get_pid (inferior_ptid);
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
supply_gregset (regcache, (const elf_gregset_t *)®s);
}
开发者ID:5kg,项目名称:gdb,代码行数:16,代码来源:tilegx-linux-nat.c
示例11: store_regs
static void
store_regs (const struct regcache *regcache)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct reg inferior_registers;
int ret;
int regno;
for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
regcache_raw_collect (regcache, regno,
(char *) &inferior_registers.r[regno]);
regcache_raw_collect (regcache, ARM_SP_REGNUM,
(char *) &inferior_registers.r_sp);
regcache_raw_collect (regcache, ARM_LR_REGNUM,
(char *) &inferior_registers.r_lr);
if (arm_apcs_32)
{
regcache_raw_collect (regcache, ARM_PC_REGNUM,
(char *) &inferior_registers.r_pc);
regcache_raw_collect (regcache, ARM_PS_REGNUM,
(char *) &inferior_registers.r_cpsr);
}
else
{
unsigned pc_val;
unsigned psr_val;
regcache_raw_collect (regcache, ARM_PC_REGNUM,
(char *) &pc_val);
regcache_raw_collect (regcache, ARM_PS_REGNUM,
(char *) &psr_val);
pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val);
psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
inferior_registers.r_pc = pc_val | psr_val;
}
ret = ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
(PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid));
if (ret < 0)
warning (_("unable to store general registers"));
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:47,代码来源:armnbsd-nat.c
示例12: fbsd_pid_to_str
static char *
fbsd_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
lwpid_t lwp;
lwp = ptid_get_lwp (ptid);
if (lwp != 0)
{
static char buf[64];
int pid = ptid_get_pid (ptid);
xsnprintf (buf, sizeof buf, "LWP %d of process %d", lwp, pid);
return buf;
}
return normal_pid_to_str (ptid);
}
开发者ID:Distrotech,项目名称:binutils,代码行数:17,代码来源:fbsd-nat.c
示例13: fetch_fp_regs
static void
fetch_fp_regs (struct regcache *regcache)
{
struct fpreg inferior_fp_registers;
int ret;
int regno;
ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid));
if (ret < 0)
{
warning (_("unable to fetch floating-point registers"));
return;
}
arm_supply_vfpregset (regcache, &inferior_fp_registers);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:18,代码来源:armnbsd-nat.c
示例14: fbsd_thread_alive
static int
fbsd_thread_alive (struct target_ops *ops, ptid_t ptid)
{
if (ptid_lwp_p (ptid))
{
struct ptrace_lwpinfo pl;
if (ptrace (PT_LWPINFO, ptid_get_lwp (ptid), (caddr_t) &pl, sizeof pl)
== -1)
return 0;
#ifdef PL_FLAG_EXITED
if (pl.pl_flags & PL_FLAG_EXITED)
return 0;
#endif
}
return 1;
}
开发者ID:Distrotech,项目名称:binutils,代码行数:18,代码来源:fbsd-nat.c
示例15: amd64_linux_dr_get
static unsigned long
amd64_linux_dr_get (ptid_t ptid, int regnum)
{
int tid;
unsigned long value;
tid = ptid_get_lwp (ptid);
if (tid == 0)
tid = ptid_get_pid (ptid);
errno = 0;
value = ptrace (PTRACE_PEEKUSER, tid,
offsetof (struct user, u_debugreg[regnum]), 0);
if (errno != 0)
perror_with_name (_("Couldn't read debug register"));
return value;
}
开发者ID:dbl001,项目名称:binutils,代码行数:18,代码来源:amd64-linux-nat.c
示例16: 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
m68k_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)
{
old_store_inferior_registers (regcache, regno);
return;
}
/* GNU/Linux LWP ID's are process ID's. */
tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
/* Use the PTRACE_SETFPREGS requests whenever possible, since it
transfers more registers in one system call. But remember that
store_fpregs can fail, and return zero. */
if (regno == -1)
{
store_regs (regcache, tid, regno);
store_fpregs (regcache, tid, regno);
return;
}
if (getregs_supplies (regno))
{
store_regs (regcache, tid, regno);
return;
}
if (getfpregs_supplies (regno))
{
store_fpregs (regcache, tid, regno);
return;
}
internal_error (__FILE__, __LINE__,
_("Got request to store bad register number %d."), regno);
}
开发者ID:atgreen,项目名称:binutils-gdb,代码行数:47,代码来源:m68klinux-nat.c
示例17: store_inferior_registers
static void
store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
elf_gregset_t regs;
int tid;
tid = ptid_get_lwp (inferior_ptid);
if (tid == 0)
tid = ptid_get_pid (inferior_ptid);
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0)
perror_with_name (_("Couldn't get registers"));
fill_gregset (regcache, ®s, regnum);
if (ptrace (PTRACE_SETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0)
perror_with_name (_("Couldn't write registers"));
}
开发者ID:5kg,项目名称:gdb,代码行数:19,代码来源:tilegx-linux-nat.c
示例18: inf_ptrace_fetch_register
static void
inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
CORE_ADDR addr;
size_t size;
PTRACE_TYPE_RET *buf;
int pid, i;
/* This isn't really an address, but ptrace thinks of it as one. */
addr = inf_ptrace_register_u_offset (gdbarch, regnum, 0);
if (addr == (CORE_ADDR)-1
|| gdbarch_cannot_fetch_register (gdbarch, regnum))
{
regcache_raw_supply (regcache, regnum, NULL);
return;
}
/* Cater for systems like GNU/Linux, that implement threads as
separate processes. */
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
pid = ptid_get_pid (inferior_ptid);
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);
/* Read the register contents from the inferior a chunk at a time. */
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
buf[i] = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3)(uintptr_t)addr, 0);
if (errno != 0)
error (_("Couldn't read register %s (#%d): %s."),
gdbarch_register_name (gdbarch, regnum),
regnum, safe_strerror (errno));
addr += sizeof (PTRACE_TYPE_RET);
}
regcache_raw_supply (regcache, regnum, buf);
}
开发者ID:rgmabs19357,项目名称:gdb,代码行数:42,代码来源:inf-ptrace.c
示例19: store_wmmx_regs
static void
store_wmmx_regs (const struct regcache *regcache)
{
char regbuf[IWMMXT_REGS_SIZE];
int ret, regno, tid;
/* Get the thread id for the ptrace call. */
tid = ptid_get_lwp (inferior_ptid);
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
{
warning (_("Unable to fetch WMMX registers."));
return;
}
for (regno = 0; regno < 16; regno++)
if (REG_VALID == regcache_register_status (regcache,
regno + ARM_WR0_REGNUM))
regcache_raw_collect (regcache, regno + ARM_WR0_REGNUM,
®buf[regno * 8]);
for (regno = 0; regno < 2; regno++)
if (REG_VALID == regcache_register_status (regcache,
regno + ARM_WCSSF_REGNUM))
regcache_raw_collect (regcache, regno + ARM_WCSSF_REGNUM,
®buf[16 * 8 + regno * 4]);
for (regno = 0; regno < 4; regno++)
if (REG_VALID == regcache_register_status (regcache,
regno + ARM_WCGR0_REGNUM))
regcache_raw_collect (regcache, regno + ARM_WCGR0_REGNUM,
®buf[16 * 8 + 2 * 4 + regno * 4]);
ret = ptrace (PTRACE_SETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
{
warning (_("Unable to store WMMX registers."));
return;
}
}
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:42,代码来源:arm-linux-nat.c
示例20: fbsd_thread_name
static const char *
fbsd_thread_name (struct target_ops *self, struct thread_info *thr)
{
struct ptrace_lwpinfo pl;
struct kinfo_proc kp;
int pid = ptid_get_pid (thr->ptid);
long lwp = ptid_get_lwp (thr->ptid);
static char buf[sizeof pl.pl_tdname + 1];
/* Note that ptrace_lwpinfo returns the process command in pl_tdname
if a name has not been set explicitly. Return a NULL name in
that case. */
fbsd_fetch_kinfo_proc (pid, &kp);
if (ptrace (PT_LWPINFO, lwp, (caddr_t) &pl, sizeof pl) == -1)
perror_with_name (("ptrace"));
if (strcmp (kp.ki_comm, pl.pl_tdname) == 0)
return NULL;
xsnprintf (buf, sizeof buf, "%s", pl.pl_tdname);
return buf;
}
开发者ID:Distrotech,项目名称:binutils,代码行数:20,代码来源:fbsd-nat.c
注:本文中的ptid_get_lwp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论