Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / symbolize_pc_demangle.cpp
blob6e035c16a30459470fb3b9b34ccc4c3fc582b167
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
6 // XFAIL: darwin
8 #include <sanitizer/common_interface_defs.h>
9 #include <stdio.h>
10 #include <string.h>
12 char buffer[10000];
14 __attribute__((noinline)) static void Symbolize() {
15 __sanitizer_symbolize_pc(__sanitizer_return_address(), "%p %F %L", buffer,
16 sizeof(buffer));
17 for (char *p = buffer; strlen(p); p += strlen(p) + 1)
18 printf("%s\n", p);
21 struct Symbolizer {
22 __attribute__((noinline)) ~Symbolizer() { Symbolize(); }
25 // NODEMANGLE: in _ZN10SymbolizerD2Ev
26 // CHECK: in Symbolizer::~Symbolizer
27 int main() {
28 Symbolizer();
29 return 0;