Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / Shell / SymbolFile / DWARF / x86 / subprogram_ranges.test
blobe8e49bd52be0b5df3bdb6db5b19430f6a0791aee
1 # REQUIRES: lld
2 # RUN: %clang -target x86_64-pc-linux -g -O0 %S/Inputs/subprogram_ranges.s -o %t.o -c
3 # RUN: ld.lld %t.o -o %t
4 # RUN: %lldb -b -s %s %t 2>&1 | FileCheck %s
6 # Test breaking on symbols and printing variables when a DW_TAG_subprogram uses
7 # DW_AT_ranges instead of DW_AT_low_pc/DW_AT_high_pc.  While the assembly here
8 # is a bit unrealistic - it's a single-entry range using DWARFv4 which isn't
9 # useful for anything (a single-entry range with DWARFv5 can reduce address
10 # relocations, and multi-entry ranges can be used for function sections), but
11 # it's the simplest thing to test. If anyone's updating this test at some
12 # point, feel free to replace it with another equivalent test if it's
13 # especially useful, but don't dismiss it as pointless just because it's a bit
14 # weird.
16 # * Using volatile writes to create instructions the location may be valid over
17 # * Using two values for the variable so it is described by a location list,
18 #   not a single location description
19 # * Not using function calls, so that the function has no frame pointer
20 #   initialization/no prologue instructions, so the location of "var" is valid
21 #   at the start of the function, so 'image lookup -v -s main' will include it.
23 # Source:
24 # __attribute__((nodebug)) volatile int i;
25 # int main() {
26 #   int var = 3;
27 #   i = 1;
28 #   var = 5;
29 #   i = 2;
30 # }
32 b main
33 # CHECK: (lldb) b main
34 # CHECK-NEXT: Breakpoint 1: where = {{.*}}`main at subprogram_ranges.c:4:5
36 image lookup -v -s main
37 # CHECK: 1 symbols match 'main'
38 # CHECK:  Variable: {{.*}}, name = "var", type = "int", {{.*}}, decl = subprogram_ranges.c:3