• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Test object to verify dwarfdump handles a syntactically correct line-number
2# program containing unrecognized extended opcodes.
3# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
4# RUN: llvm-dwarfdump -v %t.o | FileCheck %s
5# RUN: llvm-dwarfdump -v %t.o 2>&1 | FileCheck %s --check-prefix=ERR
6
7        .section .text
8        # Dummy function
9foo:    ret
10
11# FIXME: When we can dump a line-table without a unit, we could remove
12# the .debug_abbrev and .debug_info sections from this test.
13        .section .debug_abbrev,"",@progbits
14        .byte 0x01  # Abbrev code
15        .byte 0x11  # DW_TAG_compile_unit
16        .byte 0x00  # DW_CHILDREN_no
17        .byte 0x10  # DW_AT_stmt_list
18        .byte 0x17  # DW_FORM_sec_offset
19        .byte 0x00  # EOM(1)
20        .byte 0x00  # EOM(2)
21
22        .section .debug_info,"",@progbits
23        .long  CU_end-CU_version  # Length of Unit
24CU_version:
25        .short 4               # DWARF version number
26        .long .debug_abbrev    # Offset Into Abbrev. Section
27        .byte 8                # Address Size (in bytes)
28# The compile-unit DIE, with DW_AT_stmt_list.
29        .byte 1
30        .long LT_start
31        .byte 0 # NULL
32CU_end:
33
34        .long  CU2_end-CU2_version  # Length of Unit
35CU2_version:
36        .short 4               # DWARF version number
37        .long .debug_abbrev    # Offset Into Abbrev. Section
38        .byte 8                # Address Size (in bytes)
39# The compile-unit DIE, with DW_AT_stmt_list.
40        .byte 1
41        .long LT2_start
42        .byte 0 # NULL
43CU2_end:
44
45        .section .debug_line,"",@progbits
46# CHECK-LABEL: .debug_line contents:
47
48# DWARF v4 line-table header.
49LT_start:
50        .long   LT_end-LT_version   # Length of Unit (DWARF-32 format)
51LT_version:
52        .short  4               # DWARF version number
53        .long   LT_header_end-LT_params     # Length of Prologue
54LT_params:
55        .byte   1               # Minimum Instruction Length
56        .byte   1               # Maximum Operations per Instruction
57        .byte   1               # Default is_stmt
58        .byte   -5              # Line Base
59        .byte   14              # Line Range
60        .byte   13              # Opcode Base
61        .byte   0               # Standard Opcode Lengths
62        .byte   1
63        .byte   1
64        .byte   1
65        .byte   1
66        .byte   0
67        .byte   0
68        .byte   0
69        .byte   1
70        .byte   0
71        .byte   0
72        .byte   1
73        # No directories.
74        .byte   0
75        # No files.
76        .byte   0
77LT_header_end:
78        # Bogus extended opcode with zero length.
79        .byte   0               # Extended opcode indicator.
80        .byte   0               # LEB length of extended opcode + operands.
81        # Real opcode and operand.
82        .byte   0
83        .byte   9
84        .byte   2               # DW_LNE_set_address
85        .quad   .text
86        # Bogus extended opcode with multibyte LEB length.
87        .byte   0
88        .byte   0x82            # Length of 2 but with additional length byte.
89        .byte   0               # Additional length byte.
90        .byte   0x47            # Unrecognized opcode...
91        .byte   0               # with its 1-byte operand.
92        # Proper end-sequence opcode.
93        .byte   0
94        .byte   1
95        .byte   1               # DW_LNE_end_sequence
96LT_end:
97
98# CHECK:      Line table prologue:
99# CHECK:      version: 4
100# Exact prologue length isn't important but it tells us where to expect the
101# line-number program to start, and we do want to verify those offsets.
102# CHECK-NEXT: prologue_length: 0x00000014
103# CHECK:      0x0000001e: 00 Badly formed extended line op
104# CHECK-NEXT: 0x00000020: 00 DW_LNE_set_address
105# CHECK-NEXT: 0x0000002b: 00 Unrecognized extended op 0x47 length 2
106# CHECK-NEXT: 0x00000030: 00 DW_LNE_end_sequence
107# CHECK-NEXT: 0x0000000000000000 {{.*}} is_stmt end_sequence
108
109
110# DWARF v4 line-table header #2.
111LT2_start:
112        .long   LT2_end-LT2_version   # Length of Unit (DWARF-32 format)
113LT2_version:
114        .short  4               # DWARF version number
115        .long   LT2_header_end-LT2_params   # Length of Prologue
116LT2_params:
117        .byte   1               # Minimum Instruction Length
118        .byte   1               # Maximum Operations per Instruction
119        .byte   1               # Default is_stmt
120        .byte   -5              # Line Base
121        .byte   14              # Line Range
122        .byte   13              # Opcode Base
123        .byte   0               # Standard Opcode Lengths
124        .byte   1
125        .byte   1
126        .byte   1
127        .byte   1
128        .byte   0
129        .byte   0
130        .byte   0
131        .byte   1
132        .byte   0
133        .byte   0
134        .byte   1
135        # No directories.
136        .byte   0
137        # No files.
138        .byte   0
139LT2_header_end:
140        # Real opcode and operand.
141        .byte   0
142        .byte   9
143        .byte   2               # DW_LNE_set_address
144        .quad   .text
145        # Real opcode with incorrect length.
146        .byte   0
147        .byte   2               # Wrong length, should be 1.
148        .byte   1               # DW_LNE_end_sequence
149LT2_end:
150
151# ERR:      warning: unexpected line op length at offset 0x0000005e
152# ERR-SAME: expected 0x02 found 0x01
153