summaryrefslogtreecommitdiffstats
path: root/tests/backtrace.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-06-11 15:14:23 +0200
committerMark Wielaard <[email protected]>2014-06-11 15:31:41 +0200
commit14beac3b6f22b8d7a054980f74c4f8d33b969fc4 (patch)
tree829d37f7f338c037c35e82d43fa86e34b1977324 /tests/backtrace.c
parent824f393411acc4596ab557b6e7bff9e48c61f951 (diff)
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 <[email protected]>
Diffstat (limited to 'tests/backtrace.c')
-rw-r--r--tests/backtrace.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 1a4709b9..ce0bd17d 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -1,5 +1,5 @@
/* Test program for unwinding of frames.
- Copyright (C) 2013 Red Hat, Inc.
+ Copyright (C) 2013, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -459,6 +459,9 @@ main (int argc __attribute__ ((unused)), char **argv)
};
(void) argp_parse (&argp, argc, argv, 0, NULL, &dwfl);
assert (dwfl != NULL);
+ /* We want to make sure the dwfl was properly attached. */
+ if (dwfl_pid (dwfl) < 0)
+ error (2, 0, "dwfl_pid: %s", dwfl_errmsg (-1));
dump (dwfl);
dwfl_end (dwfl);
return 0;