summaryrefslogtreecommitdiffstats
path: root/tests/backtrace.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2013-12-21 19:39:19 +0100
committerMark Wielaard <[email protected]>2013-12-21 19:39:19 +0100
commitb6ef1ce4695cea00d097c7fcac8d0014ff01a5bf (patch)
tree9b0506c388ee17b1e2659e394bc3334a224ab33a /tests/backtrace.c
parent641a4f62f1f1940540f1202c1e1aa5ce8c508234 (diff)
tests: backtrace.c only check we caught the last instruction on x86_64.
On some architectures gcc might introduce some "padding instructions" at the end of the function (like on ppc64). So only assert we are at the last instruction of backtracegen if on x86_64 native. In theory the assert could even fail on that architectures, but in practice it doesn't and it is a nice test to have. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests/backtrace.c')
-rw-r--r--tests/backtrace.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 06d38782..8a7d6dfc 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -118,7 +118,13 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
mod = dwfl_addrmodule (dwfl, pc);
if (mod)
symname2 = dwfl_module_addrname (mod, pc);
- assert (symname2 == NULL || strcmp (symname2, "backtracegen") != 0);
+
+ // Note that the following assert might in theory even fail on x86_64,
+ // 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 (is_x86_64_native)
+ assert (symname2 == NULL || strcmp (symname2, "backtracegen") != 0);
break;
}
}