本文整理汇总了C++中perror_with_name函数的典型用法代码示例。如果您正苦于以下问题:C++ perror_with_name函数的具体用法?C++ perror_with_name怎么用?C++ perror_with_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了perror_with_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:5kg,项目名称:gdb,代码行数:16,代码来源:tilegx-linux-nat.c
示例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"));
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:16,代码来源:i386-linux-nat.c
示例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);
}
}
开发者ID:cooljeanius,项目名称:remake,代码行数:47,代码来源:commands.c
示例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
}
开发者ID:Winter3un,项目名称:ctf_task,代码行数:46,代码来源:linux-amd64-ipa.c
示例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;
}
开发者ID:jon-turney,项目名称:binutils-gdb,代码行数:17,代码来源:inf-ptrace.c
示例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;
}
开发者ID:mbref,项目名称:binutils-gdb-microblaze,代码行数:17,代码来源:inf-ptrace.c
示例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;
}
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:17,代码来源:shnbsd-nat.c
示例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;
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:17,代码来源:fbsd-threads.c
示例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"));
}
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:45,代码来源:sh3-rom.c
示例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;
}
开发者ID:Distrotech,项目名称:binutils,代码行数:18,代码来源:fbsd-nat.c
示例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);
}
开发者ID:sergiodj,项目名称:gdb-sergio,代码行数:18,代码来源:ppc-linux-nat.c
示例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);
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:18,代码来源:ppc-linux-nat.c
示例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;
}
开发者ID:dbl001,项目名称:binutils,代码行数:18,代码来源:amd64-linux-nat.c
示例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;
}
开发者ID:mbref,项目名称:binutils-gdb-microblaze,代码行数:18,代码来源:i386-linux-nat.c
示例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);
}
开发者ID:DonCN,项目名称:haiku,代码行数:44,代码来源:rs6000-nat.c
示例16: i386fbsd_resume
static void
i386fbsd_resume (struct target_ops *ops,
ptid_t ptid, int step, enum gdb_signal signal)
{
pid_t pid = ptid_get_pid (ptid);
int request = PT_STEP;
if (pid == -1)
/* Resume all threads. This only gets used in the non-threaded
case, where "resume all threads" and "resume inferior_ptid" are
the same. */
pid = ptid_get_pid (inferior_ptid);
if (!step)
{
struct regcache *regcache = get_current_regcache ();
ULONGEST eflags;
/* Workaround for a bug in FreeBSD. Make sure that the trace
flag is off when doing a continue. There is a code path
through the kernel which leaves the flag set when it should
have been cleared. If a process has a signal pending (such
as SIGALRM) and we do a PT_STEP, the process never really has
a chance to run because the kernel needs to notify the
debugger that a signal is being sent. Therefore, the process
never goes through the kernel's trap() function which would
normally clear it. */
regcache_cooked_read_unsigned (regcache, I386_EFLAGS_REGNUM,
&eflags);
if (eflags & 0x0100)
regcache_cooked_write_unsigned (regcache, I386_EFLAGS_REGNUM,
eflags & ~0x0100);
request = PT_CONTINUE;
}
/* An addres of (caddr_t) 1 tells ptrace to continue from where it
was. (If GDB wanted it to start some other way, we have already
written a new PC value to the child.) */
if (ptrace (request, pid, (caddr_t) 1,
gdb_signal_to_host (signal)) == -1)
perror_with_name (("ptrace"));
}
开发者ID:kraj,项目名称:binutils-gdb,代码行数:44,代码来源:i386-fbsd-nat.c
示例17: store_register
static void
store_register (int regno)
{
/* This isn't really an address. But ptrace thinks of it as one. */
CORE_ADDR regaddr;
char mess[128]; /* For messages */
int i;
unsigned int offset; /* Offset of registers within the u area. */
int tid;
char buf[MAX_REGISTER_SIZE];
if (CANNOT_STORE_REGISTER (regno))
{
return;
}
/* Overload thread id onto process id */
tid = TIDGET (inferior_ptid);
if (tid == 0)
tid = PIDGET (inferior_ptid); /* no thread id, just use process id */
offset = U_REGS_OFFSET;
regaddr = register_addr (regno, offset);
/* Put the contents of regno into a local buffer */
regcache_raw_collect (current_regcache, regno, buf);
/* Store the local buffer into the inferior a chunk at the time. */
for (i = 0; i < register_size (current_gdbarch, regno);
i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr,
*(PTRACE_XFER_TYPE *) (buf + i));
regaddr += sizeof (PTRACE_XFER_TYPE);
if (errno != 0)
{
sprintf (mess, "writing register %s (#%d)",
REGISTER_NAME (regno), regno);
perror_with_name (mess);
}
}
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:44,代码来源:m68klinux-nat.c
示例18: ar_touch
int
ar_touch (const char *name)
{
char *arname, *memname;
int val;
ar_parse_name (name, &arname, &memname);
/* Make sure we know the modtime of the archive itself before we
touch the member, since this will change the archive modtime. */
{
struct file *arfile;
arfile = enter_file (strcache_add (arname));
f_mtime (arfile, 0);
}
val = 1;
switch (ar_member_touch (arname, memname))
{
case -1:
error (NILF, _("touch: Archive `%s' does not exist"), arname);
break;
case -2:
error (NILF, _("touch: `%s' is not a valid archive"), arname);
break;
case -3:
perror_with_name ("touch: ", arname);
break;
case 1:
error (NILF,
_("touch: Member `%s' does not exist in `%s'"), memname, arname);
break;
case 0:
val = 0;
break;
default:
error (NILF,
_("touch: Bad return code from ar_member_touch on `%s'"), name);
}
free (arname);
return val;
}
开发者ID:BlueBolt,项目名称:BB_GridEngine,代码行数:44,代码来源:ar.c
示例19: 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
示例20: 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
注:本文中的perror_with_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论