-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-readobj][COFF] add .llvm.call-graph-profile section dump
Summary: Dumping contents of `.llvm.call-graph-profile` section of COFF in the same format as ELF. Reviewers: jhenderson, MaskRay, hans Reviewed By: jhenderson Subscribers: grimar, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81894
- Loading branch information
Showing
4 changed files
with
122 additions
and
31 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
llvm/test/tools/llvm-readobj/COFF/call-graph-profile-err.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# REQUIRES: x86 | ||
# RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s -o %t | ||
# RUN: not llvm-readobj %t --cg-profile 2>&1 | FileCheck --check-prefix=ERR %s | ||
|
||
## In order to use --cg-profile option, the section ".llvm.call-graph-profile" | ||
## should have two 4-byte fields representing the indexes of two symbols and | ||
## one 8-byte fields representing the weight from first symbol to second | ||
## symbol. | ||
## The section in this test case has 9 bytes of data, so it's malformed. | ||
|
||
# ERR: error: '{{.*}}': Stream Error: The stream is too short to perform the requested operation. | ||
|
||
.section .test | ||
a: | ||
b: | ||
c: | ||
d: | ||
e: | ||
|
||
.section ".llvm.call-graph-profile" | ||
.long 10 ## Symbol index of a. | ||
.long 11 ## Symbol index of b. | ||
.byte 32 ## Weight from a to b. It is an error, since it should have a length of 8 bytes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# REQUIRES: x86 | ||
# RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s -o %t | ||
# RUN: llvm-readobj %t --cg-profile | FileCheck %s | ||
|
||
# CHECK: CGProfile [ | ||
# CHECK-NEXT: CGProfileEntry { | ||
# CHECK-NEXT: From: a (10) | ||
# CHECK-NEXT: To: b (11) | ||
# CHECK-NEXT: Weight: 32 | ||
# CHECK-NEXT: } | ||
# CHECK-NEXT: CGProfileEntry { | ||
# CHECK-NEXT: From: c (12) | ||
# CHECK-NEXT: To: a (10) | ||
# CHECK-NEXT: Weight: 11 | ||
# CHECK-NEXT: } | ||
# CHECK-NEXT: CGProfileEntry { | ||
# CHECK-NEXT: From: d (13) | ||
# CHECK-NEXT: To: e (14) | ||
# CHECK-NEXT: Weight: 20 | ||
# CHECK-NEXT: } | ||
# CHECK-NEXT: ] | ||
|
||
.section .test | ||
a: | ||
b: | ||
c: | ||
d: | ||
e: | ||
|
||
.section ".llvm.call-graph-profile" | ||
.long 10 ## Symbol index of a. | ||
.long 11 ## Symbol index of b. | ||
.quad 32 ## Weight from a to b. | ||
|
||
.long 12 ## Symbol index of c. | ||
.long 10 ## Symbol index of a. | ||
.quad 11 ## Weight from c to a. | ||
|
||
.long 13 ## Symbol index of d. | ||
.long 14 ## Symbol index of e. | ||
.quad 20 ## Weight from d to e. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters