public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: linux-pid-attach.c on non-Linux hosts
@ 2014-04-23 18:28 Mark Wielaard
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Wielaard @ 2014-04-23 18:28 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

On Wed, 2014-04-23 at 18:12 +0200, Kurt Roeckx wrote:
> On Wed, Apr 23, 2014 at 11:46:53AM +0200, Mark Wielaard wrote:
> > Aha. I think this is because you are using a /bin/sh that isn't bash and
> > has a 'test' that doesn't recognize '==' as string comparison. It should
> > use a single '='. Does the attach fix it for you?
> 
> Yes, that fixes it.

Great. Thanks for testing. Pushed to master.

Cheers,

Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux-pid-attach.c on non-Linux hosts
@ 2014-04-23 16:12 Kurt Roeckx
  0 siblings, 0 replies; 8+ messages in thread
From: Kurt Roeckx @ 2014-04-23 16:12 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]

On Wed, Apr 23, 2014 at 11:46:53AM +0200, Mark Wielaard wrote:
> > > > PS: run-nm-self.sh fails for me for current master.
> > > 
> > > How does it fail? Do you have a tests/run-nm-self.sh.log? Which arch?
> > 
> > File is attached.  This is on x86_64.
> 
> Aha. I think this is because you are using a /bin/sh that isn't bash and
> has a 'test' that doesn't recognize '==' as string comparison. It should
> use a single '='. Does the attach fix it for you?

Yes, that fixes it.


Kurt


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux-pid-attach.c on non-Linux hosts
@ 2014-04-23  9:46 Mark Wielaard
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Wielaard @ 2014-04-23  9:46 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]

On Wed, 2014-04-23 at 00:54 +0200, Kurt Roeckx wrote:
> On Wed, Apr 23, 2014 at 12:26:53AM +0200, Mark Wielaard wrote:
> > On Tue, 2014-04-22 at 21:52 +0200, Kurt Roeckx wrote:
> > > The attached patch seems to be working for me on kFreeBSD.
> > 
> > Looks reasonable to me. The other arch backends that provide an initregs
> > could probably use the same conditional (but that can wait till someone
> > actually needs it/can test it).
> > 
> > Would you mind looking at the CONTRIBUTING file and add a Signed-off-by
> > line if you agree with what is said there?
> 
> I forgot to add it, I only remembered after I mailed it.

Thanks, I have added it to the commit and pushed it to master. I am
afraid we will have to rely a little on you to make sure other stuff
doesn't break on non-GNU/Linux setups.

> > > PS: run-nm-self.sh fails for me for current master.
> > 
> > How does it fail? Do you have a tests/run-nm-self.sh.log? Which arch?
> 
> File is attached.  This is on x86_64.

Aha. I think this is because you are using a /bin/sh that isn't bash and
has a 'test' that doesn't recognize '==' as string comparison. It should
use a single '='. Does the attach fix it for you?

Cheers,

Mark

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-tests-run-nm-self.sh-use-test-not-for-string-compari.patch --]
[-- Type: text/x-patch, Size: 1422 bytes --]

>From 4233ec036ba079468456935af6345fbc6c39c1df Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Wed, 23 Apr 2014 09:54:30 +0200
Subject: [PATCH] tests: run-nm-self.sh use test = not == for string comparisons.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 tests/ChangeLog      |    4 ++++
 tests/run-nm-self.sh |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index afec07f..fc96284 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2014-03-23  Mark Wielaard  <mjw@redhat.com>
+
+	* run-nm-self.sh: Use test = not == for string comparisons.
+
 2014-03-14  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am: Remove MUDFLAP conditions. Remove libmudflap from all
diff --git a/tests/run-nm-self.sh b/tests/run-nm-self.sh
index dac8e27..6a31afc 100755
--- a/tests/run-nm-self.sh
+++ b/tests/run-nm-self.sh
@@ -27,7 +27,7 @@ for what_arg in --debug-syms --defined-only --dynamic --extern-only; do
     for out_arg in --numeric-sort --no-sort --reverse-sort; do
       for self_file in $ET_REL $ET_EXEC $ET_DYN; do
 	# --dynamic doesn't make sense for ET_REL.
-	if ! test "$what_arg" == "--dynamic" -a "$self_file" == "$ET_REL"; then
+	if ! test "$what_arg" = "--dynamic" -a "$self_file" = "$ET_REL"; then
 	  testrun ${abs_top_builddir}/src/nm $what_arg $format_arg $out_arg $self_file > /dev/null
 	fi
       done
-- 
1.7.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux-pid-attach.c on non-Linux hosts
@ 2014-04-22 22:54 Kurt Roeckx
  0 siblings, 0 replies; 8+ messages in thread
From: Kurt Roeckx @ 2014-04-22 22:54 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

On Wed, Apr 23, 2014 at 12:26:53AM +0200, Mark Wielaard wrote:
> On Tue, 2014-04-22 at 21:52 +0200, Kurt Roeckx wrote:
> > The attached patch seems to be working for me on kFreeBSD.
> 
> Looks reasonable to me. The other arch backends that provide an initregs
> could probably use the same conditional (but that can wait till someone
> actually needs it/can test it).
> 
> Would you mind looking at the CONTRIBUTING file and add a Signed-off-by
> line if you agree with what is said there?

I forgot to add it, I only remembered after I mailed it.

> > PS: run-nm-self.sh fails for me for current master.
> 
> How does it fail? Do you have a tests/run-nm-self.sh.log? Which arch?

File is attached.  This is on x86_64.


Kurt


[-- Attachment #2: run-nm-self.sh.log --]
[-- Type: text/plain, Size: 3545 bytes --]

./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --debug-syms: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --defined-only: unexpected operator
./run-nm-self.sh: 30: test: --dynamic: unexpected operator
/home/kurt/elfutils/git/src/nm: /home/kurt/elfutils/git/src/nm.o: Invalid operation

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux-pid-attach.c on non-Linux hosts
@ 2014-04-22 22:26 Mark Wielaard
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Wielaard @ 2014-04-22 22:26 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

On Tue, 2014-04-22 at 21:52 +0200, Kurt Roeckx wrote:
> The attached patch seems to be working for me on kFreeBSD.

Looks reasonable to me. The other arch backends that provide an initregs
could probably use the same conditional (but that can wait till someone
actually needs it/can test it).

Would you mind looking at the CONTRIBUTING file and add a Signed-off-by
line if you agree with what is said there?

> PS: run-nm-self.sh fails for me for current master.

How does it fail? Do you have a tests/run-nm-self.sh.log? Which arch?

Thanks,

Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux-pid-attach.c on non-Linux hosts
@ 2014-04-22 19:52 Kurt Roeckx
  0 siblings, 0 replies; 8+ messages in thread
From: Kurt Roeckx @ 2014-04-22 19:52 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]

On Tue, Apr 22, 2014 at 01:28:20PM +0200, Mark Wielaard wrote:
> Hi Kurt,
> 
> On Mon, 2014-04-21 at 22:39 +0200, Kurt Roeckx wrote:
> > It seems linux-pid-attach.c doesn't build on any of the non-Linux
> > hosts, which is probably normal given it's name.  FreeBSD has a
> > problem with the everything related to pthread while Hurd seems
> > to only have a problem with syscall __NR_tkill.
> > 
> > How do you suggest I deal with that?
> 
> I think libdwfl functions that rely on the specifics of GNU/Linux
> (kernel/modules, core file format, proc fs, signals/ptrace) can just
> return NULL and fail on other platforms. So just ifdef out the code in
> that file. And implement dwfl_linux_proc_attach and the internal
> functions __libdwfl_ptrace_attach __libdwfl_ptrace_detach
> dwfl_linux_proc_attach __libdwfl_get_pid_arg as always failing in that
> case.

The attached patch seems to be working for me on kFreeBSD.

PS: run-nm-self.sh fails for me for current master.


Kurt


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Unwinding-is-only-supported-on-Linux.patch --]
[-- Type: text/x-diff, Size: 8630 bytes --]

>From e3371ae553f2adcc869df8ff740f4fd189b88f71 Mon Sep 17 00:00:00 2001
From: Kurt Roeckx <kurt@roeckx.be>
Date: Tue, 22 Apr 2014 21:46:22 +0200
Subject: [PATCH] Unwinding is only supported on Linux

---
 backends/ChangeLog         |  5 +++
 backends/i386_initreg.c    |  2 +-
 backends/x86_64_initreg.c  |  2 +-
 libdwfl/ChangeLog          |  4 +++
 libdwfl/linux-pid-attach.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/ChangeLog            |  8 +++++
 tests/backtrace-child.c    | 15 ++++++++
 tests/backtrace-data.c     |  4 +--
 tests/backtrace-dwarf.c    | 15 ++++++++
 tests/backtrace-subr.sh    |  1 +
 tests/backtrace.c          | 15 ++++++++
 11 files changed, 152 insertions(+), 4 deletions(-)

diff --git a/backends/ChangeLog b/backends/ChangeLog
index 94290b7..748d0a0 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -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
diff --git a/backends/i386_initreg.c b/backends/i386_initreg.c
index 9e819a4..51fd9ea 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 0c49364..db9216e 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 e93d50c..1b2e13c 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -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.
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
index 6be578b..8aee721 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 afec07f..cf7b463 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -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
diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c
index 512aa23..788801c 100644
--- a/tests/backtrace-child.c
+++ b/tests/backtrace-child.c
@@ -79,6 +79,18 @@
 #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__ */
+
diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
index dd74160..01c1c00 100644
--- a/tests/backtrace-data.c
+++ b/tests/backtrace-data.c
@@ -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.  */
 
diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index f75e120..87d088a 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -25,6 +25,18 @@
 #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__ */
+
diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh
index 1df9356..875e0b6 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 758dfed..1a4709b 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -38,6 +38,18 @@
 #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__ */
+
-- 
1.9.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: linux-pid-attach.c on non-Linux hosts
@ 2014-04-22 11:28 Mark Wielaard
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Wielaard @ 2014-04-22 11:28 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

Hi Kurt,

On Mon, 2014-04-21 at 22:39 +0200, Kurt Roeckx wrote:
> It seems linux-pid-attach.c doesn't build on any of the non-Linux
> hosts, which is probably normal given it's name.  FreeBSD has a
> problem with the everything related to pthread while Hurd seems
> to only have a problem with syscall __NR_tkill.
> 
> How do you suggest I deal with that?

I think libdwfl functions that rely on the specifics of GNU/Linux
(kernel/modules, core file format, proc fs, signals/ptrace) can just
return NULL and fail on other platforms. So just ifdef out the code in
that file. And implement dwfl_linux_proc_attach and the internal
functions __libdwfl_ptrace_attach __libdwfl_ptrace_detach
dwfl_linux_proc_attach __libdwfl_get_pid_arg as always failing in that
case.

Cheers,

Mark


^ permalink raw reply	[flat|nested] 8+ messages in thread

* linux-pid-attach.c on non-Linux hosts
@ 2014-04-21 20:39 Kurt Roeckx
  0 siblings, 0 replies; 8+ messages in thread
From: Kurt Roeckx @ 2014-04-21 20:39 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

Hi,

It seems linux-pid-attach.c doesn't build on any of the non-Linux
hosts, which is probably normal given it's name.  FreeBSD has a
problem with the everything related to pthread while Hurd seems
to only have a problem with syscall __NR_tkill.

How do you suggest I deal with that?


Kurt


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-23 18:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-23 18:28 linux-pid-attach.c on non-Linux hosts Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2014-04-23 16:12 Kurt Roeckx
2014-04-23  9:46 Mark Wielaard
2014-04-22 22:54 Kurt Roeckx
2014-04-22 22:26 Mark Wielaard
2014-04-22 19:52 Kurt Roeckx
2014-04-22 11:28 Mark Wielaard
2014-04-21 20:39 Kurt Roeckx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).