xref: /llvm-project/llvm/test/DebugInfo/X86/dwarfdump-debug-loclists.test (revision def677194c43c04fcd9a45434a83f65cae1dc76a)
1# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o
2# RUN: llvm-dwarfdump -v %t.o | FileCheck %s
3
4# CHECK:      .debug_info
5# CHECK:       DW_AT_name{{.*}}"stub"
6# CHECK:       DW_AT_location [DW_FORM_sec_offset]   (0x0000000c
7# CHECK-NEXT:    [0x0000000000000010, 0x0000000000000020): DW_OP_breg5 RDI+0
8# CHECK-NEXT:    [0x0000000000000530, 0x0000000000000540): DW_OP_breg6 RBP-8, DW_OP_deref
9# CHECK-NEXT:    [0x0000000000000700, 0x0000000000000710): DW_OP_breg5 RDI+0
10
11# CHECK:      .debug_loclists contents:
12# CHECK-NEXT: 0x00000000: locations list header: length = 0x0000002c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
13# CHECK-NEXT: 0x0000000c:
14# CHECK-NEXT:   DW_LLE_offset_pair  (0x0000000000000000, 0x0000000000000010): DW_OP_breg5 RDI+0
15# CHECK-NEXT:   DW_LLE_base_address (0x0000000000000500)
16# CHECK-NEXT:   DW_LLE_offset_pair  (0x0000000000000030, 0x0000000000000040)
17# CHECK-NEXT:                   => [0x0000000000000530, 0x0000000000000540): DW_OP_breg6 RBP-8, DW_OP_deref
18# CHECK-NEXT:   DW_LLE_start_length (0x0000000000000700, 0x0000000000000010)
19# CHECK-NEXT:                   => [0x0000000000000700, 0x0000000000000710): DW_OP_breg5 RDI+0
20# CHECK-NEXT:   DW_LLE_end_of_list  ()
21
22.section  .debug_str,"MS",@progbits,1
23  .asciz  "stub"
24
25.section  .debug_str_offsets,"",@progbits
26  .long  68
27  .short  5
28  .short  0
29.Lstr_offsets_base0:
30  .zero 64
31
32.section  .debug_loclists,"",@progbits
33  .long  .Ldebug_loclist_table_end0-.Ldebug_loclist_table_start0
34.Ldebug_loclist_table_start0:
35 .short 5                        # Version.
36 .byte 8                         # Address size.
37 .byte 0                         # Segmen selector size.
38 .long 0                         # Offset entry count.
39.Lloclists_table_base0:
40.Ldebug_loc0:
41  .byte  4                       # DW_LLE_offset_pair
42  .uleb128 0x0                   #   starting offset
43  .uleb128 0x10                  #   ending offset
44  .byte  2                       # Loc expr size
45  .byte  117                     # DW_OP_breg5
46  .byte  0                       # 0
47
48  .byte  6                       # DW_LLE_base_address
49  .quad  0x500                   # Some address
50
51  .byte  4                       # DW_LLE_offset_pair
52  .uleb128 0x30                  #   starting offset
53  .uleb128 0x40                  #   ending offset
54  .byte  3                       # Loc expr size
55  .byte  118                     # DW_OP_breg6
56  .byte  120                     # -8
57  .byte  6                       # DW_OP_deref
58
59  .byte  8                       # DW_LLE_start_length
60  .quad  0x700                   # Some address
61  .uleb128 0x10                  #   length
62  .byte  2                       # Loc expr size
63  .byte  117                     # DW_OP_breg5
64  .byte  0                       # 0
65
66  .byte  0                       # DW_LLE_end_of_list
67
68.Ldebug_loclist_table_end0:
69
70.section  .debug_abbrev,"",@progbits
71  .byte  1                       # Abbreviation Code
72  .byte  17                      # DW_TAG_compile_unit
73  .byte  1                       # DW_CHILDREN_yes
74  .byte  37                      # DW_AT_producer
75  .byte  37                      # DW_FORM_strx1
76  .byte  19                      # DW_AT_language
77  .byte  5                       # DW_FORM_data2
78  .byte  3                       # DW_AT_name
79  .byte  37                      # DW_FORM_strx1
80  .byte  114                     # DW_AT_str_offsets_base
81  .byte  23                      # DW_FORM_sec_offset
82  .byte  16                      # DW_AT_stmt_list
83  .byte  23                      # DW_FORM_sec_offset
84  .byte  27                      # DW_AT_comp_dir
85  .byte  37                      # DW_FORM_strx1
86  .byte  17                      # DW_AT_low_pc
87  .byte  1                       # DW_FORM_addr
88  .byte  18                      # DW_AT_high_pc
89  .byte  6                       # DW_FORM_data4
90  .ascii  "\214\001"             # DW_AT_loclists_base
91  .byte  23                      # DW_FORM_sec_offset
92  .byte  0                       # EOM(1)
93  .byte  0                       # EOM(2)
94  .byte  2                       # Abbreviation Code
95  .byte  46                      # DW_TAG_subprogram
96  .byte  1                       # DW_CHILDREN_yes
97  .byte  17                      # DW_AT_low_pc
98  .byte  1                       # DW_FORM_addr
99  .byte  18                      # DW_AT_high_pc
100  .byte  6                       # DW_FORM_data4
101  .byte  64                      # DW_AT_frame_base
102  .byte  24                      # DW_FORM_exprloc
103  .byte  110                     # DW_AT_linkage_name
104  .byte  37                      # DW_FORM_strx1
105  .byte  3                       # DW_AT_name
106  .byte  37                      # DW_FORM_strx1
107  .byte  58                      # DW_AT_decl_file
108  .byte  11                      # DW_FORM_data1
109  .byte  59                      # DW_AT_decl_line
110  .byte  11                      # DW_FORM_data1
111  .byte  63                      # DW_AT_external
112  .byte  25                      # DW_FORM_flag_present
113  .byte  0                       # EOM(1)
114  .byte  0                       # EOM(2)
115  .byte  3                       # Abbreviation Code
116  .byte  52                      # DW_TAG_variable
117  .byte  0                       # DW_CHILDREN_no
118  .byte  2                       # DW_AT_location
119  .byte  23                      # DW_FORM_sec_offset
120  .byte  3                       # DW_AT_name
121  .byte  37                      # DW_FORM_strx1
122  .byte  58                      # DW_AT_decl_file
123  .byte  11                      # DW_FORM_data1
124  .byte  59                      # DW_AT_decl_line
125  .byte  11                      # DW_FORM_data1
126  .byte  73                      # DW_AT_type
127  .byte  19                      # DW_FORM_ref4
128  .byte  0                       # EOM(1)
129  .byte  0                       # EOM(2)
130  .byte  0                       # EOM(3)
131
132.section  .debug_info,"",@progbits
133.Lcu_begin0:
134  .long  70                      # Length of Unit
135  .short  5                      # DWARF version number
136  .byte  1                       # DWARF Unit Type
137  .byte  8                       # Address Size (in bytes)
138  .long  .debug_abbrev           # Offset Into Abbrev. Section
139  .byte  1                       # Abbrev [1] 0xc:0xef DW_TAG_compile_unit
140  .byte  0                       # DW_AT_producer
141  .short  4                      # DW_AT_language
142  .byte  1                       # DW_AT_name
143  .long  .Lstr_offsets_base0     # DW_AT_str_offsets_base
144  .long  .Lline_table_start0     # DW_AT_stmt_list
145  .byte  2                       # DW_AT_comp_dir
146  .quad  0x10                    # DW_AT_low_pc
147  .long  0                       # DW_AT_high_pc
148  .long  .Lloclists_table_base0  # DW_AT_loclists_base
149  .byte  2                       # Abbrev [2] 0x2a:0x20 DW_TAG_subprogram
150  .quad  0                       # DW_AT_low_pc
151  .long  0                       # DW_AT_high_pc
152  .byte  1                       # DW_AT_frame_base
153  .byte  86
154  .byte  11                      # DW_AT_linkage_name
155  .byte  12                      # DW_AT_name
156  .byte  1                       # DW_AT_decl_file
157  .byte  6                       # DW_AT_decl_line
158                                 # DW_AT_external
159  .byte 3                        # Abbrev [3] 0x40:0xb DW_TAG_variable
160  .long .Ldebug_loc0             # DW_AT_location
161  .byte 7                        # DW_AT_name
162  .byte 1                        # DW_AT_decl_file
163  .byte 6                        # DW_AT_decl_line
164  .long 76                       # DW_AT_type
165  .byte 0                        # End Of Children Mark
166  .byte 0                        # End Of Children Mark
167  .byte  0                       # End Of Children Mark
168
169.section .debug_line,"",@progbits
170.Lline_table_start0:
171
172