test: fix test under ASAN and MSAN
When we're running tests under ASAN or MSAN, they're compiled with -O1, which
enables tail call elimination. This causes backtrace_test to fail: the compiler
performs tail call elimination for call3_nothrow, but it can't for call3_throw,
leading to a mismatched frame count. Disable tail call elimination (and
inlining, just to be explicit) to avoid this.
Patch by Shoaib Meenai!
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@279935 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/backtrace_test.pass.cpp b/test/backtrace_test.pass.cpp
index 9954e8b..80346c0 100644
--- a/test/backtrace_test.pass.cpp
+++ b/test/backtrace_test.pass.cpp
@@ -21,6 +21,7 @@
return _URC_NO_REASON;
}
+__attribute__ ((__noinline__))
void call3_throw(size_t* ntraced) {
try {
_Unwind_Backtrace(trace_function, ntraced);
@@ -29,10 +30,12 @@
}
}
+__attribute__ ((__noinline__, __disable_tail_calls__))
void call3_nothrow(size_t* ntraced) {
_Unwind_Backtrace(trace_function, ntraced);
}
+__attribute__ ((__noinline__, __disable_tail_calls__))
void call2(size_t* ntraced, bool do_throw) {
if (do_throw) {
call3_throw(ntraced);
@@ -41,6 +44,7 @@
}
}
+__attribute__ ((__noinline__, __disable_tail_calls__))
void call1(size_t* ntraced, bool do_throw) {
call2(ntraced, do_throw);
}