| 1 |
// UNSUPPORTED: lsan |
| 2 |
// This test fails with LSan enabled because the dladdr symbolizer actually leaks |
| 3 |
// memory because the call to `__sanitizer::DemangleCXXABI` leaks memory which LSan |
| 4 |
// detects (rdar://problem/42868950). |
| 5 |
|
| 6 |
// RUN: %clangxx %s -O0 -o %t |
| 7 |
// RUN: %env_tool_opts=verbosity=2,external_symbolizer_path=,stack_trace_format='"function_name:%f function_offset:%q"' %run %t > %t.output 2>&1 |
| 8 |
// RUN: FileCheck -input-file=%t.output %s |
| 9 |
#include <sanitizer/common_interface_defs.h> |
| 10 |
#include <stdio.h> |
| 11 |
|
| 12 |
void baz() { |
| 13 |
printf("Do stuff in baz\n"); |
| 14 |
__sanitizer_print_stack_trace(); |
| 15 |
} |
| 16 |
|
| 17 |
void bar() { |
| 18 |
printf("Do stuff in bar\n"); |
| 19 |
baz(); |
| 20 |
} |
| 21 |
|
| 22 |
void foo() { |
| 23 |
printf("Do stuff in foo\n"); |
| 24 |
bar(); |
| 25 |
} |
| 26 |
|
| 27 |
int main() { |
| 28 |
printf("Do stuff in main\n"); |
| 29 |
foo(); |
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
// CHECK: External symbolizer is explicitly disabled |
| 34 |
// CHECK: Using dladdr symbolizer |
| 35 |
|
| 36 |
// These `function_offset` patterns are designed to disallow `0x0` which is the |
| 37 |
// 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]*$}} |