+2015-05-04 Max Filippov <jcmvbkbc@gmail.com>
+
+ * backtrace-child.c (stdarg, main): Replace assert_perror with assert.
+ * backtrace-data.c (memory_read, maps_lookup, set_initial_registers)
+ (main): Likewise.
+ * backtrace-dwarf.c (main): Likewise.
+ * backtrace.c (prepare_thread, exec_dump): Likewise.
+
2015-05-04 Anthony G. Basile <blueness@gentoo.org>
* Makefile.am (line2addr_LDADD, addrscopes_LDADD, funcscopes_LDADD)
if (ptraceme)
{
long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
}
#ifdef __x86_64__
{
errno = 0;
long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
}
if (gencore)
errno = 0;
long l = ptrace (PTRACE_PEEKDATA, child, (void *) (uintptr_t) addr, NULL);
- assert_perror (errno);
+ assert (errno == 0);
*result = l;
/* We could also return false for failed ptrace. */
{
char *fname;
int i = asprintf (&fname, "/proc/%ld/maps", (long) pid);
- assert_perror (errno);
+ assert (errno == 0);
assert (i > 0);
FILE *f = fopen (fname, "r");
- assert_perror (errno);
+ assert (errno == 0);
assert (f);
free (fname);
for (;;)
// 37e3c22000-37e3c23000 rw-p 00022000 00:11 49532 /lib64/ld-2.14.90.so */
unsigned long start, end, offset;
i = fscanf (f, "%lx-%lx %*s %lx %*x:%*x %*x", &start, &end, &offset);
- assert_perror (errno);
+ assert (errno == 0);
assert (i == 3);
char *filename = strdup ("");
assert (filename);
if (start <= addr && addr < end)
{
i = fclose (f);
- assert_perror (errno);
+ assert (errno == 0);
assert (i == 0);
*basep = start - offset;
struct user_regs_struct user_regs;
long l = ptrace (PTRACE_GETREGS, child, NULL, &user_regs);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
Dwarf_Word dwarf_regs[17];
switch (child)
{
case -1:
- assert_perror (errno);
+ assert (errno == 0);
assert (0);
case 0:;
long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
raise (SIGUSR1);
return 0;
int status;
pid_t pid = waitpid (child, &status, 0);
- assert_perror (errno);
+ assert (errno == 0);
assert (pid == child);
assert (WIFSTOPPED (status));
assert (WSTOPSIG (status) == SIGUSR1);
struct user_regs_struct user_regs;
long l = ptrace (PTRACE_GETREGS, child, NULL, &user_regs);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
report_module (dwfl, child, user_regs.rip);
dwfl_end (dwfl);
kill (child, SIGKILL);
pid = waitpid (child, &status, 0);
- assert_perror (errno);
+ assert (errno == 0);
assert (pid == child);
assert (WIFSIGNALED (status));
assert (WTERMSIG (status) == SIGKILL);
abort ();
case 0:;
long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
cleanup_13_main ();
abort ();
errno = 0;
int status;
pid_t got = waitpid (pid, &status, 0);
- assert_perror (errno);
+ assert (errno == 0);
assert (got == pid);
assert (WIFSTOPPED (status));
assert (WSTOPSIG (status) == SIGABRT);
struct user_regs_struct user_regs;
errno = 0;
l = ptrace (PTRACE_GETREGS, pid2, 0, (intptr_t) &user_regs);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
user_regs.rip = (intptr_t) jmp;
l = ptrace (PTRACE_SETREGS, pid2, 0, (intptr_t) &user_regs);
- assert_perror (errno);
+ assert (errno == 0);
assert (l == 0);
l = ptrace (PTRACE_CONT, pid2, NULL, (void *) (intptr_t) SIGUSR2);
int status;
pid_t got = waitpid (pid2, &status, __WALL);
- assert_perror (errno);
+ assert (errno == 0);
assert (got == pid2);
assert (WIFSTOPPED (status));
assert (WSTOPSIG (status) == SIGUSR1);
errno = 0;
int status;
pid_t got = waitpid (pid, &status, 0);
- assert_perror (errno);
+ assert (errno == 0);
assert (got == pid);
assert (WIFSTOPPED (status));
// Main thread will signal SIGUSR2. Other thread will signal SIGUSR1.
__WCLONE, probably despite pthread_create already had to be called the new
task is not yet alive enough for waitpid. */
pid_t pid2 = waitpid (-1, &status, __WALL);
- assert_perror (errno);
+ assert (errno == 0);
assert (pid2 > 0);
assert (pid2 != pid);
assert (WIFSTOPPED (status));