]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Unwinding is only supported on Linux
authorKurt Roeckx <kurt@roeckx.be>
Tue, 22 Apr 2014 19:46:22 +0000 (21:46 +0200)
committerMark Wielaard <mjw@redhat.com>
Wed, 23 Apr 2014 08:56:01 +0000 (10:56 +0200)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
backends/ChangeLog
backends/i386_initreg.c
backends/x86_64_initreg.c
libdwfl/ChangeLog
libdwfl/linux-pid-attach.c
tests/ChangeLog
tests/backtrace-child.c
tests/backtrace-data.c
tests/backtrace-dwarf.c
tests/backtrace-subr.sh
tests/backtrace.c

index 94290b7c6893520180062c40ec579f2654c28eeb..748d0a06ddc363cd06cb7b5743a68435d508e16d 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-22  Kurt Roeckx  <kurt@roeckx.be>
+
+       * i386_initreg.c: Make Linux only.
+       * x86_64_initreg.c: Make Linux only.
+
 2014-04-13  Mark Wielaard  <mjw@redhat.com>
 
        * Makefile.am: Remove libelf and libdw definitions when MUDFLAP
index 9e819a474a8185308b066328d7117dd83e69aef9..51fd9ea60f23b0adc39f916a92e3ed0a4e995878 100644 (file)
@@ -44,7 +44,7 @@ i386_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
                          ebl_tid_registers_t *setfunc __attribute__ ((unused)),
                                void *arg __attribute__ ((unused)))
 {
-#if !defined __i386__ && !defined __x86_64__
+#if (!defined __i386__ && !defined __x86_64__) || !defined(__linux__)
   return false;
 #else /* __i386__ || __x86_64__ */
   struct user_regs_struct user_regs;
index 0c4936405cd2f07551623fd31542df2f837b452f..db9216ed6044bcecdfaaabe6cd66d5331709b8eb 100644 (file)
@@ -44,7 +44,7 @@ x86_64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
                          ebl_tid_registers_t *setfunc __attribute__ ((unused)),
                                  void *arg __attribute__ ((unused)))
 {
-#ifndef __x86_64__
+#if !defined(__x86_64__) || !defined(__linux__)
   return false;
 #else /* __x86_64__ */
   struct user_regs_struct user_regs;
index e93d50c0d43f82075693a2372e7b5c741556ccee..1b2e13c35bca1d33fe64fcaca46ca74f0e163ac7 100644 (file)
@@ -1,3 +1,7 @@
+2014-04-22  Kurt Roeckx  <kurt@roeckx.be>
+
+       * linux-pid-attach.c: Make linux only.
+
 2014-03-14  Mark Wielaard  <mjw@redhat.com>
 
        * Makefile.am: Remove !MUDFLAP and MUDFLAP conditions.
index 6be578bbc9127ebca6b53a53df1bfc6c3893cf3d..8aee721169ee052f3a56ee6c27f27d7db6fe56be 100644 (file)
@@ -37,6 +37,7 @@
 # define MAX(a, b) ((a) > (b) ? (a) : (b))
 #endif
 
+#ifdef __linux__
 
 static bool
 linux_proc_pid_is_stopped (pid_t pid)
@@ -354,3 +355,87 @@ __libdwfl_get_pid_arg (Dwfl *dwfl)
 
   return NULL;
 }
+
+#else  /* __linux__ */
+
+static pid_t
+pid_next_thread (Dwfl *dwfl __attribute__ ((unused)),
+                void *dwfl_arg __attribute__ ((unused)),
+                void **thread_argp __attribute__ ((unused)))
+{
+  errno = ENOSYS;
+  __libdwfl_seterrno (DWFL_E_ERRNO);
+  return -1;
+}
+
+static bool
+pid_getthread (Dwfl *dwfl __attribute__ ((unused)),
+              pid_t tid __attribute__ ((unused)),
+              void *dwfl_arg __attribute__ ((unused)),
+              void **thread_argp __attribute__ ((unused)))
+{
+  errno = ENOSYS;
+  __libdwfl_seterrno (DWFL_E_ERRNO);
+  return false;
+}
+
+static bool
+pid_memory_read (Dwfl *dwfl __attribute__ ((unused)),
+                 Dwarf_Addr addr __attribute__ ((unused)),
+                Dwarf_Word *result __attribute__ ((unused)),
+                void *arg __attribute__ ((unused)))
+{
+  errno = ENOSYS;
+  __libdwfl_seterrno (DWFL_E_ERRNO);
+  return false;
+}
+
+static bool
+pid_set_initial_registers (Dwfl_Thread *thread __attribute__ ((unused)),
+                          void *thread_arg __attribute__ ((unused)))
+{
+  errno = ENOSYS;
+  __libdwfl_seterrno (DWFL_E_ERRNO);
+  return false;
+}
+
+static void
+pid_detach (Dwfl *dwfl __attribute__ ((unused)),
+           void *dwfl_arg __attribute__ ((unused)))
+{
+}
+
+static void
+pid_thread_detach (Dwfl_Thread *thread __attribute__ ((unused)),
+                 void *thread_arg __attribute__ ((unused)))
+{
+}
+
+static const Dwfl_Thread_Callbacks pid_thread_callbacks =
+{
+  pid_next_thread,
+  pid_getthread,
+  pid_memory_read,
+  pid_set_initial_registers,
+  pid_detach,
+  pid_thread_detach,
+};
+
+int
+dwfl_linux_proc_attach (Dwfl *dwfl __attribute__ ((unused)),
+                       pid_t pid __attribute__ ((unused)),
+                       bool assume_ptrace_stopped __attribute__ ((unused)))
+{
+  return ENOSYS;
+}
+INTDEF (dwfl_linux_proc_attach)
+
+struct __libdwfl_pid_arg *
+internal_function
+__libdwfl_get_pid_arg (Dwfl *dwfl __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+#endif /* ! __linux __ */
+
index afec07fb25c0d708746c97e6e552b412d68a5daf..cf7b4635031b30caea4f2a5ebddebcfc52fbde19 100644 (file)
@@ -1,3 +1,11 @@
+2014-04-22  Kurt Roeckx  <kurt@roeckx.be>
+
+       * backtrace.c: Make Linux only.
+       * backtrace-child.c: Make Linux only.
+       * backtrace-data.c: Make Linux only.
+       * backtrace-dwarf.c: Make Linux only.
+       * backtrace-subr.sh: Skip core file unwinding tests when not supported.
+
 2014-03-14  Mark Wielaard  <mjw@redhat.com>
 
        * Makefile.am: Remove MUDFLAP conditions. Remove libmudflap from all
index 512aa2382c9ca7192baf0ff832dcc584b831118d..788801c34a4bd79bd348f8a6ec6318229ec5cf0e 100644 (file)
 #include <stdio.h>
 #include <unistd.h>
 
+#ifndef __linux__
+
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+  fprintf (stderr, "%s: Unwinding not supported for this architecture\n",
+           argv[0]);
+  return 77;
+}
+
+#else /* __linux__ */
+
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 #define NOINLINE_NOCLONE __attribute__ ((noinline, noclone))
 #else
@@ -223,3 +235,6 @@ main (int argc UNUSED, char **argv)
     raise (SIGUSR2);
   return 0;
 }
+
+#endif /* ! __linux__ */
+
index dd74160a11b1765757af98ab7642016ac4556647..01c1c0040702cf2f1eb9f70248642d4f3df9a552 100644 (file)
@@ -40,7 +40,7 @@
 #include <string.h>
 #include ELFUTILS_HEADER(dwfl)
 
-#ifndef __x86_64__
+#if !defined(__x86_64__) || !defined(__linux__)
 
 int
 main (int argc __attribute__ ((unused)), char **argv)
@@ -50,7 +50,7 @@ main (int argc __attribute__ ((unused)), char **argv)
   return 77;
 }
 
-#else /* __x86_64__ */
+#else /* __x86_64__ && __linux__ */
 
 /* The only arch specific code is set_initial_registers.  */
 
index f75e12024dde232d7f2c215788f014e87c25538a..87d088aa4db3fd04f887156416b00b5c8961c28e 100644 (file)
 #include <sys/ptrace.h>
 #include ELFUTILS_HEADER(dwfl)
 
+#ifndef __linux__
+
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+  fprintf (stderr, "%s: Unwinding not supported for this architecture\n",
+           argv[0]);
+  return 77;
+}
+
+#else /* __linux__ */
+
 static void cleanup_13_abort (void);
 #define main cleanup_13_main
 #include "cleanup-13.c"
@@ -148,3 +160,6 @@ main (int argc __attribute__ ((unused)), char **argv)
   /* There is an exit (0) call if we find the "main" frame,  */
   error (1, 0, "dwfl_getthreads: %s", dwfl_errmsg (-1));
 }
+
+#endif /* ! __linux__ */
+
index 1df9356486ce137c9fff94b877f9413bdc415619..875e0b68a442121b25de563bce08692fe87fb18e 100644 (file)
@@ -96,6 +96,7 @@ check_core()
   echo ./backtrace ./backtrace.$arch.{exec,core}
   testrun ${abs_builddir}/backtrace -e ./backtrace.$arch.exec --core=./backtrace.$arch.core 1>backtrace.$arch.bt 2>backtrace.$arch.err || true
   cat backtrace.$arch.{bt,err}
+  check_unsupported backtrace.$arch.err backtrace.$arch.core
   check_all backtrace.$arch.{bt,err} backtrace.$arch.core
 }
 
index 758dfed6c9fc9d9179465c2790b7bba7f0dc0beb..1a4709b9df1ade126aad14f4694c045835f58c3a 100644 (file)
 #include <argp.h>
 #include ELFUTILS_HEADER(dwfl)
 
+#ifndef __linux__
+
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+  fprintf (stderr, "%s: Unwinding not supported for this architecture\n",
+          argv[0]);
+  return 77;
+}
+
+#else /* __linux__ */
+
 static int
 dump_modules (Dwfl_Module *mod, void **userdata __attribute__ ((unused)),
              const char *name, Dwarf_Addr start,
@@ -451,3 +463,6 @@ main (int argc __attribute__ ((unused)), char **argv)
   dwfl_end (dwfl);
   return 0;
 }
+
+#endif /* ! __linux__ */
+