174989affSNico Weber // RUN: %clangxx -O3 %s -o %t 274989affSNico Weber // RUN: %env_tool_opts=strip_path_prefix=/TestCases/ %run %t 2>&1 | FileCheck %s 34316859eSVitaly Buka // RUN: %env_tool_opts=strip_path_prefix=/TestCases/:symbolize_inline_frames=0 %run %t 2>&1 | FileCheck %s --check-prefixes=NOINLINE 44316859eSVitaly Buka // RUN: %env_tool_opts=strip_path_prefix=/TestCases/:symbolize_inline_frames=1 %run %t 2>&1 | FileCheck %s 574989affSNico Weber 674989affSNico Weber // XFAIL: darwin 774989affSNico Weber 874989affSNico Weber #include <sanitizer/common_interface_defs.h> 974989affSNico Weber #include <stdio.h> 1074989affSNico Weber #include <string.h> 1174989affSNico Weber 1274989affSNico Weber char buffer[10000]; 1374989affSNico Weber Symbolize()1474989affSNico Weber__attribute__((noinline)) static void Symbolize() { 15*d83c9005SRainer Orth __sanitizer_symbolize_pc(__sanitizer_return_address(), "%p %F %L", buffer, 1674989affSNico Weber sizeof(buffer)); 1774989affSNico Weber for (char *p = buffer; strlen(p); p += strlen(p) + 1) 1874989affSNico Weber printf("%s\n", p); 1974989affSNico Weber } 2074989affSNico Weber 214316859eSVitaly Buka // NOINLINE: {{0x[0-9a-f]+}} in main symbolize_pc_inline.cpp:[[@LINE+2]] 2274989affSNico Weber // CHECK: [[ADDR:0x[0-9a-f]+]] in C2 symbolize_pc_inline.cpp:[[@LINE+1]] C2()2374989affSNico Weberstatic inline void C2() { Symbolize(); } 2474989affSNico Weber 2574989affSNico Weber // CHECK: [[ADDR]] in C3 symbolize_pc_inline.cpp:[[@LINE+1]] C3()2674989affSNico Weberstatic inline void C3() { C2(); } 2774989affSNico Weber 2874989affSNico Weber // CHECK: [[ADDR]] in C4 symbolize_pc_inline.cpp:[[@LINE+1]] C4()2974989affSNico Weberstatic inline void C4() { C3(); } 3074989affSNico Weber 3174989affSNico Weber // CHECK: [[ADDR]] in main symbolize_pc_inline.cpp:[[@LINE+1]] main()3274989affSNico Weberint main() { C4(); } 33