libdwfl: Record dwfl_attach_state error and return it on failure.

When dwfl_attach_state fails functions that need the process state should
return the error that caused the attach to fail. Use this in the backtrace
test to signal any attach failure. This makes sure that architectures that
don't provide unwinder support get properly detected (and the tests SKIPs)
Also don't assert when trying to attach a non-core ELF file, but return an
error to indicate failure.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/tests/ChangeLog b/tests/ChangeLog
index bb0ad0d..cd8a8e7 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-11  Mark Wielaard  <mjw@redhat.com>
+
+	* backtrace.c (main): Check that Dwfl was attached by calling
+	dwfl_pid and printing the error when it is not.
+
 2014-05-18  Mark Wielaard  <mjw@redhat.com>
 
 	* testfile-backtrace-demangle.cc (cxxfunc): Make non-static.