39 lines · cpp
1// UNSUPPORTED: ios2// When `external_symbolizer_path` is empty on Darwin we fallback on using3// dladdr as the symbolizer which means we get the symbol name4// but no source location. The current implementation also doesn't try to5// change the module name so we end up with the full name so we actually don't6// need the module map here.7 8// RUN: %clangxx_asan -O0 -g %s -o %t.executable9// RUN: %env_asan_opts=symbolize=1,print_module_map=0,external_symbolizer_path= not %run %t.executable > %t2.log 2>&110// RUN: FileCheck -input-file=%t2.log -check-prefix=CHECK-PS %s11// RUN: %asan_symbolize --force-system-symbolizer < %t2.log > %t2.fully_symbolized12// RUN: FileCheck -input-file=%t2.fully_symbolized -check-prefix=CHECK-FS %s13 14#include <cstdlib>15 16// Partially symbolicated back-trace where symbol is available but17// source location is not and instead module name and offset are18// printed.19// CHECK-PS: WRITE of size 420// CHECK-PS: #0 0x{{.+}} in foo{{(\+0x[0-9a-f]+)?}} ({{.+}}.executable:{{.+}}+0x{{.+}})21// CHECK-PS: #1 0x{{.+}} in main{{(\+0x[0-9a-f]+)?}} ({{.+}}.executable:{{.+}}+0x{{.+}})22 23// CHECK-FS: WRITE of size 424 25extern "C" void foo(int* a) {26 // CHECK-FS: #0 0x{{.+}} in foo {{.*}}asan-symbolize-partial-report-no-external-symbolizer.cpp:[[@LINE+1]]27 *a = 5;28}29 30int main() {31 int* a = (int*) malloc(sizeof(int));32 if (!a)33 return 0;34 free(a);35 // CHECK-FS: #1 0x{{.+}} in main {{.*}}asan-symbolize-partial-report-no-external-symbolizer.cpp:[[@LINE+1]]36 foo(a);37 return 0;38}39