1# REQUIRES: x86
2
3# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
4# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" \
5# RUN:   -o "image lookup -v -s lookup_rnglists2" -o exit | FileCheck %s
6
7# CHECK-LABEL: image lookup -v -s lookup_rnglists
8# CHECK:  Function: id = {0x00000030}, name = "rnglists", range = [0x0000000000000000-0x0000000000000004)
9# CHECK:    Blocks: id = {0x00000030}, range = [0x00000000-0x00000004)
10# CHECK-NEXT:       id = {0x00000046}, ranges = [0x00000001-0x00000002)[0x00000003-0x00000004)
11
12# CHECK-LABEL: image lookup -v -s lookup_rnglists2
13# CHECK:  Function: id = {0x0000007a}, name = "rnglists2", range = [0x0000000000000004-0x0000000000000007)
14# CHECK:    Blocks: id = {0x0000007a}, range = [0x00000004-0x00000007)
15# CHECK-NEXT:       id = {0x00000091}, range = [0x00000005-0x00000007)
16
17        .text
18        .p2align 12
19rnglists:
20        nop
21.Lblock1_begin:
22lookup_rnglists:
23        nop
24.Lblock1_end:
25        nop
26.Lblock2_begin:
27        nop
28.Lblock2_end:
29.Lrnglists_end:
30
31rnglists2:
32        nop
33.Lblock3_begin:
34lookup_rnglists2:
35        nop
36        nop
37.Lblock3_end:
38.Lrnglists2_end:
39
40        .section        .debug_abbrev,"",@progbits
41        .byte   1                       # Abbreviation Code
42        .byte   17                      # DW_TAG_compile_unit
43        .byte   1                       # DW_CHILDREN_yes
44        .byte   37                      # DW_AT_producer
45        .byte   8                       # DW_FORM_string
46        .byte   17                      # DW_AT_low_pc
47        .byte   1                       # DW_FORM_addr
48        .byte   18                      # DW_AT_high_pc
49        .byte   6                       # DW_FORM_data4
50        .byte   116                     # DW_AT_rnglists_base
51        .byte   23                      # DW_FORM_sec_offset
52        .byte   0                       # EOM(1)
53        .byte   0                       # EOM(2)
54        .byte   2                       # Abbreviation Code
55        .byte   46                      # DW_TAG_subprogram
56        .byte   1                       # DW_CHILDREN_yes
57        .byte   17                      # DW_AT_low_pc
58        .byte   1                       # DW_FORM_addr
59        .byte   18                      # DW_AT_high_pc
60        .byte   6                       # DW_FORM_data4
61        .byte   3                       # DW_AT_name
62        .byte   8                       # DW_FORM_string
63        .byte   0                       # EOM(1)
64        .byte   0                       # EOM(2)
65        .byte   5                       # Abbreviation Code
66        .byte   11                      # DW_TAG_lexical_block
67        .byte   0                       # DW_CHILDREN_no
68        .byte   85                      # DW_AT_ranges
69        .byte   35                      # DW_FORM_rnglistx
70        .byte   0                       # EOM(1)
71        .byte   0                       # EOM(2)
72        .byte   0                       # EOM(3)
73
74        .section        .debug_info,"",@progbits
75.Lcu_begin0:
76        .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
77.Ldebug_info_start0:
78        .short  5                       # DWARF version number
79        .byte   1                       # DWARF Unit Type
80        .byte   8                       # Address Size (in bytes)
81        .long   .debug_abbrev           # Offset Into Abbrev. Section
82        .byte   1                       # Abbrev [1] 0xc:0x5f DW_TAG_compile_unit
83        .asciz  "Hand-written DWARF"    # DW_AT_producer
84        .quad   rnglists                # DW_AT_low_pc
85        .long   .Lrnglists_end-rnglists # DW_AT_high_pc
86        .long   .Lrnglists_table_base0  # DW_AT_rnglists_base
87        .byte   2                       # Abbrev [2] 0x2b:0x37 DW_TAG_subprogram
88        .quad   rnglists                # DW_AT_low_pc
89        .long   .Lrnglists_end-rnglists # DW_AT_high_pc
90        .asciz  "rnglists"              # DW_AT_name
91        .byte   5                       # Abbrev [5] 0x52:0xf DW_TAG_lexical_block
92        .byte   0                       # DW_AT_ranges
93        .byte   0                       # End Of Children Mark
94        .byte   0                       # End Of Children Mark
95.Ldebug_info_end0:
96
97.Lcu_begin1:
98        .long   .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
99.Ldebug_info_start1:
100        .short  5                       # DWARF version number
101        .byte   1                       # DWARF Unit Type
102        .byte   8                       # Address Size (in bytes)
103        .long   .debug_abbrev           # Offset Into Abbrev. Section
104        .byte   1                       # Abbrev [1] 0xc:0x5f DW_TAG_compile_unit
105        .asciz  "Hand-written DWARF"    # DW_AT_producer
106        .quad   rnglists2               # DW_AT_low_pc
107        .long   .Lrnglists2_end-rnglists2 # DW_AT_high_pc
108        .long   .Lrnglists_table_base1  # DW_AT_rnglists_base
109        .byte   2                       # Abbrev [2] 0x2b:0x37 DW_TAG_subprogram
110        .quad   rnglists2               # DW_AT_low_pc
111        .long   .Lrnglists2_end-rnglists2 # DW_AT_high_pc
112        .asciz  "rnglists2"             # DW_AT_name
113        .byte   5                       # Abbrev [5] 0x52:0xf DW_TAG_lexical_block
114        .byte   0                       # DW_AT_ranges
115        .byte   0                       # End Of Children Mark
116        .byte   0                       # End Of Children Mark
117.Ldebug_info_end1:
118
119        .section        .debug_rnglists,"",@progbits
120        .long   .Ldebug_rnglist_table_end0-.Ldebug_rnglist_table_start0 # Length
121.Ldebug_rnglist_table_start0:
122        .short  5                       # Version
123        .byte   8                       # Address size
124        .byte   0                       # Segment selector size
125        .long   1                       # Offset entry count
126.Lrnglists_table_base0:
127        .long   .Ldebug_ranges0-.Lrnglists_table_base0
128.Ldebug_ranges0:
129        .byte   4                       # DW_RLE_offset_pair
130        .uleb128 .Lblock1_begin-rnglists  #   starting offset
131        .uleb128 .Lblock1_end-rnglists    #   ending offset
132        .byte   4                       # DW_RLE_offset_pair
133        .uleb128 .Lblock2_begin-rnglists  #   starting offset
134        .uleb128 .Lblock2_end-rnglists    #   ending offset
135        .byte   0                       # DW_RLE_end_of_list
136.Ldebug_rnglist_table_end0:
137
138        .long   .Ldebug_rnglist_table_end1-.Ldebug_rnglist_table_start1 # Length
139.Ldebug_rnglist_table_start1:
140        .short  5                       # Version
141        .byte   8                       # Address size
142        .byte   0                       # Segment selector size
143        .long   1                       # Offset entry count
144.Lrnglists_table_base1:
145        .long   .Ldebug_ranges1-.Lrnglists_table_base1
146.Ldebug_ranges1:
147        .byte   4                       # DW_RLE_offset_pair
148        .uleb128 .Lblock3_begin-rnglists2 #   starting offset
149        .uleb128 .Lblock3_end-rnglists2   #   ending offset
150        .byte   0                       # DW_RLE_end_of_list
151.Ldebug_rnglist_table_end1:
152