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