This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[COMMITTED] tests: vdsosyms should not fail for architectures that don't have a vdso.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 19 Dec 2014 18:56:14 +0100
- Subject: [COMMITTED] tests: vdsosyms should not fail for architectures that don't have a vdso.
Not finding a vdso is not fatal. But there should be no errors trying.
And if the vdso is found, then getting the symbol table shouldn't fail.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
tests/ChangeLog | 7 +++++++
tests/vdsosyms.c | 15 ++++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 89336da..94058fd 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,12 @@
2014-12-19 Mark Wielaard <mjw@redhat.com>
+ * vdsosyms.c (vdso_seen): Removed.
+ (vdso_syms): New global.
+ (module_callback): Set and check vdso_syms.
+ (main): Return value depends on vdso_syms.
+
+2014-12-19 Mark Wielaard <mjw@redhat.com>
+
* backtrace-subr.sh (check_native_unsupported): Relax special ARM
grep a little.
* run-deleted.sh: Call check_native_unsupported.
diff --git a/tests/vdsosyms.c b/tests/vdsosyms.c
index d04f36a..c1f8d89 100644
--- a/tests/vdsosyms.c
+++ b/tests/vdsosyms.c
@@ -34,7 +34,7 @@ main (int argc __attribute__ ((unused)), char **argv)
return 77;
}
#else /* __linux__ */
-static bool vdso_seen = false;
+static int vdso_syms = 0;
static int
module_callback (Dwfl_Module *mod, void **userdata __attribute__((unused)),
@@ -42,15 +42,15 @@ module_callback (Dwfl_Module *mod, void **userdata __attribute__((unused)),
void *arg __attribute__((unused)))
{
/* We can only recognize the vdso by inspecting the "magic name". */
+ printf ("module name: %s\n", name);
if (strncmp ("[vdso: ", name, 7) == 0)
{
- int syms = dwfl_module_getsymtab (mod);
- printf ("vdso syms: %d\n", syms);
- if (syms < 0)
+ vdso_syms = dwfl_module_getsymtab (mod);
+ printf ("vdso syms: %d\n", vdso_syms);
+ if (vdso_syms < 0)
error (2, 0, "dwfl_module_getsymtab: %s", dwfl_errmsg (-1));
- vdso_seen = true;
- for (int i = 0; i < syms; i++)
+ for (int i = 0; i < vdso_syms; i++)
{
GElf_Sym sym;
GElf_Addr addr;
@@ -102,7 +102,8 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
if (dwfl_getmodules (dwfl, module_callback, NULL, 0) != 0)
error (1, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1));
- return vdso_seen ? 0 : -1;
+ /* No symbols is ok, then we haven't seen the vdso at all on this arch. */
+ return vdso_syms >= 0 ? 0 : -1;
}
#endif /* ! __linux__ */
--
1.8.3.1