File: aligned_line_tables.s

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (152 lines) | stat: -rw-r--r-- 6,290 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// RUN: llvm-mc %s -defsym ALIGN_4=1 -save-temp-labels -filetype obj -triple arm-none-eabi -o %t.o
// RUN: llvm-nm %t.o | FileCheck %s --check-prefix=L4
// RUN: llvm-dwarfdump -debug-line %t.o 2>&1 | FileCheck %s --implicit-check-not='warning:' --check-prefix=MULT4

// RUN: llvm-mc %s -defsym ALIGN_8=1 -save-temp-labels -filetype obj -triple arm-none-eabi -o %t.o
// RUN: llvm-nm %t.o | FileCheck %s --check-prefix=L8
// RUN: llvm-dwarfdump -debug-line %t.o 2>&1 | FileCheck %s --implicit-check-not='warning:' --check-prefix=MULT8

// RUN: llvm-mc %s -defsym UNALIGNED_PADDING=1 -save-temp-labels -filetype obj -triple arm-none-eabi -o %t.o
// RUN: llvm-nm %t.o | FileCheck %s --check-prefix=LUNALIGN
// RUN: llvm-dwarfdump -debug-line %t.o 2>&1 | FileCheck %s --check-prefix=UNALIGN

/// This test is based on a real example from ARM C/C++ Compiler.
/// It verifies llvm-dwarfdump is able to dump line tables even if they've been
/// placed at aligned offsets.

// L4: 0000002b N .Ltable0_end
// MULT4:      Address            Line   Column File   ISA Discriminator OpIndex Flags
// MULT4-NEXT: ------------------ ------ ------ ------ --- ------------- ------- -------------
// MULT4-NEXT: 0x0000000000000000      1      0      1   0             0       0  is_stmt end_sequence
// MULT4-EMPTY:
// MULT4-NEXT: debug_line[0x0000002c]
// MULT4-NEXT: Line table prologue:
// MULT4-NEXT:    total_length: 0x0000003a{{$}}
// MULT4-NEXT:          format: DWARF32
// MULT4-NEXT:         version: 2{{$}}
// MULT4-NEXT: prologue_length: 0x0000001a
// MULT4-NEXT: min_inst_length: 2
// MULT4-NEXT: default_is_stmt: 1

// L8: 00000027 N .Ltable0_end
// MULT8:      Address            Line   Column File   ISA Discriminator OpIndex Flags
// MULT8-NEXT: ------------------ ------ ------ ------ --- ------------- ------- -------------
// MULT8-NEXT: 0x0000000000000000      1      0      1   0             0       0  is_stmt end_sequence
// MULT8-EMPTY:
// MULT8-NEXT: debug_line[0x00000028]
// MULT8-NEXT: Line table prologue:
// MULT8-NEXT:    total_length: 0x0000003a{{$}}
// MULT8-NEXT:          format: DWARF32
// MULT8-NEXT:         version: 2{{$}}
// MULT8-NEXT: prologue_length: 0x0000001a
// MULT8-NEXT: min_inst_length: 2
// MULT8-NEXT: default_is_stmt: 1

/// This should fail to dump:
// LUNALIGN: 00000027 N .Ltable0_end
// UNALIGN: warning: parsing line table prologue at offset 0x00000027: unsupported version

.section .debug_line
/// First line table
/// Unit total length:
.long .Ltable0_end - .Ltable0_start
.Ltable0_start:
.short 2        /// Version
/// Header length:
.long .Ltable0_header_end - .Ltable0_header_start
.Ltable0_header_start:
.byte 4         /// Min instruction length
.byte 1         /// Max operations per instruction
.byte 0         /// Default is statement
.byte 6         /// Line range
.byte 10        /// Opcode base
.byte 0         /// standard_opcode_lengths[DW_LNS_copy] = 0
.byte 1         /// standard_opcode_lengths[DW_LNS_advance_pc] = 1
.byte 1         /// standard_opcode_lengths[DW_LNS_advance_line] = 1
.byte 1         /// standard_opcode_lengths[DW_LNS_set_file] = 1
.byte 1         /// standard_opcode_lengths[DW_LNS_set_column] = 1
.byte 0         /// standard_opcode_lengths[DW_LNS_negate_stmt] = 0
.byte 0         /// standard_opcode_lengths[DW_LNS_set_basic_block] = 0
.byte 0         /// standard_opcode_lengths[DW_LNS_const_add_pc] = 0
.byte 0         /// standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 0
.byte 0         /// No include directories
/// File name:
.ifdef ALIGN_4
/// Pad out filename so next 4 byte aligned offset is a multiple of 4 and not 8.
.asciz "foobar.cpp"
.else
.asciz "test.c"
.endif
.byte 0         /// Dir idx
.byte 0         /// Mod time
.byte 0         /// Length
.byte 0         /// End files
.Ltable0_header_end:
/// Line table operations
.byte 0         /// Extended opcode
.byte 1         /// Length 1
.byte 1         /// DW_LNE_end_sequence
.Ltable0_end:
/// End first line table
/// Padding:
.ifdef UNALIGNED_PADDING
.short 0
.else
.byte 0
.endif
/// Second line table
/// Unit total length:
.long .Ltable1_end - .Ltable1_start
.Ltable1_start:
.short 2        /// Version
/// Header length:
.long .Ltable1_header_end - .Ltable1_header_start
.Ltable1_header_start:
.byte 2         /// Min instruction length
.byte 1         /// Max operations per instruction
.byte 0         /// Default is statement
.byte 6         /// Line range
.byte 10        /// Opcode base
.byte 0         /// standard_opcode_lengths[DW_LNS_copy] = 0
.byte 1         /// standard_opcode_lengths[DW_LNS_advance_pc] = 1
.byte 1         /// standard_opcode_lengths[DW_LNS_advance_line] = 1
.byte 1         /// standard_opcode_lengths[DW_LNS_set_file] = 1
.byte 1         /// standard_opcode_lengths[DW_LNS_set_column] = 1
.byte 0         /// standard_opcode_lengths[DW_LNS_negate_stmt] = 0
.byte 0         /// standard_opcode_lengths[DW_LNS_set_basic_block] = 0
.byte 0         /// standard_opcode_lengths[DW_LNS_const_add_pc] = 0
.byte 0         /// standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 0
.byte 0         /// No include directories
.asciz "test.c" /// File name
.byte 0         /// Dir idx
.byte 0         /// Mod time
.byte 0         /// Length
.byte 0         /// End files
.Ltable1_header_end:
/// Line table operations
.byte 4         /// DW_LNS_set_file
.byte 1         /// File 1
.byte 5         /// DW_LNS_set_column
.byte 1         /// Column 1
.byte 0         /// Extended opcode
.byte 5         /// Length 5
.byte 2         /// DW_LNE_set_address
.long 32896     /// Address = 0x00008080
.byte 3         /// DW_LNS_advance_line
.byte 6         /// Line += 6
.byte 1         /// DW_LNS_copy
.byte 5         /// DW_LNS_set_column
.byte 2         /// Column 2
.byte 12        /// Special opcode (address += 0,  line += 2)
.byte 30        /// Special opcode (address += 6,  line += 2)
.byte 5         /// DW_LNS_set_column
.byte 1         /// Column 1
.byte 17        /// Special opcode (address += 2,  line += 1)
.byte 2         /// DW_LNS_advance_pc
.byte 4         /// += (4 * min instruction length)
.byte 0         /// Extended opcode
.byte 1         /// Length 1
.byte 1         /// DW_LNE_end_sequence
.Ltable1_end:
/// End second line table
.short 0        /// Padding (to make section a word multiple)