[llvm] r305524 - [llvm-pdbutil] Add back the ability to dump hashes and index offsets.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 16:04:42 PDT 2017


Author: zturner
Date: Thu Jun 15 18:04:42 2017
New Revision: 305524

URL: http://llvm.org/viewvc/llvm-project?rev=305524&view=rev
Log:
[llvm-pdbutil] Add back the ability to dump hashes and index offsets.

This was regressed in a previous patch that re-wrote the dumper,
and I'm incrementally adding back the pieces that are missing.

Modified:
    llvm/trunk/lib/DebugInfo/PDB/Native/TpiHashing.cpp
    llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
    llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.cpp
    llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.h
    llvm/trunk/tools/llvm-pdbutil/RawOutputStyle.cpp
    llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
    llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h

Modified: llvm/trunk/lib/DebugInfo/PDB/Native/TpiHashing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/TpiHashing.cpp?rev=305524&r1=305523&r2=305524&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/TpiHashing.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/TpiHashing.cpp Thu Jun 15 18:04:42 2017
@@ -9,6 +9,7 @@
 
 #include "llvm/DebugInfo/PDB/Native/TpiHashing.h"
 
+#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
 #include "llvm/DebugInfo/PDB/Native/Hash.h"
 #include "llvm/DebugInfo/PDB/Native/RawError.h"
 

Modified: llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test?rev=305524&r1=305523&r2=305524&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test (original)
+++ llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test Thu Jun 15 18:04:42 2017
@@ -59,204 +59,204 @@ ALL-NEXT:              contributing sour
 ALL:                           Types (TPI Stream)
 ALL-NEXT: ============================================================
 ALL-NEXT:   Showing 75 records
-ALL-NEXT:   0x1000 | LF_ARGLIST [size = 8]
-ALL-NEXT:   0x1001 | LF_PROCEDURE [size = 16]
+ALL-NEXT:   0x1000 | LF_ARGLIST [size = 8, hash = 205956]
+ALL-NEXT:   0x1001 | LF_PROCEDURE [size = 16, hash = 163561]
 ALL-NEXT:            return type = 0x0074 (int), # args = 0, param list = 0x1000
 ALL-NEXT:            calling conv = cdecl, options = None
-ALL-NEXT:   0x1002 | LF_FIELDLIST [size = 76]
+ALL-NEXT:   0x1002 | LF_FIELDLIST [size = 76, hash = 59811]
 ALL-NEXT:            - LF_ENUMERATE [apartment = 1]
 ALL-NEXT:            - LF_ENUMERATE [single = 2]
 ALL-NEXT:            - LF_ENUMERATE [free = 3]
 ALL-NEXT:            - LF_ENUMERATE [neutral = 4]
 ALL-NEXT:            - LF_ENUMERATE [both = 5]
-ALL-NEXT:   0x1003 | LF_ENUM [size = 120]
+ALL-NEXT:   0x1003 | LF_ENUM [size = 120, hash = 208239]
 ALL-NEXT:            name: `__vc_attributes::threadingAttribute::threading_e`
 ALL-NEXT:            unique name: `.?AW4threading_e at threadingAttribute@__vc_attributes@@`
 ALL-NEXT:            field list: 0x1002, underlying type: 0x0074 (int)
 ALL-NEXT:            options: has unique name | is nested
-ALL-NEXT:   0x1004 | LF_STRUCTURE [size = 100]
+ALL-NEXT:   0x1004 | LF_STRUCTURE [size = 100, hash = 16377]
 ALL-NEXT:            class name: `__vc_attributes::threadingAttribute`
 ALL-NEXT:            unique name: `.?AUthreadingAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: <no type>
 ALL-NEXT:            options: forward ref | has unique name
-ALL-NEXT:   0x1005 | LF_POINTER [size = 12]
+ALL-NEXT:   0x1005 | LF_POINTER [size = 12, hash = 247078]
 ALL-NEXT:            referent = 0x1004, mode = pointer, opts = const, kind = ptr32
-ALL-NEXT:   0x1006 | LF_ARGLIST [size = 12]
+ALL-NEXT:   0x1006 | LF_ARGLIST [size = 12, hash = 194342]
 ALL-NEXT:            0x1003: `__vc_attributes::threadingAttribute::threading_e`
-ALL-NEXT:   0x1007 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1007 | LF_MFUNCTION [size = 28, hash = 254156]
 ALL-NEXT:            return type = 1, # args = 0x1006, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x1004, this type = 0x1005, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1008 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1008 | LF_MFUNCTION [size = 28, hash = 194536]
 ALL-NEXT:            return type = 0, # args = 0x1000, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x1004, this type = 0x1005, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1009 | LF_METHODLIST [size = 20]
+ALL-NEXT:   0x1009 | LF_METHODLIST [size = 20, hash = 167492]
 ALL-NEXT:            - Method [type = 0x1007, vftable offset = -1, attrs = public]
 ALL-NEXT:            - Method [type = 0x1008, vftable offset = -1, attrs = public]
-ALL-NEXT:   0x100A | LF_FIELDLIST [size = 68]
+ALL-NEXT:   0x100A | LF_FIELDLIST [size = 68, hash = 185421]
 ALL-NEXT:            - LF_NESTTYPE [name = `threading_e`, parent = 0x1003]
 ALL-NEXT:            - LF_METHOD [name = `threadingAttribute`, # overloads = 2, overload list = 0x1009]
 ALL-NEXT:            - LF_MEMBER [name = `value`, Type = 0x1003, offset = 0, attrs = public]
-ALL-NEXT:   0x100B | LF_STRUCTURE [size = 100]
+ALL-NEXT:   0x100B | LF_STRUCTURE [size = 100, hash = 119540]
 ALL-NEXT:            class name: `__vc_attributes::threadingAttribute`
 ALL-NEXT:            unique name: `.?AUthreadingAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: 0x100A
 ALL-NEXT:            options: has ctor / dtor | contains nested class | has unique name
-ALL-NEXT:   0x100C | LF_FIELDLIST [size = 48]
+ALL-NEXT:   0x100C | LF_FIELDLIST [size = 48, hash = 261871]
 ALL-NEXT:            - LF_ENUMERATE [native = 0]
 ALL-NEXT:            - LF_ENUMERATE [com = 1]
 ALL-NEXT:            - LF_ENUMERATE [managed = 2]
-ALL-NEXT:   0x100D | LF_ENUM [size = 120]
+ALL-NEXT:   0x100D | LF_ENUM [size = 120, hash = 198119]
 ALL-NEXT:            name: `__vc_attributes::event_receiverAttribute::type_e`
 ALL-NEXT:            unique name: `.?AW4type_e at event_receiverAttribute@__vc_attributes@@`
 ALL-NEXT:            field list: 0x100C, underlying type: 0x0074 (int)
 ALL-NEXT:            options: has unique name | is nested
-ALL-NEXT:   0x100E | LF_STRUCTURE [size = 112]
+ALL-NEXT:   0x100E | LF_STRUCTURE [size = 112, hash = 48056]
 ALL-NEXT:            class name: `__vc_attributes::event_receiverAttribute`
 ALL-NEXT:            unique name: `.?AUevent_receiverAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: <no type>
 ALL-NEXT:            options: forward ref | has unique name
-ALL-NEXT:   0x100F | LF_POINTER [size = 12]
+ALL-NEXT:   0x100F | LF_POINTER [size = 12, hash = 251486]
 ALL-NEXT:            referent = 0x100E, mode = pointer, opts = const, kind = ptr32
-ALL-NEXT:   0x1010 | LF_ARGLIST [size = 16]
+ALL-NEXT:   0x1010 | LF_ARGLIST [size = 16, hash = 134580]
 ALL-NEXT:            0x100D: `__vc_attributes::event_receiverAttribute::type_e`
 ALL-NEXT:            0x0030 (bool): `bool`
-ALL-NEXT:   0x1011 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1011 | LF_MFUNCTION [size = 28, hash = 148190]
 ALL-NEXT:            return type = 2, # args = 0x1010, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x100E, this type = 0x100F, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1012 | LF_ARGLIST [size = 12]
+ALL-NEXT:   0x1012 | LF_ARGLIST [size = 12, hash = 113636]
 ALL-NEXT:            0x100D: `__vc_attributes::event_receiverAttribute::type_e`
-ALL-NEXT:   0x1013 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1013 | LF_MFUNCTION [size = 28, hash = 53336]
 ALL-NEXT:            return type = 1, # args = 0x1012, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x100E, this type = 0x100F, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1014 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1014 | LF_MFUNCTION [size = 28, hash = 55779]
 ALL-NEXT:            return type = 0, # args = 0x1000, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x100E, this type = 0x100F, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1015 | LF_METHODLIST [size = 28]
+ALL-NEXT:   0x1015 | LF_METHODLIST [size = 28, hash = 220695]
 ALL-NEXT:            - Method [type = 0x1011, vftable offset = -1, attrs = public]
 ALL-NEXT:            - Method [type = 0x1013, vftable offset = -1, attrs = public]
 ALL-NEXT:            - Method [type = 0x1014, vftable offset = -1, attrs = public]
-ALL-NEXT:   0x1016 | LF_FIELDLIST [size = 96]
+ALL-NEXT:   0x1016 | LF_FIELDLIST [size = 96, hash = 198114]
 ALL-NEXT:            - LF_NESTTYPE [name = `type_e`, parent = 0x100D]
 ALL-NEXT:            - LF_METHOD [name = `event_receiverAttribute`, # overloads = 3, overload list = 0x1015]
 ALL-NEXT:            - LF_MEMBER [name = `type`, Type = 0x100D, offset = 0, attrs = public]
 ALL-NEXT:            - LF_MEMBER [name = `layout_dependent`, Type = 0x0030 (bool), offset = 4, attrs = public]
-ALL-NEXT:   0x1017 | LF_STRUCTURE [size = 112]
+ALL-NEXT:   0x1017 | LF_STRUCTURE [size = 112, hash = 148734]
 ALL-NEXT:            class name: `__vc_attributes::event_receiverAttribute`
 ALL-NEXT:            unique name: `.?AUevent_receiverAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: 0x1016
 ALL-NEXT:            options: has ctor / dtor | contains nested class | has unique name
-ALL-NEXT:   0x1018 | LF_FIELDLIST [size = 48]
+ALL-NEXT:   0x1018 | LF_FIELDLIST [size = 48, hash = 81128]
 ALL-NEXT:            - LF_ENUMERATE [never = 0]
 ALL-NEXT:            - LF_ENUMERATE [allowed = 1]
 ALL-NEXT:            - LF_ENUMERATE [always = 2]
-ALL-NEXT:   0x1019 | LF_ENUM [size = 116]
+ALL-NEXT:   0x1019 | LF_ENUM [size = 116, hash = 60158]
 ALL-NEXT:            name: `__vc_attributes::aggregatableAttribute::type_e`
 ALL-NEXT:            unique name: `.?AW4type_e at aggregatableAttribute@__vc_attributes@@`
 ALL-NEXT:            field list: 0x1018, underlying type: 0x0074 (int)
 ALL-NEXT:            options: has unique name | is nested
-ALL-NEXT:   0x101A | LF_STRUCTURE [size = 108]
+ALL-NEXT:   0x101A | LF_STRUCTURE [size = 108, hash = 217249]
 ALL-NEXT:            class name: `__vc_attributes::aggregatableAttribute`
 ALL-NEXT:            unique name: `.?AUaggregatableAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: <no type>
 ALL-NEXT:            options: forward ref | has unique name
-ALL-NEXT:   0x101B | LF_POINTER [size = 12]
+ALL-NEXT:   0x101B | LF_POINTER [size = 12, hash = 174209]
 ALL-NEXT:            referent = 0x101A, mode = pointer, opts = const, kind = ptr32
-ALL-NEXT:   0x101C | LF_ARGLIST [size = 12]
+ALL-NEXT:   0x101C | LF_ARGLIST [size = 12, hash = 159978]
 ALL-NEXT:            0x1019: `__vc_attributes::aggregatableAttribute::type_e`
-ALL-NEXT:   0x101D | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x101D | LF_MFUNCTION [size = 28, hash = 249504]
 ALL-NEXT:            return type = 1, # args = 0x101C, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x101A, this type = 0x101B, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x101E | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x101E | LF_MFUNCTION [size = 28, hash = 141941]
 ALL-NEXT:            return type = 0, # args = 0x1000, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x101A, this type = 0x101B, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x101F | LF_METHODLIST [size = 20]
+ALL-NEXT:   0x101F | LF_METHODLIST [size = 20, hash = 238785]
 ALL-NEXT:            - Method [type = 0x101D, vftable offset = -1, attrs = public]
 ALL-NEXT:            - Method [type = 0x101E, vftable offset = -1, attrs = public]
-ALL-NEXT:   0x1020 | LF_FIELDLIST [size = 68]
+ALL-NEXT:   0x1020 | LF_FIELDLIST [size = 68, hash = 6214]
 ALL-NEXT:            - LF_NESTTYPE [name = `type_e`, parent = 0x1019]
 ALL-NEXT:            - LF_METHOD [name = `aggregatableAttribute`, # overloads = 2, overload list = 0x101F]
 ALL-NEXT:            - LF_MEMBER [name = `type`, Type = 0x1019, offset = 0, attrs = public]
-ALL-NEXT:   0x1021 | LF_STRUCTURE [size = 108]
+ALL-NEXT:   0x1021 | LF_STRUCTURE [size = 108, hash = 94935]
 ALL-NEXT:            class name: `__vc_attributes::aggregatableAttribute`
 ALL-NEXT:            unique name: `.?AUaggregatableAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: 0x1020
 ALL-NEXT:            options: has ctor / dtor | contains nested class | has unique name
-ALL-NEXT:   0x1022 | LF_ENUM [size = 116]
+ALL-NEXT:   0x1022 | LF_ENUM [size = 116, hash = 151449]
 ALL-NEXT:            name: `__vc_attributes::event_sourceAttribute::type_e`
 ALL-NEXT:            unique name: `.?AW4type_e at event_sourceAttribute@__vc_attributes@@`
 ALL-NEXT:            field list: 0x100C, underlying type: 0x0074 (int)
 ALL-NEXT:            options: has unique name | is nested
-ALL-NEXT:   0x1023 | LF_FIELDLIST [size = 28]
+ALL-NEXT:   0x1023 | LF_FIELDLIST [size = 28, hash = 135589]
 ALL-NEXT:            - LF_ENUMERATE [speed = 0]
 ALL-NEXT:            - LF_ENUMERATE [size = 1]
-ALL-NEXT:   0x1024 | LF_ENUM [size = 124]
+ALL-NEXT:   0x1024 | LF_ENUM [size = 124, hash = 73373]
 ALL-NEXT:            name: `__vc_attributes::event_sourceAttribute::optimize_e`
 ALL-NEXT:            unique name: `.?AW4optimize_e at event_sourceAttribute@__vc_attributes@@`
 ALL-NEXT:            field list: 0x1023, underlying type: 0x0074 (int)
 ALL-NEXT:            options: has unique name | is nested
-ALL-NEXT:   0x1025 | LF_STRUCTURE [size = 108]
+ALL-NEXT:   0x1025 | LF_STRUCTURE [size = 108, hash = 96512]
 ALL-NEXT:            class name: `__vc_attributes::event_sourceAttribute`
 ALL-NEXT:            unique name: `.?AUevent_sourceAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: <no type>
 ALL-NEXT:            options: forward ref | has unique name
-ALL-NEXT:   0x1026 | LF_POINTER [size = 12]
+ALL-NEXT:   0x1026 | LF_POINTER [size = 12, hash = 254299]
 ALL-NEXT:            referent = 0x1025, mode = pointer, opts = const, kind = ptr32
-ALL-NEXT:   0x1027 | LF_ARGLIST [size = 12]
+ALL-NEXT:   0x1027 | LF_ARGLIST [size = 12, hash = 17744]
 ALL-NEXT:            0x1022: `__vc_attributes::event_sourceAttribute::type_e`
-ALL-NEXT:   0x1028 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1028 | LF_MFUNCTION [size = 28, hash = 239514]
 ALL-NEXT:            return type = 1, # args = 0x1027, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x1025, this type = 0x1026, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1029 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1029 | LF_MFUNCTION [size = 28, hash = 173189]
 ALL-NEXT:            return type = 0, # args = 0x1000, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x1025, this type = 0x1026, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x102A | LF_METHODLIST [size = 20]
+ALL-NEXT:   0x102A | LF_METHODLIST [size = 20, hash = 130544]
 ALL-NEXT:            - Method [type = 0x1028, vftable offset = -1, attrs = public]
 ALL-NEXT:            - Method [type = 0x1029, vftable offset = -1, attrs = public]
-ALL-NEXT:   0x102B | LF_FIELDLIST [size = 128]
+ALL-NEXT:   0x102B | LF_FIELDLIST [size = 128, hash = 204437]
 ALL-NEXT:            - LF_NESTTYPE [name = `type_e`, parent = 0x1022]
 ALL-NEXT:            - LF_NESTTYPE [name = `optimize_e`, parent = 0x1024]
 ALL-NEXT:            - LF_METHOD [name = `event_sourceAttribute`, # overloads = 2, overload list = 0x102A]
 ALL-NEXT:            - LF_MEMBER [name = `type`, Type = 0x1022, offset = 0, attrs = public]
 ALL-NEXT:            - LF_MEMBER [name = `optimize`, Type = 0x1024, offset = 4, attrs = public]
 ALL-NEXT:            - LF_MEMBER [name = `decorate`, Type = 0x0030 (bool), offset = 8, attrs = public]
-ALL-NEXT:   0x102C | LF_STRUCTURE [size = 108]
+ALL-NEXT:   0x102C | LF_STRUCTURE [size = 108, hash = 238560]
 ALL-NEXT:            class name: `__vc_attributes::event_sourceAttribute`
 ALL-NEXT:            unique name: `.?AUevent_sourceAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: 0x102B
 ALL-NEXT:            options: has ctor / dtor | contains nested class | has unique name
-ALL-NEXT:   0x102D | LF_FIELDLIST [size = 92]
+ALL-NEXT:   0x102D | LF_FIELDLIST [size = 92, hash = 144673]
 ALL-NEXT:            - LF_ENUMERATE [dll = 1]
 ALL-NEXT:            - LF_ENUMERATE [exe = 2]
 ALL-NEXT:            - LF_ENUMERATE [service = 3]
 ALL-NEXT:            - LF_ENUMERATE [unspecified = 4]
 ALL-NEXT:            - LF_ENUMERATE [EXE = 2]
 ALL-NEXT:            - LF_ENUMERATE [SERVICE = 3]
-ALL-NEXT:   0x102E | LF_ENUM [size = 104]
+ALL-NEXT:   0x102E | LF_ENUM [size = 104, hash = 115151]
 ALL-NEXT:            name: `__vc_attributes::moduleAttribute::type_e`
 ALL-NEXT:            unique name: `.?AW4type_e at moduleAttribute@__vc_attributes@@`
 ALL-NEXT:            field list: 0x102D, underlying type: 0x0074 (int)
 ALL-NEXT:            options: has unique name | is nested
-ALL-NEXT:   0x102F | LF_STRUCTURE [size = 96]
+ALL-NEXT:   0x102F | LF_STRUCTURE [size = 96, hash = 197306]
 ALL-NEXT:            class name: `__vc_attributes::moduleAttribute`
 ALL-NEXT:            unique name: `.?AUmoduleAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: <no type>
 ALL-NEXT:            options: forward ref | has unique name
-ALL-NEXT:   0x1030 | LF_POINTER [size = 12]
+ALL-NEXT:   0x1030 | LF_POINTER [size = 12, hash = 256035]
 ALL-NEXT:            referent = 0x102F, mode = pointer, opts = const, kind = ptr32
-ALL-NEXT:   0x1031 | LF_MODIFIER [size = 12]
+ALL-NEXT:   0x1031 | LF_MODIFIER [size = 12, hash = 101096]
 ALL-NEXT:            referent = 0x0070 (char), modifiers = const
-ALL-NEXT:   0x1032 | LF_POINTER [size = 12]
+ALL-NEXT:   0x1032 | LF_POINTER [size = 12, hash = 231280]
 ALL-NEXT:            referent = 0x1031, mode = pointer, opts = None, kind = ptr32
-ALL-NEXT:   0x1033 | LF_ARGLIST [size = 68]
+ALL-NEXT:   0x1033 | LF_ARGLIST [size = 68, hash = 52156]
 ALL-NEXT:            0x102E: `__vc_attributes::moduleAttribute::type_e`
 ALL-NEXT:            0x1032: `const char*`
 ALL-NEXT:            0x1032: `const char*`
@@ -272,25 +272,25 @@ ALL-NEXT:            0x0030 (bool): `boo
 ALL-NEXT:            0x0030 (bool): `bool`
 ALL-NEXT:            0x1032: `const char*`
 ALL-NEXT:            0x1032: `const char*`
-ALL-NEXT:   0x1034 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1034 | LF_MFUNCTION [size = 28, hash = 48854]
 ALL-NEXT:            return type = 15, # args = 0x1033, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x102F, this type = 0x1030, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1035 | LF_ARGLIST [size = 12]
+ALL-NEXT:   0x1035 | LF_ARGLIST [size = 12, hash = 170035]
 ALL-NEXT:            0x102E: `__vc_attributes::moduleAttribute::type_e`
-ALL-NEXT:   0x1036 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1036 | LF_MFUNCTION [size = 28, hash = 177041]
 ALL-NEXT:            return type = 1, # args = 0x1035, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x102F, this type = 0x1030, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1037 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1037 | LF_MFUNCTION [size = 28, hash = 102745]
 ALL-NEXT:            return type = 0, # args = 0x1000, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x102F, this type = 0x1030, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1038 | LF_METHODLIST [size = 28]
+ALL-NEXT:   0x1038 | LF_METHODLIST [size = 28, hash = 16947]
 ALL-NEXT:            - Method [type = 0x1034, vftable offset = -1, attrs = public]
 ALL-NEXT:            - Method [type = 0x1036, vftable offset = -1, attrs = public]
 ALL-NEXT:            - Method [type = 0x1037, vftable offset = -1, attrs = public]
-ALL-NEXT:   0x1039 | LF_FIELDLIST [size = 356]
+ALL-NEXT:   0x1039 | LF_FIELDLIST [size = 356, hash = 183703]
 ALL-NEXT:            - LF_NESTTYPE [name = `type_e`, parent = 0x102E]
 ALL-NEXT:            - LF_METHOD [name = `moduleAttribute`, # overloads = 3, overload list = 0x1038]
 ALL-NEXT:            - LF_MEMBER [name = `type`, Type = 0x102E, offset = 0, attrs = public]
@@ -308,12 +308,12 @@ ALL-NEXT:            - LF_MEMBER [name =
 ALL-NEXT:            - LF_MEMBER [name = `restricted`, Type = 0x0030 (bool), offset = 45, attrs = public]
 ALL-NEXT:            - LF_MEMBER [name = `custom`, Type = 0x1032, offset = 48, attrs = public]
 ALL-NEXT:            - LF_MEMBER [name = `resource_name`, Type = 0x1032, offset = 52, attrs = public]
-ALL-NEXT:   0x103A | LF_STRUCTURE [size = 96]
+ALL-NEXT:   0x103A | LF_STRUCTURE [size = 96, hash = 98548]
 ALL-NEXT:            class name: `__vc_attributes::moduleAttribute`
 ALL-NEXT:            unique name: `.?AUmoduleAttribute at __vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: 0x1039
 ALL-NEXT:            options: has ctor / dtor | contains nested class | has unique name
-ALL-NEXT:   0x103B | LF_FIELDLIST [size = 756]
+ALL-NEXT:   0x103B | LF_FIELDLIST [size = 756, hash = 35693]
 ALL-NEXT:            - LF_ENUMERATE [eAnyUsage = 0]
 ALL-NEXT:            - LF_ENUMERATE [eCoClassUsage = 1]
 ALL-NEXT:            - LF_ENUMERATE [eCOMInterfaceUsage = 2]
@@ -344,98 +344,104 @@ ALL-NEXT:            - LF_ENUMERATE [eMo
 ALL-NEXT:            - LF_ENUMERATE [eIllegalUsage = 33554432]
 ALL-NEXT:            - LF_ENUMERATE [eAsynchronousUsage = 67108864]
 ALL-NEXT:            - LF_ENUMERATE [eAnyIDLUsage = 4161535]
-ALL-NEXT:   0x103C | LF_ENUM [size = 140]
+ALL-NEXT:   0x103C | LF_ENUM [size = 140, hash = 171328]
 ALL-NEXT:            name: `__vc_attributes::helper_attributes::usageAttribute::usage_e`
 ALL-NEXT:            unique name: `.?AW4usage_e at usageAttribute@helper_attributes at __vc_attributes@@`
 ALL-NEXT:            field list: 0x103B, underlying type: 0x0074 (int)
 ALL-NEXT:            options: has unique name | is nested
-ALL-NEXT:   0x103D | LF_STRUCTURE [size = 128]
+ALL-NEXT:   0x103D | LF_STRUCTURE [size = 128, hash = 203640]
 ALL-NEXT:            class name: `__vc_attributes::helper_attributes::usageAttribute`
 ALL-NEXT:            unique name: `.?AUusageAttribute at helper_attributes@__vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: <no type>
 ALL-NEXT:            options: forward ref | has unique name
-ALL-NEXT:   0x103E | LF_POINTER [size = 12]
+ALL-NEXT:   0x103E | LF_POINTER [size = 12, hash = 139292]
 ALL-NEXT:            referent = 0x103D, mode = pointer, opts = const, kind = ptr32
-ALL-NEXT:   0x103F | LF_ARGLIST [size = 12]
+ALL-NEXT:   0x103F | LF_ARGLIST [size = 12, hash = 49018]
 ALL-NEXT:            0x0075 (unsigned): `unsigned`
-ALL-NEXT:   0x1040 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1040 | LF_MFUNCTION [size = 28, hash = 43821]
 ALL-NEXT:            return type = 1, # args = 0x103F, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x103D, this type = 0x103E, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1041 | LF_FIELDLIST [size = 60]
+ALL-NEXT:   0x1041 | LF_FIELDLIST [size = 60, hash = 202555]
 ALL-NEXT:            - LF_NESTTYPE [name = `usage_e`, parent = 0x103C]
 ALL-NEXT:            - LF_ONEMETHOD [name = `usageAttribute`]
 ALL-NEXT:              type = 0x1040, vftable offset = -1, attrs = public
 ALL-NEXT:            - LF_MEMBER [name = `value`, Type = 0x0075 (unsigned), offset = 0, attrs = public]
-ALL-NEXT:   0x1042 | LF_STRUCTURE [size = 128]
+ALL-NEXT:   0x1042 | LF_STRUCTURE [size = 128, hash = 165040]
 ALL-NEXT:            class name: `__vc_attributes::helper_attributes::usageAttribute`
 ALL-NEXT:            unique name: `.?AUusageAttribute at helper_attributes@__vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: 0x1041
 ALL-NEXT:            options: has ctor / dtor | contains nested class | has unique name
-ALL-NEXT:   0x1043 | LF_FIELDLIST [size = 68]
+ALL-NEXT:   0x1043 | LF_FIELDLIST [size = 68, hash = 215835]
 ALL-NEXT:            - LF_ENUMERATE [eBoolean = 0]
 ALL-NEXT:            - LF_ENUMERATE [eInteger = 1]
 ALL-NEXT:            - LF_ENUMERATE [eFloat = 2]
 ALL-NEXT:            - LF_ENUMERATE [eDouble = 3]
-ALL-NEXT:   0x1044 | LF_ENUM [size = 148]
+ALL-NEXT:   0x1044 | LF_ENUM [size = 148, hash = 142625]
 ALL-NEXT:            name: `__vc_attributes::helper_attributes::v1_alttypeAttribute::type_e`
 ALL-NEXT:            unique name: `.?AW4type_e at v1_alttypeAttribute@helper_attributes at __vc_attributes@@`
 ALL-NEXT:            field list: 0x1043, underlying type: 0x0074 (int)
 ALL-NEXT:            options: has unique name | is nested
-ALL-NEXT:   0x1045 | LF_STRUCTURE [size = 140]
+ALL-NEXT:   0x1045 | LF_STRUCTURE [size = 140, hash = 52534]
 ALL-NEXT:            class name: `__vc_attributes::helper_attributes::v1_alttypeAttribute`
 ALL-NEXT:            unique name: `.?AUv1_alttypeAttribute at helper_attributes@__vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: <no type>
 ALL-NEXT:            options: forward ref | has unique name
-ALL-NEXT:   0x1046 | LF_POINTER [size = 12]
+ALL-NEXT:   0x1046 | LF_POINTER [size = 12, hash = 44186]
 ALL-NEXT:            referent = 0x1045, mode = pointer, opts = const, kind = ptr32
-ALL-NEXT:   0x1047 | LF_ARGLIST [size = 12]
+ALL-NEXT:   0x1047 | LF_ARGLIST [size = 12, hash = 103930]
 ALL-NEXT:            0x1044: `__vc_attributes::helper_attributes::v1_alttypeAttribute::type_e`
-ALL-NEXT:   0x1048 | LF_MFUNCTION [size = 28]
+ALL-NEXT:   0x1048 | LF_MFUNCTION [size = 28, hash = 110942]
 ALL-NEXT:            return type = 1, # args = 0x1047, param list = 0x0003 (void)
 ALL-NEXT:            class type = 0x1045, this type = 0x1046, this adjust = 0
 ALL-NEXT:            calling conv = thiscall, options = constructor
-ALL-NEXT:   0x1049 | LF_FIELDLIST [size = 64]
+ALL-NEXT:   0x1049 | LF_FIELDLIST [size = 64, hash = 17991]
 ALL-NEXT:            - LF_NESTTYPE [name = `type_e`, parent = 0x1044]
 ALL-NEXT:            - LF_ONEMETHOD [name = `v1_alttypeAttribute`]
 ALL-NEXT:              type = 0x1048, vftable offset = -1, attrs = public
 ALL-NEXT:            - LF_MEMBER [name = `type`, Type = 0x1044, offset = 0, attrs = public]
-ALL-NEXT:   0x104A | LF_STRUCTURE [size = 140]
+ALL-NEXT:   0x104A | LF_STRUCTURE [size = 140, hash = 213215]
 ALL-NEXT:            class name: `__vc_attributes::helper_attributes::v1_alttypeAttribute`
 ALL-NEXT:            unique name: `.?AUv1_alttypeAttribute at helper_attributes@__vc_attributes@@`
 ALL-NEXT:            vtable: <no type>, base list: <no type>, field list: 0x1049
 ALL-NEXT:            options: has ctor / dtor | contains nested class | has unique name
+ALL:        Type Index Offsets:
+ALL-NEXT:     TI: 0x1000, Offset: 0
+ALL:        Hash Adjusters:
 ALL:                           Types (IPI Stream)
 ALL-NEXT: ============================================================
 ALL-NEXT:   Showing 15 records
-ALL-NEXT:   0x1000 | LF_UDT_MOD_SRC_LINE [size = 20]
+ALL-NEXT:   0x1000 | LF_UDT_MOD_SRC_LINE [size = 20, hash = 7186]
 ALL-NEXT:            udt = 0x100B, mod = 1, file = 1, line = 481
-ALL-NEXT:   0x1001 | LF_UDT_MOD_SRC_LINE [size = 20]
+ALL-NEXT:   0x1001 | LF_UDT_MOD_SRC_LINE [size = 20, hash = 7198]
 ALL-NEXT:            udt = 0x1017, mod = 1, file = 1, line = 194
-ALL-NEXT:   0x1002 | LF_UDT_MOD_SRC_LINE [size = 20]
+ALL-NEXT:   0x1002 | LF_UDT_MOD_SRC_LINE [size = 20, hash = 7180]
 ALL-NEXT:            udt = 0x1021, mod = 1, file = 1, line = 603
-ALL-NEXT:   0x1003 | LF_UDT_MOD_SRC_LINE [size = 20]
+ALL-NEXT:   0x1003 | LF_UDT_MOD_SRC_LINE [size = 20, hash = 7191]
 ALL-NEXT:            udt = 0x102C, mod = 1, file = 1, line = 1200
-ALL-NEXT:   0x1004 | LF_UDT_MOD_SRC_LINE [size = 20]
+ALL-NEXT:   0x1004 | LF_UDT_MOD_SRC_LINE [size = 20, hash = 7201]
 ALL-NEXT:            udt = 0x103A, mod = 1, file = 1, line = 540
-ALL-NEXT:   0x1005 | LF_UDT_MOD_SRC_LINE [size = 20]
+ALL-NEXT:   0x1005 | LF_UDT_MOD_SRC_LINE [size = 20, hash = 7241]
 ALL-NEXT:            udt = 0x1042, mod = 1, file = 1, line = 108
-ALL-NEXT:   0x1006 | LF_UDT_MOD_SRC_LINE [size = 20]
+ALL-NEXT:   0x1006 | LF_UDT_MOD_SRC_LINE [size = 20, hash = 7249]
 ALL-NEXT:            udt = 0x104A, mod = 1, file = 1, line = 96
-ALL-NEXT:   0x1007 | LF_STRING_ID [size = 48] ID: <no type>, String: d:\src\llvm\test\DebugInfo\PDB\Inputs
-ALL-NEXT:   0x1008 | LF_STRING_ID [size = 76] ID: <no type>, String: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\cl.exe
-ALL-NEXT:   0x1009 | LF_STRING_ID [size = 20] ID: <no type>, String: empty.cpp
-ALL-NEXT:   0x100A | LF_STRING_ID [size = 56] ID: <no type>, String: d:\src\llvm\test\DebugInfo\PDB\Inputs\vc120.pdb
-ALL-NEXT:   0x100B | LF_STRING_ID [size = 252] ID: <no type>, String: -Zi -MT -I"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows
-ALL-NEXT:   0x100C | LF_SUBSTR_LIST [size = 12]
+ALL-NEXT:   0x1007 | LF_STRING_ID [size = 48, hash = 80727] ID: <no type>, String: d:\src\llvm\test\DebugInfo\PDB\Inputs
+ALL-NEXT:   0x1008 | LF_STRING_ID [size = 76, hash = 154177] ID: <no type>, String: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\cl.exe
+ALL-NEXT:   0x1009 | LF_STRING_ID [size = 20, hash = 75189] ID: <no type>, String: empty.cpp
+ALL-NEXT:   0x100A | LF_STRING_ID [size = 56, hash = 253662] ID: <no type>, String: d:\src\llvm\test\DebugInfo\PDB\Inputs\vc120.pdb
+ALL-NEXT:   0x100B | LF_STRING_ID [size = 252, hash = 193467] ID: <no type>, String: -Zi -MT -I"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows
+ALL-NEXT:   0x100C | LF_SUBSTR_LIST [size = 12, hash = 222705]
 ALL-NEXT:            0x100B: `-Zi -MT -I"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\8.1\include\shared" -I"C:\Program Files (x86)\Windows`
-ALL-NEXT:   0x100D | LF_STRING_ID [size = 96] ID: 0x100C, String:  Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TP -X
-ALL-NEXT:   0x100E | LF_BUILDINFO [size = 28]
+ALL-NEXT:   0x100D | LF_STRING_ID [size = 96, hash = 186099] ID: 0x100C, String:  Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TP -X
+ALL-NEXT:   0x100E | LF_BUILDINFO [size = 28, hash = 257108]
 ALL-NEXT:            0x1007: `d:\src\llvm\test\DebugInfo\PDB\Inputs`
 ALL-NEXT:            0x1008: `C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\cl.exe`
 ALL-NEXT:            0x1009: `empty.cpp`
 ALL-NEXT:            0x100A: `d:\src\llvm\test\DebugInfo\PDB\Inputs\vc120.pdb`
 ALL-NEXT:            0x100D: ` Kits\8.1\include\um" -I"C:\Program Files (x86)\Windows Kits\8.1\include\winrt" -TP -X`
+ALL:        Type Index Offsets:
+ALL-NEXT:     TI: 0x1000, Offset: 0
+ALL:        Hash Adjusters:
 ALL:                             Public Symbols
 ALL-NEXT: ============================================================
 ALL-NEXT:   - S_PUB32 [size = 36] `?__purecall@@3PAXA`

Modified: llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.cpp?rev=305524&r1=305523&r2=305524&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.cpp Thu Jun 15 18:04:42 2017
@@ -208,9 +208,20 @@ Error MinimalTypeDumpVisitor::visitTypeB
   // formatLine puts the newline at the beginning, so we use formatLine here
   // to start a new line, and then individual visit methods use format to
   // append to the existing line.
-  P.formatLine("{0} | {1} [size = {2}]",
-               fmt_align(Index, AlignStyle::Right, Width),
-               getLeafTypeName(Record.Type), Record.length());
+  if (!Hashes) {
+    P.formatLine("{0} | {1} [size = {2}]",
+                 fmt_align(Index, AlignStyle::Right, Width),
+                 getLeafTypeName(Record.Type), Record.length());
+  } else {
+    std::string H;
+    if (Index.toArrayIndex() >= HashValues.size())
+      H = "(not present)";
+    else
+      H = utostr(HashValues[Index.toArrayIndex()]);
+    P.formatLine("{0} | {1} [size = {2}, hash = {3}]",
+                 fmt_align(Index, AlignStyle::Right, Width),
+                 getLeafTypeName(Record.Type), Record.length(), H);
+  }
   P.Indent(Width + 3);
   return Error::success();
 }

Modified: llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.h?rev=305524&r1=305523&r2=305524&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbutil/MinimalTypeDumper.h Thu Jun 15 18:04:42 2017
@@ -11,6 +11,7 @@
 #define LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_TYPE_DUMPER_H
 
 #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
+#include "llvm/Support/BinaryStreamArray.h"
 
 namespace llvm {
 namespace codeview {
@@ -23,8 +24,10 @@ class LinePrinter;
 class MinimalTypeDumpVisitor : public codeview::TypeVisitorCallbacks {
 public:
   MinimalTypeDumpVisitor(LinePrinter &P, uint32_t Width, bool RecordBytes,
-                         codeview::LazyRandomTypeCollection &Types)
-      : P(P), Width(Width), RecordBytes(RecordBytes), Types(Types) {}
+                         bool Hashes, codeview::LazyRandomTypeCollection &Types,
+                         FixedStreamArray<support::ulittle32_t> HashValues)
+      : P(P), Width(Width), RecordBytes(RecordBytes), Hashes(Hashes),
+        Types(Types), HashValues(HashValues) {}
 
   Error visitTypeBegin(codeview::CVType &Record,
                        codeview::TypeIndex Index) override;
@@ -48,7 +51,9 @@ private:
   LinePrinter &P;
   uint32_t Width;
   bool RecordBytes = false;
+  bool Hashes = false;
   codeview::LazyRandomTypeCollection &Types;
+  FixedStreamArray<support::ulittle32_t> HashValues;
 };
 } // namespace pdb
 } // namespace llvm

Modified: llvm/trunk/tools/llvm-pdbutil/RawOutputStyle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/RawOutputStyle.cpp?rev=305524&r1=305523&r2=305524&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/RawOutputStyle.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/RawOutputStyle.cpp Thu Jun 15 18:04:42 2017
@@ -103,12 +103,12 @@ Error RawOutputStyle::dump() {
       return EC;
   }
 
-  if (opts::raw::DumpTypes) {
+  if (opts::raw::DumpTypes || opts::raw::DumpTypeExtras) {
     if (auto EC = dumpTpiStream(StreamTPI))
       return EC;
   }
 
-  if (opts::raw::DumpIds) {
+  if (opts::raw::DumpIds || opts::raw::DumpIdExtras) {
     if (auto EC = dumpTpiStream(StreamIPI))
       return EC;
   }
@@ -367,15 +367,21 @@ Error RawOutputStyle::dumpTpiStream(uint
   assert(StreamIdx == StreamTPI || StreamIdx == StreamIPI);
 
   bool Present = false;
+  bool DumpTypes = false;
   bool DumpBytes = false;
+  bool DumpExtras = false;
   if (StreamIdx == StreamTPI) {
     printHeader(P, "Types (TPI Stream)");
     Present = File.hasPDBTpiStream();
+    DumpTypes = opts::raw::DumpTypes;
     DumpBytes = opts::raw::DumpTypeData;
+    DumpExtras = opts::raw::DumpTypeExtras;
   } else if (StreamIdx == StreamIPI) {
     printHeader(P, "Types (IPI Stream)");
     Present = File.hasPDBIpiStream();
+    DumpTypes = opts::raw::DumpIds;
     DumpBytes = opts::raw::DumpIdData;
+    DumpExtras = opts::raw::DumpIdExtras;
   }
 
   AutoIndent Indent(P);
@@ -391,16 +397,45 @@ Error RawOutputStyle::dumpTpiStream(uint
 
   auto &Types = Err(initializeTypeDatabase(StreamIdx));
 
-  P.formatLine("Showing {0:N} records", Stream.getNumTypeRecords());
-  uint32_t Width =
-      NumDigits(TypeIndex::FirstNonSimpleIndex + Stream.getNumTypeRecords());
-
-  MinimalTypeDumpVisitor V(P, Width + 2, DumpBytes, Types);
-
-  Optional<TypeIndex> I = Types.getFirst();
-  if (auto EC = codeview::visitTypeStream(Types, V)) {
-    P.formatLine("An error occurred dumping type records: {0}",
-                 toString(std::move(EC)));
+  if (DumpTypes) {
+    P.formatLine("Showing {0:N} records", Stream.getNumTypeRecords());
+    uint32_t Width =
+        NumDigits(TypeIndex::FirstNonSimpleIndex + Stream.getNumTypeRecords());
+
+    MinimalTypeDumpVisitor V(P, Width + 2, DumpBytes, DumpExtras, Types,
+                             Stream.getHashValues());
+
+    Optional<TypeIndex> I = Types.getFirst();
+    if (auto EC = codeview::visitTypeStream(Types, V)) {
+      P.formatLine("An error occurred dumping type records: {0}",
+                   toString(std::move(EC)));
+    }
+  }
+
+  if (DumpExtras) {
+    P.NewLine();
+    auto IndexOffsets = Stream.getTypeIndexOffsets();
+    P.formatLine("Type Index Offsets:");
+    for (const auto &IO : IndexOffsets) {
+      AutoIndent Indent2(P);
+      P.formatLine("TI: {0}, Offset: {1}", IO.Type, fmtle(IO.Offset));
+    }
+
+    P.NewLine();
+    P.formatLine("Hash Adjusters:");
+    auto &Adjusters = Stream.getHashAdjusters();
+    auto &Strings = Err(File.getStringTable());
+    for (const auto &A : Adjusters) {
+      AutoIndent Indent2(P);
+      auto ExpectedStr = Strings.getStringForID(A.first);
+      TypeIndex TI(A.second);
+      if (ExpectedStr)
+        P.formatLine("`{0}` -> {1}", *ExpectedStr, TI);
+      else {
+        P.formatLine("unknown str id ({0}) -> {1}", A.first, TI);
+        consumeError(ExpectedStr.takeError());
+      }
+    }
   }
   return Error::success();
 }

Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp?rev=305524&r1=305523&r2=305524&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp Thu Jun 15 18:04:42 2017
@@ -302,8 +302,8 @@ cl::opt<bool> DumpTypeData(
     cl::desc("dump CodeView type record raw bytes from TPI stream"),
     cl::cat(TypeOptions), cl::sub(RawSubcommand));
 
-cl::opt<bool> DumpTypeHashes("type-hash",
-                             cl::desc("dump CodeView TPI hash stream"),
+cl::opt<bool> DumpTypeExtras("type-extras",
+                             cl::desc("dump type hashes and index offsets"),
                              cl::cat(TypeOptions), cl::sub(RawSubcommand));
 
 cl::opt<bool> DumpIds("ids",
@@ -314,6 +314,10 @@ cl::opt<bool>
                cl::desc("dump CodeView type record raw bytes from IPI stream"),
                cl::cat(TypeOptions), cl::sub(RawSubcommand));
 
+cl::opt<bool> DumpIdExtras("id-extras",
+                           cl::desc("dump id hashes and index offsets"),
+                           cl::cat(TypeOptions), cl::sub(RawSubcommand));
+
 // SYMBOL OPTIONS
 cl::opt<bool> DumpPublics("publics", cl::desc("dump Publics stream data"),
                           cl::cat(SymbolOptions), cl::sub(RawSubcommand));
@@ -898,8 +902,9 @@ int main(int argc_, const char *argv_[])
       opts::raw::DumpSummary = true;
       opts::raw::DumpSymbols = true;
       opts::raw::DumpIds = true;
+      opts::raw::DumpIdExtras = true;
       opts::raw::DumpTypes = true;
-      opts::raw::DumpTypeHashes = true;
+      opts::raw::DumpTypeExtras = true;
       opts::raw::DumpModules = true;
       opts::raw::DumpModuleFiles = true;
     }

Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h?rev=305524&r1=305523&r2=305524&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h Thu Jun 15 18:04:42 2017
@@ -105,9 +105,10 @@ extern llvm::cl::list<std::string> DumpS
 extern llvm::cl::opt<bool> DumpStringTable;
 extern llvm::cl::opt<bool> DumpTypes;
 extern llvm::cl::opt<bool> DumpTypeData;
-extern llvm::cl::opt<bool> DumpTypeHashes;
+extern llvm::cl::opt<bool> DumpTypeExtras;
 extern llvm::cl::opt<bool> DumpIds;
 extern llvm::cl::opt<bool> DumpIdData;
+extern llvm::cl::opt<bool> DumpIdExtras;
 extern llvm::cl::opt<bool> DumpSymbols;
 extern llvm::cl::opt<bool> DumpSymRecordBytes;
 extern llvm::cl::opt<bool> DumpPublics;




More information about the llvm-commits mailing list