1# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
2# RUN: %lldb %t -o "image lookup -v -s lookup_ranges" -o exit 2>%t.error | FileCheck %s
3# RUN: cat %t.error | FileCheck %s --check-prefix ERROR
4
5# ERROR: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x47) attribute, but range extraction failed (No debug_ranges section),
6# CHECK:  Function: id = {0x0000001c}, name = "ranges", range = [0x0000000000000000-0x0000000000000004)
7# CHECK:    Blocks: id = {0x0000001c}, range = [0x00000000-0x00000004)
8
9        .text
10        .p2align 12
11        .globl  ranges
12        .type   ranges,@function
13ranges:                                    # @ranges
14        nop
15lookup_ranges:
16        nop
17        nop
18        nop
19.Lranges_end:
20        .size   ranges, .Lranges_end-ranges
21                                        # -- End function
22        .section        .debug_str,"MS",@progbits,1
23.Lproducer:
24        .asciz  "Hand-written DWARF"
25.Lranges:
26        .asciz  "ranges"
27
28        .section        .debug_abbrev,"",@progbits
29        .byte   1                       # Abbreviation Code
30        .byte   17                      # DW_TAG_compile_unit
31        .byte   1                       # DW_CHILDREN_yes
32        .byte   37                      # DW_AT_producer
33        .byte   14                      # DW_FORM_strp
34        .byte   17                      # DW_AT_low_pc
35        .byte   1                       # DW_FORM_addr
36        .byte   18                      # DW_AT_high_pc
37        .byte   6                       # DW_FORM_data4
38        .byte   0                       # EOM(1)
39        .byte   0                       # EOM(2)
40        .byte   2                       # Abbreviation Code
41        .byte   46                      # DW_TAG_subprogram
42        .byte   1                       # DW_CHILDREN_yes
43        .byte   17                      # DW_AT_low_pc
44        .byte   1                       # DW_FORM_addr
45        .byte   18                      # DW_AT_high_pc
46        .byte   6                       # DW_FORM_data4
47        .byte   3                       # DW_AT_name
48        .byte   14                      # DW_FORM_strp
49        .byte   0                       # EOM(1)
50        .byte   0                       # EOM(2)
51        .byte   5                       # Abbreviation Code
52        .byte   11                      # DW_TAG_lexical_block
53        .byte   0                       # DW_CHILDREN_no
54        .byte   85                      # DW_AT_ranges
55        .byte   23                      # DW_FORM_sec_offset
56        .byte   0                       # EOM(1)
57        .byte   0                       # EOM(2)
58        .byte   0                       # EOM(3)
59
60        .section        .debug_info,"",@progbits
61.Lcu_begin0:
62        .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
63.Ldebug_info_start0:
64        .short  4                       # DWARF version number
65        .long   .debug_abbrev           # Offset Into Abbrev. Section
66        .byte   8                       # Address Size (in bytes)
67        .byte   1                       # Abbrev [1] 0xb:0x7b DW_TAG_compile_unit
68        .long   .Lproducer              # DW_AT_producer
69        .quad   ranges                  # DW_AT_low_pc
70        .long   .Lranges_end-ranges     # DW_AT_high_pc
71        .byte   2                       # Abbrev [2] 0x2a:0x4d DW_TAG_subprogram
72        .quad   ranges                  # DW_AT_low_pc
73        .long   .Lranges_end-ranges     # DW_AT_high_pc
74        .long   .Lranges                # DW_AT_name
75        .byte   5                       # Abbrev [5] 0x61:0x15 DW_TAG_lexical_block
76        .long   0x47                    # DW_AT_ranges
77        .byte   0                       # End Of Children Mark
78        .byte   0                       # End Of Children Mark
79.Ldebug_info_end0:
80