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
12char 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
21struct Symbolizer {
22 __attribute__((noinline)) ~Symbolizer() { Symbolize(); }
23};
24
25// NODEMANGLE: in _ZN10SymbolizerD2Ev
26// CHECK: in Symbolizer::~Symbolizer
27int main() {
28 Symbolizer();
29 return 0;
30}
31

source code of compiler-rt/test/sanitizer_common/TestCases/symbolize_pc_demangle.cpp