1 | // This test works on both MSVC and MinGW targets, but they require different |
2 | // build commands. By default we use DWARF debug info on MinGW and dbghelp does |
3 | // not support it, so we need to specify extra flags to get the compiler to |
4 | // generate PDB debug info. |
5 | |
6 | // RUN: %clangxx_asan %if target={{.*-windows-gnu}} %{ -gcodeview -gcolumn-info -Wl,--pdb= -ldbghelp %} -O0 %s -o %t |
7 | // RUN: %env_asan_opts=external_symbolizer_path=non-existent\\\\asdf not %run %t 2>&1 | FileCheck %s |
8 | |
9 | #include <windows.h> |
10 | #include <dbghelp.h> |
11 | |
12 | #pragma comment(lib, "dbghelp") |
13 | |
14 | int main() { |
15 | // Make sure the RTL recovers from "no options enabled" dbghelp setup. |
16 | SymSetOptions(0); |
17 | |
18 | // Make sure the RTL recovers from "fInvadeProcess=FALSE". |
19 | if (!SymInitialize(GetCurrentProcess(), 0, FALSE)) |
20 | return 42; |
21 | |
22 | *(volatile int*)0 = 42; |
23 | // CHECK: ERROR: AddressSanitizer: access-violation on unknown address |
24 | // CHECK: The signal is caused by a WRITE memory access. |
25 | // CHECK: Hint: address points to the zero page. |
26 | // CHECK: {{WARNING: .*DbgHelp}} |
27 | // CHECK: {{WARNING: Failed to use and restart external symbolizer}} |
28 | // CHECK: {{#0 0x.* in main.*report_after_syminitialize.cpp:}}[[@LINE-6]] |
29 | // CHECK: AddressSanitizer can not provide additional info. |
30 | } |
31 | |