[PATCH] D99978: Fixed CodeView GuidAdapter::format to handle GUID bytes in the right order.

Alex Orlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 10:52:27 PDT 2021


aorlov created this revision.
aorlov added reviewers: rnk, dblaikie, zturner, aganea, akhuang.
aorlov added a project: LLVM.
Herald added a subscriber: hiraditya.
aorlov requested review of this revision.
Herald added a subscriber: llvm-commits.

This fixes https://bugs.llvm.org/show_bug.cgi?id=41712 bug.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99978

Files:
  llvm/lib/DebugInfo/CodeView/Formatters.cpp
  llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test
  llvm/test/tools/llvm-pdbutil/stripped.test


Index: llvm/test/tools/llvm-pdbutil/stripped.test
===================================================================
--- llvm/test/tools/llvm-pdbutil/stripped.test
+++ llvm/test/tools/llvm-pdbutil/stripped.test
@@ -8,7 +8,7 @@
 ; CHECK-NEXT:  Number of streams: 12
 ; CHECK-NEXT:  Signature: 1541179274
 ; CHECK-NEXT:  Age: 2
-; CHECK-NEXT:  GUID: {FF4F9B62-D99A-4647-97A7-22C702B1E053}
+; CHECK-NEXT:  GUID: {629B4FFF-9AD9-4746-97A7-22C702B1E053}
 ; CHECK-NEXT:  Features: 0x1
 ; CHECK-NEXT:  Has Debug Info: true
 ; CHECK-NEXT:  Has Types: true
Index: llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test
===================================================================
--- llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test
+++ llvm/test/tools/llvm-pdbutil/explain-pdb-stream.test
@@ -39,7 +39,7 @@
 CHECK-NEXT:   Within the PDB stream:
 CHECK-NEXT:     address is at offset 12/28 of the PDB Stream Header.
 CHECK-NEXT:     which contains the guid of the PDB.
-CHECK-NEXT:     The current value is {826BE46E-02ED-7043-9C27-20CCC07E92A7}.
+CHECK-NEXT:     The current value is {6EE46B82-ED02-4370-9C27-20CCC07E92A7}.
 
 CHECK:      Block:Offset = 11:001C.
 CHECK-NEXT: Address is in block 17 (allocated).
Index: llvm/lib/DebugInfo/CodeView/Formatters.cpp
===================================================================
--- llvm/lib/DebugInfo/CodeView/Formatters.cpp
+++ llvm/lib/DebugInfo/CodeView/Formatters.cpp
@@ -25,11 +25,13 @@
 
 void GuidAdapter::format(raw_ostream &Stream, StringRef Style) {
   static const char *Lookup = "0123456789ABCDEF";
+  static const uint8_t Order[16] = {3, 2, 1,  0,  5,  4,  7,  6,
+                                    8, 9, 10, 11, 12, 13, 14, 15};
 
   assert(Item.size() == 16 && "Expected 16-byte GUID");
   Stream << "{";
   for (int i = 0; i < 16;) {
-    uint8_t Byte = Item[i];
+    uint8_t Byte = Item[Order[i]];
     uint8_t HighNibble = (Byte >> 4) & 0xF;
     uint8_t LowNibble = Byte & 0xF;
     Stream << Lookup[HighNibble] << Lookup[LowNibble];


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99978.335585.patch
Type: text/x-patch
Size: 2008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210406/1944ac0a/attachment.bin>


More information about the llvm-commits mailing list