]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Replace assert_perror with assert
authorMax Filippov <jcmvbkbc@gmail.com>
Mon, 4 May 2015 17:17:52 +0000 (20:17 +0300)
committerMark Wielaard <mjw@redhat.com>
Tue, 5 May 2015 08:36:53 +0000 (10:36 +0200)
assert_perror is a GNU extension, it's not provided by uClibc and it's
only used in tests. Replace it with assert.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
tests/ChangeLog
tests/backtrace-child.c
tests/backtrace-data.c
tests/backtrace-dwarf.c
tests/backtrace.c

index 11e96a72e9e7e1661dc217e84d2bf3cd45357380..a899947eb168762ff74475221a6aa47ac9c3897a 100644 (file)
@@ -1,3 +1,11 @@
+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)
index 788801c34a4bd79bd348f8a6ec6318229ec5cf0e..40e7b32d2ba2171992766e1ee719f490378e6e55 100644 (file)
@@ -154,7 +154,7 @@ stdarg (int f UNUSED, ...)
   if (ptraceme)
     {
       long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
-      assert_perror (errno);
+      assert (errno == 0);
       assert (l == 0);
     }
 #ifdef __x86_64__
@@ -226,7 +226,7 @@ main (int argc UNUSED, char **argv)
     {
       errno = 0;
       long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
-      assert_perror (errno);
+      assert (errno == 0);
       assert (l == 0);
     }
   if (gencore)
index 01c1c0040702cf2f1eb9f70248642d4f3df9a552..5a93a9cc630c653da74f00149d7f5586e57bfa69 100644 (file)
@@ -74,7 +74,7 @@ memory_read (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Word *result,
 
   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.  */
@@ -89,10 +89,10 @@ maps_lookup (pid_t pid, Dwarf_Addr addr, GElf_Addr *basep)
 {
   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 (;;)
@@ -100,7 +100,7 @@ maps_lookup (pid_t pid, Dwarf_Addr addr, GElf_Addr *basep)
       // 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);
@@ -121,7 +121,7 @@ maps_lookup (pid_t pid, Dwarf_Addr addr, GElf_Addr *basep)
       if (start <= addr && addr < end)
        {
          i = fclose (f);
-         assert_perror (errno);
+         assert (errno == 0);
          assert (i == 0);
 
          *basep = start - offset;
@@ -171,7 +171,7 @@ set_initial_registers (Dwfl_Thread *thread,
 
   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];
@@ -271,11 +271,11 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
   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;
@@ -285,7 +285,7 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
 
   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);
@@ -303,7 +303,7 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
 
   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);
 
@@ -317,7 +317,7 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
   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);
index fbcb22e64b42624754d8e77dabcd94588a16a1b4..a644c8abda43f9c02a73eb43fbdeac4f9dbdb607 100644 (file)
@@ -143,7 +143,7 @@ main (int argc __attribute__ ((unused)), char **argv)
       abort ();
     case 0:;
       long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
-      assert_perror (errno);
+      assert (errno == 0);
       assert (l == 0);
       cleanup_13_main ();
       abort ();
@@ -154,7 +154,7 @@ main (int argc __attribute__ ((unused)), char **argv)
   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);
index 8b19b9474c7a51b6c07f1c13d73a122884df5bf4..abd56ab66e3e90d947bc13e3edf1848a28dbb0f3 100644 (file)
@@ -263,16 +263,16 @@ prepare_thread (pid_t pid2 __attribute__ ((unused)),
   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);
@@ -340,7 +340,7 @@ exec_dump (const char *exec)
   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.
@@ -350,7 +350,7 @@ exec_dump (const char *exec)
      __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));