xref: /llvm-project/compiler-rt/test/asan/TestCases/Windows/symbols_path.cpp (revision 53a81d4d26f0409de8a0655d7af90f2bea222a12)
1 // Make sure symbolization works even if the path to the .exe file changes.
2 // RUN: mkdir %t || true
3 // RUN: %clang_cl_asan %Od %s %Fe%t/symbols_path.exe
4 // RUN: not %run %t/symbols_path.exe 2>&1 | FileCheck %s
5 // RUN: mkdir %t2 || true
6 // RUN: mv %t/* %t2
7 // RUN: not %run %t2/symbols_path.exe 2>&1 | FileCheck %s
8 
9 #include <malloc.h>
10 
11 int main() {
12   char *buffer = (char*)malloc(42);
13   buffer[-1] = 42;
14   // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
15   // CHECK: WRITE of size 1 at [[ADDR]] thread T0
16   // CHECK-NEXT: {{#0 .* main .*symbols_path.cpp}}:[[@LINE-3]]
17   // CHECK: [[ADDR]] is located 1 bytes before 42-byte region
18   // CHECK: allocated by thread T0 here:
19   // CHECK-NEXT: {{#0 .* malloc}}
20   // CHECK: {{ #[1-3] .* main .*symbols_path.cpp}}:[[@LINE-8]]
21   free(buffer);
22 }
23