| 1 | // UNSUPPORTED: ios |
| 2 | // FIXME(dliew): We currently have to use module map for this test due to the atos |
| 3 | // symbolizer changing the module name from an absolute path to just the file name. |
| 4 | // rdar://problem/49784442 |
| 5 | // |
| 6 | // Simulate partial symbolication (can happen with %L specifier) by printing |
| 7 | // out %L's fallback which will print the module name and offset instead of a |
| 8 | // source location. |
| 9 | // RUN: %clangxx_asan -O0 -g %s -o %t.executable |
| 10 | // RUN: %env_asan_opts=symbolize=1,print_module_map=1,stack_trace_format='" #%%n %%p %%F %%M"' not %run %t.executable > %t.log 2>&1 |
| 11 | // RUN: FileCheck -input-file=%t.log -check-prefix=CHECK-PS %s |
| 12 | // Now try to full symbolicate using the module map. |
| 13 | // RUN: %asan_symbolize --module-map %t.log --force-system-symbolizer < %t.log > %t.fully_symbolized |
| 14 | // RUN: FileCheck -input-file=%t.fully_symbolized -check-prefix=CHECK-FS %s |
| 15 | |
| 16 | #include <cstdlib> |
| 17 | |
| 18 | // Partially symbolicated back-trace where symbol is available but |
| 19 | // source location is not and instead module name and offset are |
| 20 | // printed. |
| 21 | // CHECK-PS: WRITE of size 4 |
| 22 | // CHECK-PS: #0 0x{{.+}} in foo ({{.+}}.executable:{{.+}}+0x{{.+}}) |
| 23 | // CHECK-PS: #1 0x{{.+}} in main ({{.+}}.executable:{{.+}}+0x{{.+}}) |
| 24 | |
| 25 | // CHECK-FS: WRITE of size 4 |
| 26 | |
| 27 | extern "C" void foo(int* a) { |
| 28 | // CHECK-FS: #0 0x{{.+}} in foo {{.*}}asan-symbolize-partial-report-with-module-map.cpp:[[@LINE+1]] |
| 29 | *a = 5; |
| 30 | } |
| 31 | |
| 32 | int main() { |
| 33 | int* a = (int*) malloc(size: sizeof(int)); |
| 34 | if (!a) |
| 35 | return 0; |
| 36 | free(ptr: a); |
| 37 | // CHECK-FS: #1 0x{{.+}} in main {{.*}}asan-symbolize-partial-report-with-module-map.cpp:[[@LINE+1]] |
| 38 | foo(a); |
| 39 | return 0; |
| 40 | } |
| 41 | |