Skip to content

Commit 0cb66a7

Browse files
authored
[llvm-readobj][COFF] Consistent PDBGUID Formatting (#94256)
## Consistent PDB GUID in `llvm-readobj` Currently, the PDB GUID is shown as a byte array: `PDBGUID: (D8 4C 88 D9 26 15 1F 11 4C 4C 44 20 50 44 42 2E)` This is inconsistent with `llvm-pdbutil` (e.g. `llvm-pdbutil dump --summary`) which shows it as a hexadecimal string. Additionally, `yaml2obj` uses the same hexadecimal string format. In general, the hexadecimal string is the common representation for PDB GUIDs on Windows. This PR changes it to be consistent as shown below: `PDBGUID: {D9884CD8-1526-111F-4C4C-44205044422E}`
1 parent 188b1a5 commit 0cb66a7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

lld/test/COFF/rsds.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
# CHECK: PointerToRawData: 0x{{[^0]}}
6161
# CHECK: PDBInfo {
6262
# CHECK: PDBSignature: 0x53445352
63-
# CHECK: PDBGUID: [[GUID:\(([A-Za-z0-9]{2} ?){16}\)]]
63+
# CHECK: PDBGUID: [[GUID:\{[A-Za-z0-9\-]{36}\}]]
6464
# CHECK: PDBAge: 1
6565
# CHECK: PDBFileName: {{.*}}.pdb
6666
# CHECK: }
@@ -99,7 +99,7 @@
9999
# TWOPDBS: PointerToRawData: 0x{{[^0]}}
100100
# TWOPDBS: PDBInfo {
101101
# TWOPDBS: PDBSignature: 0x53445352
102-
# TWOPDBS: PDBGUID: [[GUID:\(([A-Za-z0-9]{2} ?){16}\)]]
102+
# TWOPDBS: PDBGUID: [[GUID:\{[A-Za-z0-9\-]{36}\}]]
103103
# TWOPDBS: PDBAge: 1
104104
# TWOPDBS: PDBFileName: {{.*}}.pdb
105105
# TWOPDBS: }
@@ -182,7 +182,7 @@
182182
# BUILDID: PointerToRawData: 0x{{[^0]}}
183183
# BUILDID: PDBInfo {
184184
# BUILDID: PDBSignature: 0x53445352
185-
# BUILDID: PDBGUID: [[GUID:\(([A-Za-z0-9]{2} ?){16}\)]]
185+
# BUILDID: PDBGUID: [[GUID:\{[A-Za-z0-9\-]{36}\}]]
186186
# BUILDID: PDBAge: 1
187187
# BUILDID: PDBFileName:
188188
# BUILDID: }

llvm/test/tools/llvm-readobj/COFF/debug-directory.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CHECK: AddressOfRawData: 0x5B068
1212
CHECK: PointerToRawData: 0x5A268
1313
CHECK: PDBInfo {
1414
CHECK: PDBSignature: 0x53445352
15-
CHECK: PDBGUID: (96 83 40 42 81 07 9D 40 90 1B 4A 3C 0D 4F 56 32)
15+
CHECK: PDBGUID: {42408396-0781-409D-901B-4A3C0D4F5632}
1616
CHECK: PDBAge: 3
1717
CHECK: PDBFileName: D:\src\llvm\build\has_pdb.pdb
1818
CHECK: }

llvm/tools/llvm-readobj/COFFDumper.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
2828
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
2929
#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
30+
#include "llvm/DebugInfo/CodeView/Formatters.h"
3031
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
3132
#include "llvm/DebugInfo/CodeView/Line.h"
3233
#include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
@@ -793,7 +794,9 @@ void COFFDumper::printCOFFDebugDirectory() {
793794
DictScope PDBScope(W, "PDBInfo");
794795
W.printHex("PDBSignature", DebugInfo->Signature.CVSignature);
795796
if (DebugInfo->Signature.CVSignature == OMF::Signature::PDB70) {
796-
W.printBinary("PDBGUID", ArrayRef(DebugInfo->PDB70.Signature));
797+
W.printString(
798+
"PDBGUID",
799+
formatv("{0}", fmt_guid(DebugInfo->PDB70.Signature)).str());
797800
W.printNumber("PDBAge", DebugInfo->PDB70.Age);
798801
W.printString("PDBFileName", PDBFileName);
799802
}

0 commit comments

Comments
 (0)