本文整理汇总了C++中ptid_get_lwp函数的典型用法代码示例。如果您正苦于以下问题:C++ ptid_get_lwp函数的具体用法?C++ ptid_get_lwp怎么用?C++ ptid_get_lwp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ptid_get_lwp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"));
}
示例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;
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
}
示例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"));
}
}
示例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;
}
}
示例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);
}
示例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"));
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}