diff options
| author | Mark Wielaard <[email protected]> | 2014-12-19 18:54:04 +0100 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2014-12-19 18:54:04 +0100 |
| commit | 7152afac3aebfecce605c49777bc841e01513a6c (patch) | |
| tree | f5cfa4b7700cd0942812d20feefdd920ac947bb8 | |
| parent | cdfc853b401f2897d470638d32fcc51520c13733 (diff) | |
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 <[email protected]>
| -rw-r--r-- | tests/ChangeLog | 7 | ||||
| -rw-r--r-- | tests/vdsosyms.c | 15 |
2 files changed, 15 insertions, 7 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 89336dab..94058fd6 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,12 @@ 2014-12-19 Mark Wielaard <[email protected]> + * 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 <[email protected]> + * 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 d04f36a1..c1f8d89f 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__ */ |
