[lld] [llvm] [llvm-readobj] Consistent PDBGUID Formatting (PR #94256)
Miguel A. Arroyo via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 14:37:13 PDT 2024
https://github.com/mayanez updated https://github.com/llvm/llvm-project/pull/94256
>From 3ffca5f701e9c4153da5997db96736c0e1557f04 Mon Sep 17 00:00:00 2001
From: Miguel Arroyo <miguel.arroyo at rockstargames.com>
Date: Fri, 31 May 2024 09:32:42 -0700
Subject: [PATCH] [llvm-readobj][COFF] Consistent PDBGUID Formatting
---
lld/test/COFF/rsds.test | 6 +++---
llvm/test/tools/llvm-readobj/COFF/debug-directory.test | 2 +-
llvm/tools/llvm-readobj/COFFDumper.cpp | 6 +++++-
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/lld/test/COFF/rsds.test b/lld/test/COFF/rsds.test
index 3b611c091e2ef..babf8cba5df19 100644
--- a/lld/test/COFF/rsds.test
+++ b/lld/test/COFF/rsds.test
@@ -60,7 +60,7 @@
# CHECK: PointerToRawData: 0x{{[^0]}}
# CHECK: PDBInfo {
# CHECK: PDBSignature: 0x53445352
-# CHECK: PDBGUID: [[GUID:\(([A-Za-z0-9]{2} ?){16}\)]]
+# CHECK: PDBGUID: [[GUID:\{[A-Za-z0-9\-]{36}\}]]
# CHECK: PDBAge: 1
# CHECK: PDBFileName: {{.*}}.pdb
# CHECK: }
@@ -99,7 +99,7 @@
# TWOPDBS: PointerToRawData: 0x{{[^0]}}
# TWOPDBS: PDBInfo {
# TWOPDBS: PDBSignature: 0x53445352
-# TWOPDBS: PDBGUID: [[GUID:\(([A-Za-z0-9]{2} ?){16}\)]]
+# TWOPDBS: PDBGUID: [[GUID:\{[A-Za-z0-9\-]{36}\}]]
# TWOPDBS: PDBAge: 1
# TWOPDBS: PDBFileName: {{.*}}.pdb
# TWOPDBS: }
@@ -182,7 +182,7 @@
# BUILDID: PointerToRawData: 0x{{[^0]}}
# BUILDID: PDBInfo {
# BUILDID: PDBSignature: 0x53445352
-# BUILDID: PDBGUID: [[GUID:\(([A-Za-z0-9]{2} ?){16}\)]]
+# BUILDID: PDBGUID: [[GUID:\{[A-Za-z0-9\-]{36}\}]]
# BUILDID: PDBAge: 1
# BUILDID: PDBFileName:
# BUILDID: }
diff --git a/llvm/test/tools/llvm-readobj/COFF/debug-directory.test b/llvm/test/tools/llvm-readobj/COFF/debug-directory.test
index f67eb70d82095..88295679a290a 100644
--- a/llvm/test/tools/llvm-readobj/COFF/debug-directory.test
+++ b/llvm/test/tools/llvm-readobj/COFF/debug-directory.test
@@ -12,7 +12,7 @@ CHECK: AddressOfRawData: 0x5B068
CHECK: PointerToRawData: 0x5A268
CHECK: PDBInfo {
CHECK: PDBSignature: 0x53445352
-CHECK: PDBGUID: (96 83 40 42 81 07 9D 40 90 1B 4A 3C 0D 4F 56 32)
+CHECK: PDBGUID: {42408396-0781-409D-901B-4A3C0D4F5632}
CHECK: PDBAge: 3
CHECK: PDBFileName: D:\src\llvm\build\has_pdb.pdb
CHECK: }
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp
index 32b1d6a2089ca..b2939f7826393 100644
--- a/llvm/tools/llvm-readobj/COFFDumper.cpp
+++ b/llvm/tools/llvm-readobj/COFFDumper.cpp
@@ -27,6 +27,7 @@
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
+#include "llvm/DebugInfo/CodeView/Formatters.h"
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
@@ -793,7 +794,10 @@ void COFFDumper::printCOFFDebugDirectory() {
DictScope PDBScope(W, "PDBInfo");
W.printHex("PDBSignature", DebugInfo->Signature.CVSignature);
if (DebugInfo->Signature.CVSignature == OMF::Signature::PDB70) {
- W.printBinary("PDBGUID", ArrayRef(DebugInfo->PDB70.Signature));
+ SmallString<38> FormattedGUIDStr;
+ raw_svector_ostream OS(FormattedGUIDStr);
+ fmt_guid(DebugInfo->PDB70.Signature).format(OS, "" /*Style=unused*/);
+ W.printString("PDBGUID", FormattedGUIDStr);
W.printNumber("PDBAge", DebugInfo->PDB70.Age);
W.printString("PDBFileName", PDBFileName);
}
More information about the llvm-commits
mailing list