brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · c9a9c45 Raw
41 lines · cpp
1// UNSUPPORTED: ios2// FIXME(dliew): We currently have to use module map for this test due to the atos3// symbolizer changing the module name from an absolute path to just the file name.4// rdar://problem/497844425//6// Simulate partial symbolication (can happen with %L specifier) by printing7// out %L's fallback which will print the module name and offset instead of a8// source location.9// RUN: %clangxx_asan -O0 -g %s -o %t.executable10// RUN: %env_asan_opts=symbolize=1,print_module_map=1,stack_trace_format='"    #%%n %%p %%F %%M"' not %run %t.executable > %t.log 2>&111// RUN: FileCheck -input-file=%t.log -check-prefix=CHECK-PS %s12// Now try to full symbolicate using the module map.13// RUN: %asan_symbolize --module-map %t.log --force-system-symbolizer < %t.log > %t.fully_symbolized14// RUN: FileCheck -input-file=%t.fully_symbolized -check-prefix=CHECK-FS %s15 16#include <cstdlib>17 18// Partially symbolicated back-trace where symbol is available but19// source location is not and instead module name and offset are20// printed.21// CHECK-PS: WRITE of size 422// CHECK-PS: #0 0x{{.+}} in foo ({{.+}}.executable:{{.+}}+0x{{.+}})23// CHECK-PS: #1 0x{{.+}} in main ({{.+}}.executable:{{.+}}+0x{{.+}})24 25// CHECK-FS: WRITE of size 426 27extern "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 32int main() {33  int* a = (int*) malloc(sizeof(int));34  if (!a)35    return 0;36  free(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