[compiler-rt] r179306 - [asan] make heavy_uar_test even heavier
Kostya Serebryany
kcc at google.com
Thu Apr 11 11:27:02 PDT 2013
Author: kcc
Date: Thu Apr 11 13:27:02 2013
New Revision: 179306
URL: http://llvm.org/viewvc/llvm-project?rev=179306&view=rev
Log:
[asan] make heavy_uar_test even heavier
Modified:
compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc
Modified: compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc?rev=179306&r1=179305&r2=179306&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc Thu Apr 11 13:27:02 2013
@@ -22,22 +22,30 @@ char *LeakStack() {
return pretend_to_do_something(x);
}
+template<size_t kFrameSize>
__attribute__((noinline))
void RecuriveFunctionWithStackFrame(int depth) {
if (depth <= 0) return;
- char x[1024];
+ char x[kFrameSize];
x[0] = depth;
pretend_to_do_something(x);
- RecuriveFunctionWithStackFrame(depth - 1);
+ RecuriveFunctionWithStackFrame<kFrameSize>(depth - 1);
}
int main(int argc, char **argv) {
int n_iter = argc >= 2 ? atoi(argv[1]) : 1000;
int depth = argc >= 3 ? atoi(argv[2]) : 500;
- for (int i = 0; i < n_iter; i++)
- RecuriveFunctionWithStackFrame(depth);
+ for (int i = 0; i < n_iter; i++) {
+ RecuriveFunctionWithStackFrame<10>(depth);
+ RecuriveFunctionWithStackFrame<100>(depth);
+ RecuriveFunctionWithStackFrame<500>(depth);
+ RecuriveFunctionWithStackFrame<1024>(depth);
+ RecuriveFunctionWithStackFrame<2000>(depth);
+ RecuriveFunctionWithStackFrame<5000>(depth);
+ RecuriveFunctionWithStackFrame<10000>(depth);
+ }
char *stale_stack = LeakStack();
- RecuriveFunctionWithStackFrame(10);
+ RecuriveFunctionWithStackFrame<1024>(10);
stale_stack[100]++;
// CHECK: ERROR: AddressSanitizer: stack-use-after-return on address
// CHECK: is located in stack of thread T0 at offset 132 in frame
More information about the llvm-commits
mailing list