summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2017-04-24 13:35:47 +0200
committerMark Wielaard <mark@klomp.org>2017-05-02 15:04:58 +0200
commit727a90c38613b728d83a1e6c8aad3c6974047cc9 (patch)
treec0bdb1508456f479f3d9a91ffc4b08a9dbd985e3
parent575198c29a427392823cc8f2400579a23d06a875 (diff)
downloadelfutils-727a90c38613b728d83a1e6c8aad3c6974047cc9.tar.gz
Revert "Optionally allow unknown symbols in the backtrace tests"
This reverts commit f9971cb422df39adea7e8c7e22689b879e39c626. Allowing no symbol resolving at all makes it too hard to see whether the test actually tests anything. But do keep "address out of range" as allowed error in check_err. This can be interpreted as DWARF not available (if end of callstack marker is missing, which it unfortunately often is missing even if CFI is available.). Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/backtrace-subr.sh12
-rw-r--r--tests/backtrace.c30
3 files changed, 17 insertions, 31 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index c4e76d15..32dc48c8 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-24 Mark Wielaard <mark@klomp.org>
+
+ * backtrace.c: Remove option to allow unknown symbols in the trace.
+ * backtrace-substr.sh: Remove option to allow unknown symbols
+ to check_core() and allow failed symbol lookups in check_err().
+
2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
* run-readelf-dwz-multi.sh: Expect readelf to output "yes" for flags
diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh
index 5d3937c2..e746dc19 100644
--- a/tests/backtrace-subr.sh
+++ b/tests/backtrace-subr.sh
@@ -44,9 +44,6 @@ check_gsignal()
# In some cases we cannot reliably find out we got behind _start as some
# operating system do not properly terminate CFI by undefined PC.
# Ignore it here as it is a bug of OS, not a bug of elfutils.
-# If the CFI is not terminated correctly, we might find another frame by
-# checking for frame pointers. This is still not our problem, but only
-# gives an error message when trying to look up the function name.
check_err()
{
if [ $(egrep -v <$1 'dwfl_thread_getframes: (No DWARF information found|no matching address range|address out of range)$' \
@@ -64,9 +61,7 @@ check_all()
bt=$1
err=$2
testname=$3
- if [ "x$4" != "x--allow-unknown" ]; then
- check_main $bt $testname
- fi
+ check_main $bt $testname
check_gsignal $bt $testname
check_err $err $testname
}
@@ -103,14 +98,13 @@ check_native_unsupported()
check_core()
{
arch=$1
- args=$2
testfiles backtrace.$arch.{exec,core}
tempfiles backtrace.$arch.{bt,err}
echo ./backtrace ./backtrace.$arch.{exec,core}
- testrun ${abs_builddir}/backtrace $args -e ./backtrace.$arch.exec --core=./backtrace.$arch.core 1>backtrace.$arch.bt 2>backtrace.$arch.err || true
+ 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 $args
+ check_all backtrace.$arch.{bt,err} backtrace.$arch.core
}
# Backtrace live process.
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 34a2ab0b..1ff6353c 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -64,7 +64,6 @@ dump_modules (Dwfl_Module *mod, void **userdata __attribute__ ((unused)),
return DWARF_CB_OK;
}
-static bool allow_unknown;
static bool use_raise_jmp_patching;
static pid_t check_tid;
@@ -79,8 +78,7 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
seen_main = true;
if (pc == 0)
{
- if (!allow_unknown)
- assert (seen_main);
+ assert (seen_main);
return;
}
if (check_tid == 0)
@@ -105,12 +103,11 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
&& (strcmp (symname, "__kernel_vsyscall") == 0
|| strcmp (symname, "__libc_do_syscall") == 0))
reduce_frameno = true;
- else if (!allow_unknown || symname)
+ else
assert (symname && strcmp (symname, "raise") == 0);
break;
case 1:
- if (!allow_unknown || symname)
- assert (symname != NULL && strcmp (symname, "sigusr2") == 0);
+ assert (symname != NULL && strcmp (symname, "sigusr2") == 0);
break;
case 2: // x86_64 only
/* __restore_rt - glibc maybe does not have to have this symbol. */
@@ -119,24 +116,20 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
if (use_raise_jmp_patching)
{
/* Verify we trapped on the very first instruction of jmp. */
- if (!allow_unknown || symname)
- assert (symname != NULL && strcmp (symname, "jmp") == 0);
+ assert (symname != NULL && strcmp (symname, "jmp") == 0);
mod = dwfl_addrmodule (dwfl, pc - 1);
if (mod)
symname2 = dwfl_module_addrname (mod, pc - 1);
- if (!allow_unknown || symname2)
- assert (symname2 == NULL || strcmp (symname2, "jmp") != 0);
+ assert (symname2 == NULL || strcmp (symname2, "jmp") != 0);
break;
}
/* FALLTHRU */
case 4:
- if (!allow_unknown || symname)
- assert (symname != NULL && strcmp (symname, "stdarg") == 0);
+ assert (symname != NULL && strcmp (symname, "stdarg") == 0);
break;
case 5:
/* Verify we trapped on the very last instruction of child. */
- if (!allow_unknown || symname)
- assert (symname != NULL && strcmp (symname, "backtracegen") == 0);
+ assert (symname != NULL && strcmp (symname, "backtracegen") == 0);
mod = dwfl_addrmodule (dwfl, pc);
if (mod)
symname2 = dwfl_module_addrname (mod, pc);
@@ -145,7 +138,7 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
// there is no guarantee that the compiler doesn't reorder the
// instructions or even inserts some padding instructions at the end
// (which apparently happens on ppc64).
- if (use_raise_jmp_patching && (!allow_unknown || symname2))
+ if (use_raise_jmp_patching)
assert (symname2 == NULL || strcmp (symname2, "backtracegen") != 0);
break;
}
@@ -431,12 +424,10 @@ exec_dump (const char *exec)
}
#define OPT_BACKTRACE_EXEC 0x100
-#define OPT_ALLOW_UNKNOWN 0x200
static const struct argp_option options[] =
{
{ "backtrace-exec", OPT_BACKTRACE_EXEC, "EXEC", 0, N_("Run executable"), 0 },
- { "allow-unknown", OPT_ALLOW_UNKNOWN, 0, 0, N_("Allow unknown symbols"), 0 },
{ NULL, 0, NULL, 0, NULL, 0 }
};
@@ -454,10 +445,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
exec_dump (arg);
exit (0);
- case OPT_ALLOW_UNKNOWN:
- allow_unknown = true;
- break;
-
default:
return ARGP_ERR_UNKNOWN;
}
@@ -476,7 +463,6 @@ main (int argc __attribute__ ((unused)), char **argv)
(void) setlocale (LC_ALL, "");
elf_version (EV_CURRENT);
- allow_unknown = false;
Dwfl *dwfl = NULL;
const struct argp_child argp_children[] =