From: Kurt Roeckx Date: Tue, 22 Apr 2014 19:46:22 +0000 (+0200) Subject: Unwinding is only supported on Linux X-Git-Tag: elfutils-0.159~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02cefdaa6429e620d6457fdb3ad9934f194c5a93;p=thirdparty%2Felfutils.git Unwinding is only supported on Linux Signed-off-by: Kurt Roeckx --- diff --git a/backends/ChangeLog b/backends/ChangeLog index 94290b7c6..748d0a06d 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,8 @@ +2014-04-22 Kurt Roeckx + + * i386_initreg.c: Make Linux only. + * x86_64_initreg.c: Make Linux only. + 2014-04-13 Mark Wielaard * Makefile.am: Remove libelf and libdw definitions when MUDFLAP diff --git a/backends/i386_initreg.c b/backends/i386_initreg.c index 9e819a474..51fd9ea60 100644 --- a/backends/i386_initreg.c +++ b/backends/i386_initreg.c @@ -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; diff --git a/backends/x86_64_initreg.c b/backends/x86_64_initreg.c index 0c4936405..db9216ed6 100644 --- a/backends/x86_64_initreg.c +++ b/backends/x86_64_initreg.c @@ -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; diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index e93d50c0d..1b2e13c35 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2014-04-22 Kurt Roeckx + + * linux-pid-attach.c: Make linux only. + 2014-03-14 Mark Wielaard * Makefile.am: Remove !MUDFLAP and MUDFLAP conditions. diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c index 6be578bbc..8aee72116 100644 --- a/libdwfl/linux-pid-attach.c +++ b/libdwfl/linux-pid-attach.c @@ -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 __ */ + diff --git a/tests/ChangeLog b/tests/ChangeLog index afec07fb2..cf7b46350 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2014-04-22 Kurt Roeckx + + * 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 * Makefile.am: Remove MUDFLAP conditions. Remove libmudflap from all diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c index 512aa2382..788801c34 100644 --- a/tests/backtrace-child.c +++ b/tests/backtrace-child.c @@ -79,6 +79,18 @@ #include #include +#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__ */ + diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c index dd74160a1..01c1c0040 100644 --- a/tests/backtrace-data.c +++ b/tests/backtrace-data.c @@ -40,7 +40,7 @@ #include #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. */ diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c index f75e12024..87d088aa4 100644 --- a/tests/backtrace-dwarf.c +++ b/tests/backtrace-dwarf.c @@ -25,6 +25,18 @@ #include #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__ */ + diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh index 1df935648..875e0b68a 100644 --- a/tests/backtrace-subr.sh +++ b/tests/backtrace-subr.sh @@ -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 } diff --git a/tests/backtrace.c b/tests/backtrace.c index 758dfed6c..1a4709b9d 100644 --- a/tests/backtrace.c +++ b/tests/backtrace.c @@ -38,6 +38,18 @@ #include #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__ */ +