本文整理汇总了C++中perror_with_name函数的典型用法代码示例。如果您正苦于以下问题:C++ perror_with_name函数的具体用法?C++ perror_with_name怎么用?C++ perror_with_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了perror_with_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: i386_linux_dr_set
static void
i386_linux_dr_set (int regnum, unsigned long value)
{
int tid;
/* FIXME: kettenis/2001-01-29: It's not clear what we should do with
multi-threaded processes here. For now, pretend there is just
one thread. */
tid = PIDGET (inferior_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"));
}
示例3: delete_target
static void
delete_target (struct file *file, const char *on_behalf_of)
{
struct stat st;
int e;
if (file->precious || file->phony) {
return;
}
#ifndef NO_ARCHIVES
if (ar_name (file->name))
{
time_t file_date = (file->last_mtime == NONEXISTENT_MTIME
? (time_t) -1
: (time_t) FILE_TIMESTAMP_S (file->last_mtime));
if (ar_member_date (file->name) != file_date)
{
if (on_behalf_of) {
error (NILF, _("*** [%s] Archive member `%s' may be bogus; not deleted"),
on_behalf_of, file->name);
} else {
error (NILF, _("*** Archive member `%s' may be bogus; not deleted"),
file->name);
}
}
return;
}
#endif /* !NO_ARCHIVES. */
EINTRLOOP (e, stat (file->name, &st));
if (e == 0
&& S_ISREG (st.st_mode)
#ifdef ST_MTIM_NSEC
&& FILE_TIMESTAMP_STAT_MODTIME (file->name, st) != file->last_mtime
#endif /* ST_MTIM_NSEC */
&& e != 1)
{
if (on_behalf_of) {
error (NILF, _("*** [%s] Deleting file `%s'"), on_behalf_of, file->name);
} else
error (NILF, _("*** Deleting file `%s'"), file->name);
if (unlink (file->name) < 0
&& errno != ENOENT) /* It disappeared; so what. */
perror_with_name ("unlink: ", file->name);
}
}
示例4: alloc_jump_pad_buffer
void *
alloc_jump_pad_buffer (size_t size)
{
#if __ILP32__
uintptr_t addr;
int pagesize;
pagesize = sysconf (_SC_PAGE_SIZE);
if (pagesize == -1)
perror_with_name ("sysconf");
addr = 0x80000000 - size;
/* size should already be page-aligned, but this can't hurt. */
addr &= ~(pagesize - 1);
/* Search for a free area. If we hit 0, we're out of luck. */
for (; addr; addr -= pagesize)
{
void *res;
/* No MAP_FIXED - we don't want to zap someone's mapping. */
res = mmap ((void *) addr, size,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
/* If we got what we wanted, return. */
if ((uintptr_t) res == addr)
return res;
/* If we got a mapping, but at a wrong address, undo it. */
if (res != MAP_FAILED)
munmap (res, size);
}
return NULL;
#else
void *res = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
if (res == MAP_FAILED)
return NULL;
return res;
#endif
}
示例5: inferior_thread
int
inf_ptrace_target::follow_fork (int follow_child, int detach_fork)
{
if (!follow_child)
{
struct thread_info *tp = inferior_thread ();
pid_t child_pid = tp->pending_follow.value.related_pid.pid ();
/* Breakpoints have already been detached from the child by
infrun.c. */
if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
perror_with_name (("ptrace"));
}
return 0;
}
示例6: inf_ptrace_follow_fork
static int
inf_ptrace_follow_fork (struct target_ops *ops, int follow_child,
int detach_fork)
{
if (!follow_child)
{
pid_t child_pid = inferior_thread->pending_follow.value.related_pid;
/* Breakpoints have already been detached from the child by
infrun.c. */
if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
perror_with_name (("ptrace"));
}
return 0;
}
示例7: fetch_inferior_registers
void
fetch_inferior_registers (int regno)
{
if (regno == -1 || GETREGS_SUPPLIES (regno))
{
struct reg inferior_registers;
if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
(PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
perror_with_name (_("Couldn't get registers"));
shnbsd_supply_reg ((char *) &inferior_registers, regno);
if (regno != -1)
return;
}
}
示例8: get_current_lwp
static long
get_current_lwp (int pid)
{
struct ptrace_lwpinfo pl;
lwpid_t lwpid;
if (!target_has_execution)
{
lwpid = 0;
bfd_map_over_sections (core_bfd, fbsd_core_get_first_lwp, &lwpid);
return lwpid;
}
if (ptrace (PT_LWPINFO, pid, (caddr_t)&pl, sizeof(pl)))
perror_with_name("PT_LWPINFO");
return (long)pl.pl_lwpid;
}
示例9: sh3_open
static void
sh3_open (char *args, int from_tty)
{
char *serial_port_name = args;
char *parallel_port_name = 0;
if (args)
{
char *cursor = serial_port_name = xstrdup (args);
while (*cursor && *cursor != ' ')
cursor++;
if (*cursor)
*cursor++ = 0;
while (*cursor == ' ')
cursor++;
if (*cursor)
parallel_port_name = cursor;
}
monitor_open (serial_port_name, &sh3_cmds, from_tty);
if (parallel_port_name)
{
parallel = serial_open (parallel_port_name);
if (!parallel)
perror_with_name (_("Unable to open parallel port."));
parallel_in_use = 1;
}
/* If we connected successfully, we know the processor is an SH3. */
{
struct gdbarch_info info;
gdbarch_info_init (&info);
info.bfd_arch_info = bfd_lookup_arch (bfd_arch_sh, bfd_mach_sh3);
if (!gdbarch_update_p (info))
error (_("Target is not an SH3"));
}
}
示例10: resume_one_thread_cb
static int
resume_one_thread_cb (struct thread_info *tp, void *data)
{
ptid_t *ptid = data;
int request;
if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid))
return 0;
if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (*ptid))
request = PT_RESUME;
else
request = PT_SUSPEND;
if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1)
perror_with_name (("ptrace"));
return 0;
}
示例11: fetch_vsx_registers
static void
fetch_vsx_registers (struct regcache *regcache, int tid)
{
int ret;
gdb_vsxregset_t regs;
ret = ptrace (PTRACE_GETVSXREGS, tid, 0, ®s);
if (ret < 0)
{
if (errno == EIO)
{
have_ptrace_getsetvsxregs = 0;
return;
}
perror_with_name (_("Unable to fetch VSX registers"));
}
supply_vsxregset (regcache, ®s);
}
示例12: fetch_altivec_registers
static void
fetch_altivec_registers (int tid)
{
int ret;
gdb_vrregset_t regs;
ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s);
if (ret < 0)
{
if (errno == EIO)
{
have_ptrace_getvrregs = 0;
return;
}
perror_with_name (_("Unable to fetch AltiVec registers"));
}
supply_vrregset (®s);
}
示例13: 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;
}
示例14: fetch_xstateregs
static int
fetch_xstateregs (struct regcache *regcache, int tid)
{
char xstateregs[X86_XSTATE_MAX_SIZE];
struct iovec iov;
if (!have_ptrace_getregset)
return 0;
iov.iov_base = xstateregs;
iov.iov_len = sizeof(xstateregs);
if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
&iov) < 0)
perror_with_name (_("Couldn't read extended state status"));
i387_supply_xsave (regcache, -1, xstateregs);
return 1;
}
示例15: xcoff_relocate_symtab
void
xcoff_relocate_symtab (unsigned int pid)
{
int load_segs = 64; /* number of load segments */
int rc;
LdInfo *ldi = NULL;
int arch64 = ARCH64 ();
int ldisize = arch64 ? sizeof (ldi->l64) : sizeof (ldi->l32);
int size;
do
{
size = load_segs * ldisize;
ldi = (void *) xrealloc (ldi, size);
#if 0
/* According to my humble theory, AIX has some timing problems and
when the user stack grows, kernel doesn't update stack info in time
and ptrace calls step on user stack. That is why we sleep here a
little, and give kernel to update its internals. */
usleep (36000);
#endif
if (arch64)
rc = rs6000_ptrace64 (PT_LDINFO, pid, (unsigned long) ldi, size, NULL);
else
rc = rs6000_ptrace32 (PT_LDINFO, pid, (int *) ldi, size, NULL);
if (rc == -1)
{
if (errno == ENOMEM)
load_segs *= 2;
else
perror_with_name ("ptrace ldinfo");
}
else
{
vmap_ldinfo (ldi);
vmap_exec (); /* relocate the exec and core sections as well. */
}
} while (rc == -1);
if (ldi)
xfree (ldi);
}