1 | // RUN: %clangxx %s -o %t |
2 | // RUN: %env_tool_opts=enable_symbolizer_markup=1 %run %t 2>&1 | FileCheck %s |
3 | |
4 | // REQUIRES: linux |
5 | #include <sanitizer/common_interface_defs.h> |
6 | |
7 | void Bar() { __sanitizer_print_stack_trace(); } |
8 | |
9 | void Foo() { |
10 | Bar(); |
11 | return; |
12 | } |
13 | |
14 | void Baz() { __sanitizer_print_stack_trace(); } |
15 | |
16 | int main() { |
17 | Foo(); |
18 | Baz(); |
19 | return 0; |
20 | } |
21 | |
22 | // COM: For element syntax see: https://llvm.org/docs/SymbolizerMarkupFormat.html |
23 | // COM: OPEN is {{{ and CLOSE is }}} |
24 | |
25 | // CHECK: [[OPEN:{{{]]reset[[CLOSE:}}}]] |
26 | // CHECK: [[OPEN]]module:[[MOD_ID:[0-9]+]]:{{.+}}:elf:{{[0-9a-fA-F]+}}[[CLOSE]] |
27 | // CHECK: [[OPEN]]mmap:{{0x[0-9a-fA-F]+:0x[0-9a-fA-F]+}}:load:[[MOD_ID]]:{{r[wx]{0,2}:0x[0-9a-fA-F]+}}[[CLOSE]] |
28 | // CHECK: [[OPEN]]bt:0:0x{{[0-9a-fA-F]+}}[[CLOSE]] |
29 | // CHECK-NEXT: [[OPEN]]bt:1:0x{{[0-9a-fA-F]+}}[[CLOSE]] |
30 | // CHECK-NEXT: [[OPEN]]bt:2:0x{{[0-9a-fA-F]+}}[[CLOSE]] |
31 | |
32 | // COM: Emitting a second backtrace should not emit contextual elements in this case. |
33 | // CHECK-NOT: [[OPEN:{{{]]reset[[CLOSE:}}}]] |
34 | // CHECK-NOT: [[OPEN]]module:[[MOD_ID:[0-9]+]]:{{.+}}:elf:{{[0-9a-fA-F]+}}[[CLOSE]] |
35 | // CHECK-NOT: [[OPEN]]mmap:{{0x[0-9a-fA-F]+:0x[0-9a-fA-F]+}}:load:[[MOD_ID]]:{{r[wx]{0,2}:0x[0-9a-fA-F]+}}[[CLOSE]] |
36 | |
37 | // CHECK: [[OPEN]]bt:0:0x{{[0-9a-fA-F]+}}[[CLOSE]] |
38 | // CHECK-NEXT: [[OPEN]]bt:1:0x{{[0-9a-fA-F]+}}[[CLOSE]] |
39 | |