• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Test to check if using basic block sections to reorder basic blocks at
2# run-time still produces the right backtraces with lldb.
3
4# UNSUPPORTED: system-darwin, system-windows
5# REQUIRES: target-x86_64
6# REQUIRES: lld
7
8# RUN: %clang_host %p/Inputs/basic-block-sections.c -o %t
9# RUN: %lldb %t -s %s -o exit | FileCheck  %s --check-prefix=DEFAULT
10
11# RUN: %clang_host %p/Inputs/basic-block-sections.c -o %t -fbasic-block-sections=all
12# RUN: %lldb %t -s %s -o exit | FileCheck  %s --check-prefix=BBSECTIONS
13
14# Reorder basic blocks so that main's basic blocks are discontiguous
15# RUN: echo "main.3" > %t.order
16# RUN: echo "bar" >> %t.order
17# RUN: echo "main" >> %t.order
18# RUN: echo "main.2" >> %t.order
19# RUN: echo "foo" >> %t.order
20# RUN: echo "main.1" >> %t.order
21# RUN: %clang_host %p/Inputs/basic-block-sections.c -o %t -fbasic-block-sections=all -fuse-ld=lld -Wl,--symbol-ordering-file,%t.order -Wl,--warn-symbol-ordering -Wl,--fatal-warnings
22# RUN: %lldb %t -s %s -o exit | FileCheck  %s --check-prefix=BBSECTIONS
23
24# Test the reverse permutation too.
25# RUN: echo "main.1" > %t.order
26# RUN: echo "foo" >> %t.order
27# RUN: echo "main.2" >> %t.order
28# RUN: echo "main" >> %t.order
29# RUN: echo "bar" >> %t.order
30# RUN: echo "main.3" >> %t.order
31# RUN: %clang_host %p/Inputs/basic-block-sections.c -o %t -fbasic-block-sections=all -fuse-ld=lld -Wl,--symbol-ordering-file,%t.order -Wl,--warn-symbol-ordering -Wl,--fatal-warnings
32# RUN: %lldb %t -s %s -o exit | FileCheck  %s --check-prefix=BBSECTIONS
33
34breakpoint set -n bar
35# DEFAULT: Breakpoint 1: where = {{.*}}`bar
36# BBSECTIONS: Breakpoint 1: where = {{.*}}`bar
37
38process launch
39# DEFAULT: stop reason = breakpoint 1.1
40# BBSECTIONS: stop reason = breakpoint 1.1
41
42thread backtrace
43# DEFAULT: frame #0: {{.*}}`bar
44# DEFAULT: frame #1: {{.*}}`foo
45# DEFAULT: frame #2: {{.*}}`main +
46
47# BBSECTIONS: frame #0: {{.*}}`bar
48# BBSECTIONS: frame #1: {{.*}}`foo
49# BBSECTIONS: frame #2: {{.*}}`main.1 +
50