1# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
2# RUN: llvm-dwarfdump %t | FileCheck %s
3
4# CHECK:      DW_AT_name        ("x0")
5# CHECK-NEXT: DW_AT_location    (0x0000000c
6# CHECK-NEXT:    [0x0000000000000000,  0x0000000000000002): DW_OP_reg5 RDI
7# CHECK-NEXT:    [0x0000000000000002,  0x0000000000000003): DW_OP_reg0 RAX)
8
9# CHECK:      DW_AT_name        ("x1")
10# CHECK-NEXT: DW_AT_location    (0xdeadbeef
11# CHECK-NEXT:    error: unexpected end of data)
12
13# CHECK:      DW_AT_name        ("x2")
14# CHECK-NEXT: DW_AT_location    (0x00000025
15# CHECK-NEXT:    error: unexpected end of data)
16
17
18        .type   f,@function
19f:                                      # @f
20.Lfunc_begin0:
21        movl    %edi, %eax
22.Ltmp0:
23        retq
24.Ltmp1:
25.Lfunc_end0:
26        .size   f, .Lfunc_end0-f
27
28        .section        .debug_str,"MS",@progbits,1
29.Linfo_string0:
30        .asciz  "Hand-written DWARF"
31.Linfo_string3:
32        .asciz  "f"
33.Linfo_string4:
34        .asciz  "int"
35.Lx0:
36        .asciz  "x0"
37.Lx1:
38        .asciz  "x1"
39.Lx2:
40        .asciz  "x2"
41
42        .section        .debug_loclists,"",@progbits
43        .long   .Ldebug_loclist_table_end0-.Ldebug_loclist_table_start0 # Length
44.Ldebug_loclist_table_start0:
45        .short  5                       # Version
46        .byte   8                       # Address size
47        .byte   0                       # Segment selector size
48        .long   0                       # Offset entry count
49.Lloclists_table_base0:
50.Ldebug_loc0:
51        .byte   8                       # DW_LLE_start_length
52        .quad   .Lfunc_begin0-.Lfunc_begin0 #   starting offset
53        .uleb128 .Ltmp0-.Lfunc_begin0   #   size
54        .byte   1                       # Loc expr size
55        .byte   85                      # super-register DW_OP_reg5
56        .byte   8                       # DW_LLE_start_length
57        .quad   .Ltmp0-.Lfunc_begin0    #   starting offset
58        .uleb128 .Lfunc_end0-.Ltmp0     #   size
59        .byte   1                       # Loc expr size
60        .byte   80                      # super-register DW_OP_reg0
61        .byte   0                       # DW_LLE_end_of_list
62.Ldebug_loc2:
63        .byte   8                       # DW_LLE_start_length
64        .quad   .Lfunc_begin0-.Lfunc_begin0 #   starting offset
65        .uleb128 .Ltmp0-.Lfunc_begin0   #   size
66        .uleb128  0xdeadbeef              # Loc expr size
67.Ldebug_loclist_table_end0:
68
69        .section        .debug_abbrev,"",@progbits
70        .byte   1                       # Abbreviation Code
71        .byte   17                      # DW_TAG_compile_unit
72        .byte   1                       # DW_CHILDREN_yes
73        .byte   37                      # DW_AT_producer
74        .byte   14                      # DW_FORM_strp
75        .byte   19                      # DW_AT_language
76        .byte   5                       # DW_FORM_data2
77        .byte   0                       # EOM(1)
78        .byte   0                       # EOM(2)
79        .byte   2                       # Abbreviation Code
80        .byte   46                      # DW_TAG_subprogram
81        .byte   1                       # DW_CHILDREN_yes
82        .byte   3                       # DW_AT_name
83        .byte   14                      # DW_FORM_strp
84        .byte   0                       # EOM(1)
85        .byte   0                       # EOM(2)
86        .byte   3                       # Abbreviation Code
87        .byte   5                       # DW_TAG_formal_parameter
88        .byte   0                       # DW_CHILDREN_no
89        .byte   3                       # DW_AT_name
90        .byte   14                      # DW_FORM_strp
91        .byte   2                       # DW_AT_location
92        .byte   23                      # DW_FORM_sec_offset
93        .byte   0                       # EOM(1)
94        .byte   0                       # EOM(2)
95        .byte   4                       # Abbreviation Code
96        .byte   36                      # DW_TAG_base_type
97        .byte   0                       # DW_CHILDREN_no
98        .byte   3                       # DW_AT_name
99        .byte   14                      # DW_FORM_strp
100        .byte   62                      # DW_AT_encoding
101        .byte   11                      # DW_FORM_data1
102        .byte   11                      # DW_AT_byte_size
103        .byte   11                      # DW_FORM_data1
104        .byte   0                       # EOM(1)
105        .byte   0                       # EOM(2)
106        .byte   0                       # EOM(3)
107
108        .section        .debug_info,"",@progbits
109.Lcu_begin0:
110        .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
111.Ldebug_info_start0:
112        .short  5                       # DWARF version number
113        .byte   1                       # DWARF Unit Type
114        .byte   8                       # Address Size (in bytes)
115        .long   .debug_abbrev           # Offset Into Abbrev. Section
116        .byte   1                       # Abbrev [1] 0xb:0x50 DW_TAG_compile_unit
117        .long   .Linfo_string0          # DW_AT_producer
118        .short  12                      # DW_AT_language
119        .byte   2                       # Abbrev [2] 0x2a:0x29 DW_TAG_subprogram
120        .long   .Linfo_string3          # DW_AT_name
121        .byte   3                       # Abbrev [3] DW_TAG_formal_parameter
122        .long   .Lx0                    # DW_AT_name
123        .long   .Ldebug_loc0            # DW_AT_location
124        .byte   3                       # Abbrev [3] DW_TAG_formal_parameter
125        .long   .Lx1                    # DW_AT_name
126        .long   0xdeadbeef              # DW_AT_location
127        .byte   3                       # Abbrev [3] DW_TAG_formal_parameter
128        .long   .Lx2                    # DW_AT_name
129        .long   .Ldebug_loc2            # DW_AT_location
130        .byte   0                       # End Of Children Mark
131        .byte   0                       # End Of Children Mark
132.Ldebug_info_end0:
133