This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[unwinder-portable] [patch 3/3] Older OS compatibility bits


Hi Mark,

this patch is for the branch 'portable' to be checked in wotj
'jankratochvil/unwindx86', that is for RHEL-5 systems.
It has been verified it is not needed on RHEL-6.

I guess these three patches can be checked into the 'portable' branch
together.


Thanks,
Jan

libdwfl/
2013-11-01  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Older OS compatibility bits.
	* linux-core-attach.c (be64toh, le64toh, be32toh, le32toh): Provide
	fallbacks if not defined by system.

tests/
2013-11-01  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Older OS compatibility bits.
	* backtrace-child.c (main): Ignore non-zero ERRNO after pthread_create.
	* run-backtrace.sh (check_err): Permit also No DWARF information found.

--- a/libdwfl/linux-core-attach.c
+++ b/libdwfl/linux-core-attach.c
@@ -29,6 +29,35 @@
 #include "libdwflP.h"
 #include <fcntl.h>
 #include "system.h"
+#include <endian.h>
+#include <byteswap.h>
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# ifndef be64toh
+#  define be64toh(x) bswap_64 (x)
+# endif
+# ifndef le64toh
+#  define le64toh(x) (x)
+# endif
+# ifndef be32toh
+#  define be32toh(x) bswap_32 (x)
+# endif
+# ifndef le32toh
+#  define le32toh(x) (x)
+# endif
+#else
+# ifndef be64toh
+#  define be64toh(x) (x)
+# endif
+# ifndef le64toh
+#  define le64toh(x) bswap_64 (x)
+# endif
+# ifndef be32toh
+#  define be32toh(x) (x)
+# endif
+# ifndef le32toh
+#  define le32toh(x) bswap_32 (x)
+# endif
+#endif
 
 #ifndef MIN
 # define MIN(a, b) ((a) < (b) ? (a) : (b))
--- a/tests/backtrace-child.c
+++ b/tests/backtrace-child.c
@@ -141,7 +141,7 @@ main (int argc UNUSED, char **argv)
   errno = 0;
   pthread_t thread;
   int i = pthread_create (&thread, NULL, start, NULL);
-  assert_perror (errno);
+  errno = 0; // assert_perror (errno); // RHEL-5 may set errno with i == 0
   assert (i == 0);
   if (ptraceme)
     {
--- a/tests/run-backtrace.sh
+++ b/tests/run-backtrace.sh
@@ -60,6 +60,10 @@ check_err()
   if cmp -s <(echo "${abs_builddir}/backtrace: dwfl_thread_getframes: no matching address range") <(uniq <$1); then
     return
   fi
+  if cmp -s <(echo "${abs_builddir}/backtrace: dwfl_thread_getframes: No DWARF information found";
+              echo "${abs_builddir}/backtrace: dwfl_thread_getframes: no matching address range") <(sort -u <$1); then
+    return
+  fi
   cat >&2 $1
   echo >&2 $2: neither empty nor just out of DWARF
   false

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]