aboutsummaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorMiguel A. Arroyo <mayanez@users.noreply.github.com>2024-06-04 09:43:24 -0700
committerGitHub <noreply@github.com>2024-06-04 09:43:24 -0700
commit0cb66a7bd52ee51a6b43c42fec22082b26365e37 (patch)
treeed1ea6cb922d814f43738432b008eb630bd63830 /llvm
parent188b1a54df9ff6c0b388269c2b95b71a0ae7801b (diff)
downloadllvm-0cb66a7bd52ee51a6b43c42fec22082b26365e37.zip
llvm-0cb66a7bd52ee51a6b43c42fec22082b26365e37.tar.gz
llvm-0cb66a7bd52ee51a6b43c42fec22082b26365e37.tar.bz2
[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}`
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/tools/llvm-readobj/COFF/debug-directory.test2
-rw-r--r--llvm/tools/llvm-readobj/COFFDumper.cpp5
2 files changed, 5 insertions, 2 deletions
diff --git a/llvm/test/tools/llvm-readobj/COFF/debug-directory.test b/llvm/test/tools/llvm-readobj/COFF/debug-directory.test
index f67eb70..8829567 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 32b1d6a..b104774 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,9 @@ 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));
+ W.printString(
+ "PDBGUID",
+ formatv("{0}", fmt_guid(DebugInfo->PDB70.Signature)).str());
W.printNumber("PDBAge", DebugInfo->PDB70.Age);
W.printString("PDBFileName", PDBFileName);
}