1 | // RUN: %clangxx -O1 -fno-omit-frame-pointer %s -o %t |
2 | // RUN: %env_tool_opts=strip_path_prefix=/TestCases/ %run %t 2>&1 | FileCheck %s |
3 | // RUN: %env_tool_opts=strip_path_prefix=/TestCases/:demangle=0 %run %t 2>&1 | FileCheck %s --check-prefixes=NODEMANGLE |
4 | // RUN: %env_tool_opts=strip_path_prefix=/TestCases/:demangle=1 %run %t 2>&1 | FileCheck %s |
5 | |
6 | // XFAIL: darwin |
7 | |
8 | #include <sanitizer/common_interface_defs.h> |
9 | #include <stdio.h> |
10 | #include <string.h> |
11 | |
12 | char buffer[10000]; |
13 | |
14 | __attribute__((noinline)) static void Symbolize() { |
15 | __sanitizer_symbolize_pc(__sanitizer_return_address(), fmt: "%p %F %L" , out_buf: buffer, |
16 | out_buf_size: sizeof(buffer)); |
17 | for (char *p = buffer; strlen(s: p); p += strlen(s: p) + 1) |
18 | printf(format: "%s\n" , p); |
19 | } |
20 | |
21 | struct Symbolizer { |
22 | __attribute__((noinline)) ~Symbolizer() { Symbolize(); } |
23 | }; |
24 | |
25 | // NODEMANGLE: in _ZN10SymbolizerD2Ev |
26 | // CHECK: in Symbolizer::~Symbolizer |
27 | int main() { |
28 | Symbolizer(); |
29 | return 0; |
30 | } |
31 | |