File: elf-bbaddrmap-disassemble-symbolize-operands.yaml

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (259 lines) | stat: -rw-r--r-- 7,534 bytes parent folder | download | duplicates (6)
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
## Test that in the presence of SHT_LLVM_BB_ADDR_MAP sections,
## --symbolize-operands can display <BB*> labels.

## Executable object file with separate SHT_LLVM_BB_ADDR_MAP sections for multiple text sections.
## RUN: yaml2obj --docnum=1 %s -o %t1
## RUN: llvm-objdump %t1 -d --symbolize-operands -M intel --no-show-raw-insn --no-leading-addr | \
## RUN:   FileCheck %s --match-full-lines --check-prefixes=INTEL
## RUN: llvm-objdump %t1 -d --symbolize-operands -M att --no-show-raw-insn --no-leading-addr | \
## RUN:   FileCheck %s --match-full-lines --check-prefixes=ATT

## Executable object file with a single SHT_LLVM_BB_ADDR_MAP for multiple text sections.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-objdump %t2 -d --symbolize-operands -M intel --no-show-raw-insn --no-leading-addr | \
# RUN:   FileCheck %s --match-full-lines --check-prefixes=INTEL
# RUN: llvm-objdump %t2 -d --symbolize-operands -M att --no-show-raw-insn --no-leading-addr | \
# RUN:   FileCheck %s --match-full-lines --check-prefixes=ATT

## Expect to find the branch and basic block labels and global variable name.
# ATT:      <foo>:
# ATT-NEXT: <BB3>:
# ATT-NEXT:   pushq %rax
# ATT-NEXT: <BB1>:
# ATT-NEXT:   cmpl  , %eax <symbol>
# ATT-NEXT:   nop
# ATT-NEXT: <BB2>:
# ATT-NEXT:   jge    <BB5>
# ATT-NEXT:   jmp    <BB1>
# ATT-NEXT: <BB4>:
# ATT-NEXT:   jge   <foo.cold>
# ATT-NEXT: <BB5>:
# ATT-NEXT:   retq
# ATT:      <bar>:
# ATT-NEXT: <BB0>:
# ATT-NEXT:   pushq  %rax
# ATT-NEXT:   movl   %edx, %eax
# ATT-NEXT:   je     <BB2>
# ATT-NEXT: <BB1>:
# ATT-NEXT:   xorl   %esi, %esi
# ATT-NEXT: <BB2>:
# ATT-NEXT:   callq  <bar>
# ATT-NEXT:   retq
# ATT:      <foo.cold>:
# ATT-NEXT: <BB6>:
# ATT-NEXT:   retq

# INTEL:      <foo>:
# INTEL-NEXT: <BB3>:
# INTEL-NEXT:   push rax
# INTEL-NEXT: <BB1>:
# INTEL-NEXT:   cmp  eax, dword ptr <symbol>
# INTEL-NEXT:   nop
# INTEL-NEXT: <BB2>:
# INTEL-NEXT:   jge   <BB5>
# INTEL-NEXT:   jmp   <BB1>
# INTEL-NEXT: <BB4>:
# INTEL-NEXT:   jge   <foo.cold>
# INTEL-NEXT: <BB5>:
# INTEL-NEXT:   ret
# INTEL:      <bar>:
# INTEL-NEXT: <BB0>:
# INTEL-NEXT:   push  rax
# INTEL-NEXT:   mov   eax, edx
# INTEL-NEXT:   je    <BB2>
# INTEL-NEXT: <BB1>:
# INTEL-NEXT:   xor   esi, esi
# INTEL-NEXT: <BB2>:
# INTEL-NEXT:   call  <bar>
# INTEL-NEXT:   ret
# INTEL:      <foo.cold>:
# INTEL-NEXT: <BB6>:
# INTEL-NEXT:   ret

## This object file contains a separate text section and SHT_LLVM_BB_ADDR_MAP
## section for each of the two functions foo and bar.
## This is used to test --symbolize-operands on reloctable and non-relocotable
## object files.
--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:    .text.foo
    Type:    SHT_PROGBITS
    Address: 0x4000
    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
    Content: '503b0505300000907d08ebf50f8dee1f0000c3'
  - Name:    .text.bar
    Type:    SHT_PROGBITS
    Address: 0x5000
    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
    Content: '5089d0740231f6e8f4ffffffc3'
  - Name:    .text.split
    Type:    SHT_PROGBITS
    Address: 0x6000
    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
    Content: 'c3'
  - Name:    .data
    Type:    SHT_PROGBITS
    Flags:   [SHF_ALLOC, SHF_WRITE]
    Address: 0x7000
  - Name:   .llvm_bb_addr_map.foo
    Type:   SHT_LLVM_BB_ADDR_MAP
    Link:   .text.foo
    Entries:
      - Version: 2
        Feature: 0x8
        BBRanges:
          - BaseAddress: 0x4000
            BBEntries:
             - ID:            3
               AddressOffset: 0x0
               Size:          0x1
               Metadata:      0x1
             - ID:            1
               AddressOffset: 0x0
               Size:          0x6
               Metadata:      0x0
             - ID:            2
               AddressOffset: 0x1
               Size:          0x4
               Metadata:      0x0
             - ID:            4
               AddressOffset: 0x0
               Size:          0x6
               Metadata:      0x1
             - ID:            5
               AddressOffset: 0x0
               Size:          0x1
               Metadata:      0x2
          - BaseAddress: 0x6000
            BBEntries:
             - ID:            6
               AddressOffset: 0x0
               Size:          0x1
               Metadata:      0x2
  - Name:   .llvm_bb_addr_map.bar
    Type:   SHT_LLVM_BB_ADDR_MAP
    Link:   .text.bar
    Entries:
      - Version: 1
        BBRanges:
         - BaseAddress: 0x5000
           BBEntries:
            - AddressOffset: 0x0
              Size:          0x1
              Metadata:      0x1
            - AddressOffset: 0x4
              Size:          0x2
              Metadata:      0x0
            - AddressOffset: 0x0
              Size:          0x6
              Metadata:      0x0

Symbols:
  - Name:    foo
    Section: .text.foo
    Value:   0x4000
  - Name:    foo.cold
    Section: .text.split
    Value:   0x6000
  - Name:    bar
    Section: .text.bar
    Value:   0x5000
  - Name:    symbol
    Section: .data
    Value:   0x700c

## This object file contains a single SHT_LLVM_BB_ADDR_MAP for two text
## sections .text.foo and .text.bar.
--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:    .text.foo
    Type:    SHT_PROGBITS
    Address: 0x4000
    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
    Content: '503b0505300000907d08ebf50f8dee1f0000c3'
  - Name:    .text.bar
    Type:    SHT_PROGBITS
    Address: 0x5000
    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
    Content: '5089d0740231f6e8f4ffffffc3'
  - Name:    .text.split
    Type:    SHT_PROGBITS
    Address: 0x6000
    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
    Content: 'c3'
  - Name:    .data
    Type:    SHT_PROGBITS
    Flags:   [SHF_ALLOC, SHF_WRITE]
    Address: 0x7000
  - Name:   .llvm_bb_addr_map.foo
    Type:   SHT_LLVM_BB_ADDR_MAP
    Link:   .text.foo
    Entries:
      - Version: 2
        Feature: 0x8
        BBRanges:
          - BaseAddress: 0x4000
            BBEntries:
             - ID:            3
               AddressOffset: 0x0
               Size:          0x1
               Metadata:      0x1
             - ID:            1
               AddressOffset: 0x0
               Size:          0x6
               Metadata:      0x0
             - ID:            2
               AddressOffset: 0x1
               Size:          0x4
               Metadata:      0x0
             - ID:            4
               AddressOffset: 0x0
               Size:          0x6
               Metadata:      0x1
             - ID:            5
               AddressOffset: 0x0
               Size:          0x1
               Metadata:      0x2
          - BaseAddress: 0x6000
            BBEntries:
             - ID:            6
               AddressOffset: 0x0
               Size:          0x1
               Metadata:      0x2
      - Version: 1
        BBRanges:
         - BaseAddress: 0x5000
           BBEntries:
            - AddressOffset: 0x0
              Size:          0x1
              Metadata:      0x1
            - AddressOffset: 0x4
              Size:          0x2
              Metadata:      0x0
            - AddressOffset: 0x0
              Size:          0x6
              Metadata:      0x0

Symbols:
  - Name:    foo
    Section: .text.foo
    Value:   0x4000
  - Name:    foo.cold
    Section: .text.split
    Value:   0x6000
  - Name:    bar
    Section: .text.bar
    Value:   0x5000
  - Name:    symbol
    Section: .data
    Value:   0x700c