42 lines · cpp
1// UNSUPPORTED: lsan2// This test fails with LSan enabled because the dladdr symbolizer actually leaks3// memory because the call to `__sanitizer::DemangleCXXABI` leaks memory which LSan4// detects (rdar://problem/42868950).5 6// RUN: %clangxx %s -O0 -o %t7// RUN: %env_tool_opts=verbosity=2,external_symbolizer_path=,stack_trace_format='"function_name:%f function_offset:%q"' %run %t > %t.output 2>&18// RUN: FileCheck -input-file=%t.output %s9#include <sanitizer/common_interface_defs.h>10#include <stdio.h>11 12void baz() {13 printf("Do stuff in baz\n");14 __sanitizer_print_stack_trace();15}16 17void bar() {18 printf("Do stuff in bar\n");19 baz();20}21 22void foo() {23 printf("Do stuff in foo\n");24 bar();25}26 27int main() {28 printf("Do stuff in main\n");29 foo();30 return 0;31}32 33// CHECK: External symbolizer is explicitly disabled34// CHECK: Using dladdr symbolizer35 36// These `function_offset` patterns are designed to disallow `0x0` which is the37// value printed for `kUnknown`.38// CHECK: function_name:baz{{(\(\))?}} function_offset:0x{{0*[1-9a-f][0-9a-f]*$}}39// CHECK: function_name:bar{{(\(\))?}} function_offset:0x{{0*[1-9a-f][0-9a-f]*$}}40// CHECK: function_name:foo{{(\(\))?}} function_offset:0x{{0*[1-9a-f][0-9a-f]*$}}41// CHECK: function_name:main{{(\(\))?}} function_offset:0x{{0*[1-9a-f][0-9a-f]*$}}42