[llvm-pdbutil] Output the symbol offset when dumping.

Type records have a unique type index, but symbol records do
not.  Instead, symbol records refer to other symbol records
by referencing their offset in the symbol stream.  In a sense
this is the analogue of the TypeIndex, but we are not printing
it in the dumper.  Printing it not only gives us more useful
information when manually investigating the contents of a PDB,
but also allows us to write better tests by enabling us to
verify that fields that reference other symbol records do
so correctly.

Differential Revision: https://reviews.llvm.org/D34906

llvm-svn: 306890
This commit is contained in:
Zachary Turner 2017-06-30 21:35:00 +00:00
parent 45a7462094
commit af8c75a8c0
15 changed files with 333 additions and 253 deletions

View File

@ -41,49 +41,48 @@ CHECK-LABEL: Mod 0002 | `* Linker *`:
CHECK: Symbols
CHECK: ============================================================
CHECK-LABEL: Mod 0000 | `{{.*}}pdb_comdat_main.obj`:
CHECK: - S_OBJNAME [size = 56] sig=0, `C:\src\llvm-project\build\pdb_comdat_main.obj`
CHECK: - S_COMPILE3 [size = 60]
CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c
CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
CHECK: flags = security checks | hot patchable
CHECK: - S_GPROC32_ID [size = 44] `main`
FIXME: We need to fill in "end".
CHECK: parent = 0, addr = 0002:0000, code size = 24, end = 0
CHECK: debug start = 4, debug end = 19, flags = none
CHECK: - S_FRAMEPROC [size = 32]
CHECK: size = 40, padding size = 0, offset to padding = 0
CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000
CHECK: flags = has async eh | opt speed
CHECK: - S_END [size = 4]
CHECK: - S_GDATA32 [size = 24] `global`
CHECK: type = 0x0074 (int), addr = 0000:0000
CHECK: - S_BUILDINFO [size = 8] BuildId = `4106`
CHECK: - S_GPROC32_ID [size = 44] `foo`
CHECK: parent = 0, addr = 0002:0032, code size = 15, end = 0
CHECK: debug start = 0, debug end = 14, flags = none
CHECK: - S_FRAMEPROC [size = 32]
CHECK: size = 0, padding size = 0, offset to padding = 0
CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000
CHECK: flags = marked inline | has async eh | opt speed
CHECK: - S_END [size = 4]
CHECK: 4 | S_OBJNAME [size = 56] sig=0, `C:\src\llvm-project\build\pdb_comdat_main.obj`
CHECK: 60 | S_COMPILE3 [size = 60]
CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c
CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
CHECK: flags = security checks | hot patchable
CHECK: 120 | S_GPROC32_ID [size = 44] `main`
CHECK: parent = 0, end = 0, addr = 0002:0000, code size = 24
CHECK: debug start = 4, debug end = 19, flags = none
CHECK: 164 | S_FRAMEPROC [size = 32]
CHECK: size = 40, padding size = 0, offset to padding = 0
CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000
CHECK: flags = has async eh | opt speed
CHECK: 196 | S_END [size = 4]
CHECK: 200 | S_GDATA32 [size = 24] `global`
CHECK: type = 0x0074 (int), addr = 0000:0000
CHECK: 224 | S_BUILDINFO [size = 8] BuildId = `4106`
CHECK: 232 | S_GPROC32_ID [size = 44] `foo`
CHECK: parent = 0, end = 0, addr = 0002:0032, code size = 15
CHECK: debug start = 0, debug end = 14, flags = none
CHECK: 276 | S_FRAMEPROC [size = 32]
CHECK: size = 0, padding size = 0, offset to padding = 0
CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000
CHECK: flags = marked inline | has async eh | opt speed
CHECK: 308 | S_END [size = 4]
CHECK-LABEL: Mod 0001 | `{{.*}}pdb_comdat_bar.obj`:
CHECK: - S_OBJNAME [size = 56] sig=0, `C:\src\llvm-project\build\pdb_comdat_bar.obj`
CHECK: - S_COMPILE3 [size = 60]
CHECK: 4 | S_OBJNAME [size = 56] sig=0, `C:\src\llvm-project\build\pdb_comdat_bar.obj`
CHECK: 60 | S_COMPILE3 [size = 60]
CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c
CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
CHECK: flags = security checks | hot patchable
CHECK: - S_GPROC32_ID [size = 44] `bar`
CHECK: parent = 0, addr = 0002:0048, code size = 14, end = 0
CHECK: 120 | S_GPROC32_ID [size = 44] `bar`
CHECK: parent = 0, end = 0, addr = 0002:0048, code size = 14
CHECK: debug start = 4, debug end = 9, flags = none
CHECK: - S_FRAMEPROC [size = 32]
CHECK: 164 | S_FRAMEPROC [size = 32]
CHECK: size = 40, padding size = 0, offset to padding = 0
CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000
CHECK: flags = has async eh | opt speed
CHECK: - S_END [size = 4]
CHECK: - S_GDATA32 [size = 24] `global`
CHECK: 196 | S_END [size = 4]
CHECK: 200 | S_GDATA32 [size = 24] `global`
CHECK: type = 0x0074 (int), addr = 0000:0000
CHECK: - S_BUILDINFO [size = 8] BuildId = `4109`
CHECK-NOT: - S_GPROC32_ID {{.*}} `foo`
CHECK: 224 | S_BUILDINFO [size = 8] BuildId = `4109`
CHECK-NOT: S_GPROC32_ID {{.*}} `foo`
CHECK-LABEL: Mod 0002 | `* Linker *`:
Reorder the object files and verify that the other table is selected.

View File

@ -15,29 +15,29 @@
# CHECK: Symbols
# CHECK: ============================================================
# CHECK: Mod 0000 | `{{.*}}pdb-global-gc.yaml.tmp.obj`:
# CHECK: - S_GDATA32 [size = 28] `__wc_mb_cur`
# CHECK: 4 | S_GDATA32 [size = 28] `__wc_mb_cur`
# CHECK-NEXT: type = 0x0070 (char), addr = 0000:0000
# CHECK: Mod 0001 | `{{.*}}pdb-global-gc.yaml.tmp2.obj`:
# CHECK: Mod 0002 | `* Linker *`:
--- !COFF
header:
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ ]
sections:
sections:
- Name: '.debug$S'
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
Alignment: 1
Subsections:
Subsections:
- !Symbols
Records:
Records:
- Kind: S_GDATA32
DataSym:
DataSym:
Type: 112
DisplayName: __wc_mb_cur
- !StringTable
Strings:
Relocations:
Strings:
Relocations:
- VirtualAddress: 20
SymbolName: __wc_mb_cur
Type: IMAGE_REL_AMD64_SECREL
@ -48,7 +48,7 @@ sections:
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: 0FBE0500000000C3
Relocations:
Relocations:
- VirtualAddress: 3
SymbolName: __wc_mb_cur
Type: IMAGE_REL_AMD64_REL32
@ -56,14 +56,14 @@ sections:
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: B82A000000C3
symbols:
symbols:
- Name: '.debug$S'
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 240
NumberOfRelocations: 2
NumberOfLinenumbers: 0
@ -75,7 +75,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 11
NumberOfRelocations: 1
NumberOfLinenumbers: 0
@ -88,7 +88,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 6
NumberOfRelocations: 0
NumberOfLinenumbers: 0

View File

@ -14,28 +14,28 @@
# CHECK: Symbols
# CHECK: ============================================================
# CHECK: Mod 0000 | `{{.*}}pdb-import-gc.yaml.tmp.obj`:
# CHECK: - S_GDATA32 [size = 32] `__imp___wc_mb_cur`
# CHECK: 4 | S_GDATA32 [size = 32] `__imp___wc_mb_cur`
# CHECK-NEXT: type = 0x0070 (char), addr = 0000:0000
# CHECK: Mod 0001 | `* Linker *`:
--- !COFF
header:
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ ]
sections:
sections:
- Name: '.debug$S'
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
Alignment: 1
Subsections:
Subsections:
- !Symbols
Records:
Records:
- Kind: S_GDATA32
DataSym:
DataSym:
Type: 112
DisplayName: __imp___wc_mb_cur
- !StringTable
Strings:
Relocations:
Strings:
Relocations:
- VirtualAddress: 20
SymbolName: __imp___wc_mb_cur
Type: IMAGE_REL_AMD64_SECREL
@ -46,7 +46,7 @@ sections:
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: 488B05000000000FBE00C3
Relocations:
Relocations:
- VirtualAddress: 3
SymbolName: __imp___wc_mb_cur
Type: IMAGE_REL_AMD64_REL32
@ -54,14 +54,14 @@ sections:
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: B82A000000C3
symbols:
symbols:
- Name: '.debug$S'
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 240
NumberOfRelocations: 2
NumberOfLinenumbers: 0
@ -73,7 +73,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 11
NumberOfRelocations: 1
NumberOfLinenumbers: 0
@ -86,7 +86,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 6
NumberOfRelocations: 0
NumberOfLinenumbers: 0

View File

@ -8,28 +8,28 @@
# MSVC's for these absolute, linker-provided symbols.
# CHECK: Mod 0000 |
# CHECK-NEXT: - S_GDATA32 [size = 40] `___safe_se_handler_table`
# CHECK-NEXT: 4 | S_GDATA32 [size = 40] `___safe_se_handler_table`
# CHECK-NEXT: type = 0x0022 (unsigned long), addr = 0003:0000
# CHECK-NEXT: Mod 0001 | `* Linker *`:
--- !COFF
header:
header:
Machine: IMAGE_FILE_MACHINE_I386
Characteristics: [ ]
sections:
sections:
- Name: '.debug$S'
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
Alignment: 1
Subsections:
Subsections:
- !Symbols
Records:
Records:
- Kind: S_GDATA32
DataSym:
DataSym:
Type: 34
DisplayName: ___safe_se_handler_table
- !StringTable
Strings:
Relocations:
Strings:
Relocations:
- VirtualAddress: 20
SymbolName: ___safe_se_handler_table
Type: IMAGE_REL_I386_SECREL
@ -40,18 +40,18 @@ sections:
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: 488D0500000000C3
Relocations:
Relocations:
- VirtualAddress: 3
SymbolName: ___safe_se_handler_table
Type: IMAGE_REL_I386_REL32
symbols:
symbols:
- Name: '.debug$S'
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 372
NumberOfRelocations: 6
NumberOfLinenumbers: 0
@ -63,7 +63,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 8
NumberOfRelocations: 1
NumberOfLinenumbers: 0

View File

@ -8,28 +8,28 @@
# MSVC's for these absolute, linker-provided symbols.
# CHECK: Mod 0000 |
# CHECK-NEXT: - S_GDATA32 [size = 36] `__guard_fids_table`
# CHECK-NEXT: 4 | S_GDATA32 [size = 36] `__guard_fids_table`
# CHECK-NEXT: type = 0x0022 (unsigned long), addr = 0003:0000
# CHECK-NEXT: Mod 0001 | `* Linker *`:
--- !COFF
header:
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ ]
sections:
sections:
- Name: '.debug$S'
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
Alignment: 1
Subsections:
Subsections:
- !Symbols
Records:
Records:
- Kind: S_GDATA32
DataSym:
DataSym:
Type: 34
DisplayName: __guard_fids_table
- !StringTable
Strings:
Relocations:
Strings:
Relocations:
- VirtualAddress: 20
SymbolName: __guard_fids_table
Type: IMAGE_REL_AMD64_SECREL
@ -40,18 +40,18 @@ sections:
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: 488D0500000000C3
Relocations:
Relocations:
- VirtualAddress: 3
SymbolName: __guard_fids_table
Type: IMAGE_REL_AMD64_REL32
symbols:
symbols:
- Name: '.debug$S'
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 372
NumberOfRelocations: 6
NumberOfLinenumbers: 0
@ -63,7 +63,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 8
NumberOfRelocations: 1
NumberOfLinenumbers: 0

View File

@ -16,33 +16,33 @@
# CHECK: Symbols
# CHECK: ============================================================
# CHECK-LABEL: Mod 0000 | `{{.*}}pdb-symbol-types.yaml.tmp.obj`:
# CHECK: - S_OBJNAME [size = 52] sig=0, `C:\src\llvm-project\build\symbol-types.obj`
# CHECK: - S_COMPILE3 [size = 60]
# CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c
# CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
# CHECK: flags = security checks | hot patchable
# CHECK: - S_GPROC32_ID [size = 44] `main`
# CHECK: parent = 0, addr = 0002:0000, code size = 7, end = 0
# CHECK: debug start = 0, debug end = 6, flags = none
# CHECK: - S_FRAMEPROC [size = 32]
# CHECK: size = 0, padding size = 0, offset to padding = 0
# CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000
# CHECK: flags = has async eh | opt speed
# CHECK: - S_END [size = 4]
# CHECK: - S_GDATA32 [size = 28] `global_foo`
# CHECK: type = 0x1004 (Foo), addr = 0001:0000
# CHECK: - S_UDT [size = 16] `UDT_Foo`
# CHECK: original type = 0x1004
# CHECK: - S_UDT [size = 12] `Foo`
# CHECK: original type = 0x1004
# CHECK: - S_BUILDINFO [size = 8] BuildId = `4106`
# CHECK: 4 | S_OBJNAME [size = 52] sig=0, `C:\src\llvm-project\build\symbol-types.obj`
# CHECK: 56 | S_COMPILE3 [size = 60]
# CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c
# CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
# CHECK: flags = security checks | hot patchable
# CHECK: 116 | S_GPROC32_ID [size = 44] `main`
# CHECK: parent = 0, end = 0, addr = 0002:0000, code size = 7
# CHECK: debug start = 0, debug end = 6, flags = none
# CHECK: 160 | S_FRAMEPROC [size = 32]
# CHECK: size = 0, padding size = 0, offset to padding = 0
# CHECK: bytes of callee saved registers = 0, exception handler addr = 0000:0000
# CHECK: flags = has async eh | opt speed
# CHECK: 192 | S_END [size = 4]
# CHECK: 196 | S_GDATA32 [size = 28] `global_foo`
# CHECK: type = 0x1004 (Foo), addr = 0001:0000
# CHECK: 224 | S_UDT [size = 16] `UDT_Foo`
# CHECK: original type = 0x1004
# CHECK: 240 | S_UDT [size = 12] `Foo`
# CHECK: original type = 0x1004
# CHECK: 252 | S_BUILDINFO [size = 8] BuildId = `4106`
# CHECK-LABEL: Mod 0001 | `* Linker *`:
--- !COFF
header:
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ ]
sections:
sections:
- Name: .drectve
Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
Alignment: 1
@ -50,15 +50,15 @@ sections:
- Name: '.debug$S'
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
Alignment: 1
Subsections:
Subsections:
- !Symbols
Records:
Records:
- Kind: S_OBJNAME
ObjNameSym:
ObjNameSym:
Signature: 0
ObjectName: 'C:\src\llvm-project\build\symbol-types.obj'
- Kind: S_COMPILE3
Compile3Sym:
Compile3Sym:
Flags: [ SecurityChecks, HotPatch ]
Machine: X64
FrontendMajor: 19
@ -71,9 +71,9 @@ sections:
BackendQFE: 1
Version: 'Microsoft (R) Optimizing Compiler'
- !Symbols
Records:
Records:
- Kind: S_GPROC32_ID
ProcSym:
ProcSym:
CodeSize: 7
DbgStart: 0
DbgEnd: 6
@ -81,7 +81,7 @@ sections:
Flags: [ ]
DisplayName: main
- Kind: S_FRAMEPROC
FrameProcSym:
FrameProcSym:
TotalFrameBytes: 0
PaddingFrameBytes: 0
OffsetToPadding: 0
@ -90,15 +90,15 @@ sections:
SectionIdOfExceptionHandler: 0
Flags: [ AsynchronousExceptionHandling, OptimizedForSpeed ]
- Kind: S_PROC_ID_END
ScopeEndSym:
ScopeEndSym:
- !Lines
CodeSize: 7
Flags: [ ]
RelocOffset: 0
RelocSegment: 0
Blocks:
Blocks:
- FileName: 'c:\src\llvm-project\build\symbol-types.c'
Lines:
Lines:
- Offset: 0
LineStart: 4
IsStatement: true
@ -111,35 +111,35 @@ sections:
LineStart: 6
IsStatement: true
EndDelta: 0
Columns:
Columns:
- !Symbols
Records:
Records:
- Kind: S_GDATA32
DataSym:
DataSym:
Type: 4101
DisplayName: global_foo
- Kind: S_UDT
UDTSym:
UDTSym:
Type: 4101
UDTName: UDT_Foo
- Kind: S_UDT
UDTSym:
UDTSym:
Type: 4101
UDTName: Foo
- !FileChecksums
Checksums:
Checksums:
- FileName: 'c:\src\llvm-project\build\symbol-types.c'
Kind: MD5
Checksum: F833E1A4909FF6FEC5689A664F3BE725
- !StringTable
Strings:
Strings:
- 'c:\src\llvm-project\build\symbol-types.c'
- !Symbols
Records:
Records:
- Kind: S_BUILDINFO
BuildInfoSym:
BuildInfoSym:
BuildId: 4111
Relocations:
Relocations:
- VirtualAddress: 164
SymbolName: main
Type: IMAGE_REL_AMD64_SECREL
@ -161,24 +161,24 @@ sections:
- Name: '.debug$T'
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
Alignment: 1
Types:
Types:
- Kind: LF_ARGLIST
ArgList:
ArgList:
ArgIndices: [ 0 ]
- Kind: LF_PROCEDURE
Procedure:
Procedure:
ReturnType: 116
CallConv: NearC
Options: [ None ]
ParameterCount: 0
ArgumentList: 4096
- Kind: LF_FUNC_ID
FuncId:
FuncId:
ParentScope: 0
FunctionType: 4097
Name: main
- Kind: LF_STRUCTURE
Class:
Class:
MemberCount: 0
Options: [ None, ForwardReference, HasUniqueName ]
FieldList: 0
@ -188,15 +188,15 @@ sections:
VTableShape: 0
Size: 0
- Kind: LF_FIELDLIST
FieldList:
FieldList:
- Kind: LF_MEMBER
DataMember:
DataMember:
Attrs: 3
Type: 116
FieldOffset: 0
Name: x
- Kind: LF_STRUCTURE
Class:
Class:
MemberCount: 1
Options: [ None, HasUniqueName ]
FieldList: 4100
@ -206,43 +206,43 @@ sections:
VTableShape: 0
Size: 4
- Kind: LF_STRING_ID
StringId:
StringId:
Id: 0
String: 'c:\src\llvm-project\build\symbol-types.c'
- Kind: LF_UDT_SRC_LINE
UdtSourceLine:
UdtSourceLine:
UDT: 4101
SourceFile: 4102
LineNumber: 1
- Kind: LF_STRING_ID
StringId:
StringId:
Id: 0
String: 'C:\src\llvm-project\build'
- Kind: LF_STRING_ID
StringId:
StringId:
Id: 0
String: 'C:\PROGRA~2\MICROS~1.0\VC\Bin\amd64\cl.exe'
- Kind: LF_STRING_ID
StringId:
StringId:
Id: 0
String: '-c -Z7 -MT -IC:\PROGRA~2\MICROS~1.0\VC\include -IC:\PROGRA~2\MICROS~1.0\VC\atlmfc\include -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\ucrt -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\shared -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\um'
- Kind: LF_SUBSTR_LIST
StringList:
StringList:
StringIndices: [ 4106 ]
- Kind: LF_STRING_ID
StringId:
StringId:
Id: 4107
String: ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X'
- Kind: LF_STRING_ID
StringId:
StringId:
Id: 0
String: symbol-types.c
- Kind: LF_STRING_ID
StringId:
StringId:
Id: 0
String: 'C:\src\llvm-project\build\vc140.pdb'
- Kind: LF_BUILDINFO
BuildInfo:
BuildInfo:
ArgIndices: [ 4104, 4105, 4109, 4110, 4108 ]
- Name: .data
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
@ -252,11 +252,11 @@ sections:
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 16
SectionData: 8B0500000000C3
Relocations:
Relocations:
- VirtualAddress: 2
SymbolName: global_foo
Type: IMAGE_REL_AMD64_REL32
symbols:
symbols:
- Name: '@comp.id'
Value: 17063575
SectionNumber: -1
@ -275,7 +275,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 47
NumberOfRelocations: 0
NumberOfLinenumbers: 0
@ -287,7 +287,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 432
NumberOfRelocations: 6
NumberOfLinenumbers: 0
@ -299,7 +299,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 732
NumberOfRelocations: 0
NumberOfLinenumbers: 0
@ -311,7 +311,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 4
NumberOfRelocations: 0
NumberOfLinenumbers: 0
@ -329,7 +329,7 @@ symbols:
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
SectionDefinition:
Length: 7
NumberOfRelocations: 1
NumberOfLinenumbers: 0

View File

@ -25,7 +25,9 @@ public:
CVSymbolVisitor(SymbolVisitorCallbacks &Callbacks);
Error visitSymbolRecord(CVSymbol &Record);
Error visitSymbolRecord(CVSymbol &Record, uint32_t Offset);
Error visitSymbolStream(const CVSymbolArray &Symbols);
Error visitSymbolStream(const CVSymbolArray &Symbols, uint32_t InitialOffset);
private:
SymbolVisitorCallbacks &Callbacks;

View File

@ -51,6 +51,10 @@ public:
CodeViewContainer Container)
: Delegate(Delegate), Container(Container) {}
Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
return visitSymbolBegin(Record);
}
Error visitSymbolBegin(CVSymbol &Record) override {
assert(!Mapping && "Already in a symbol mapping!");
Mapping = llvm::make_unique<MappingInfo>(Record.content(), Container);

View File

@ -30,6 +30,14 @@ public:
return Error::success();
}
Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitSymbolBegin(Record, Offset))
return EC;
}
return Error::success();
}
Error visitSymbolBegin(CVSymbol &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitSymbolBegin(Record))

View File

@ -29,8 +29,10 @@ public:
/// Paired begin/end actions for all symbols. Receives all record data,
/// including the fixed-length record prefix. visitSymbolBegin() should
/// return
/// the type of the Symbol, or an error if it cannot be determined.
/// return the type of the Symbol, or an error if it cannot be determined.
virtual Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) {
return Error::success();
}
virtual Error visitSymbolBegin(CVSymbol &Record) { return Error::success(); }
virtual Error visitSymbolEnd(CVSymbol &Record) { return Error::success(); }

View File

@ -29,10 +29,8 @@ static Error visitKnownRecord(CVSymbol &Record,
return Error::success();
}
Error CVSymbolVisitor::visitSymbolRecord(CVSymbol &Record) {
if (auto EC = Callbacks.visitSymbolBegin(Record))
return EC;
static Error finishVisitation(CVSymbol &Record,
SymbolVisitorCallbacks &Callbacks) {
switch (Record.Type) {
default:
if (auto EC = Callbacks.visitUnknownSymbol(Record))
@ -55,6 +53,18 @@ Error CVSymbolVisitor::visitSymbolRecord(CVSymbol &Record) {
return Error::success();
}
Error CVSymbolVisitor::visitSymbolRecord(CVSymbol &Record) {
if (auto EC = Callbacks.visitSymbolBegin(Record))
return EC;
return finishVisitation(Record, Callbacks);
}
Error CVSymbolVisitor::visitSymbolRecord(CVSymbol &Record, uint32_t Offset) {
if (auto EC = Callbacks.visitSymbolBegin(Record, Offset))
return EC;
return finishVisitation(Record, Callbacks);
}
Error CVSymbolVisitor::visitSymbolStream(const CVSymbolArray &Symbols) {
for (auto I : Symbols) {
if (auto EC = visitSymbolRecord(I))
@ -62,3 +72,13 @@ Error CVSymbolVisitor::visitSymbolStream(const CVSymbolArray &Symbols) {
}
return Error::success();
}
Error CVSymbolVisitor::visitSymbolStream(const CVSymbolArray &Symbols,
uint32_t InitialOffset) {
for (auto I : Symbols) {
if (auto EC = visitSymbolRecord(I, InitialOffset))
return EC;
InitialOffset += I.length();
}
return Error::success();
}

View File

@ -474,64 +474,64 @@ ALL-NEXT: TI: 0x1000, Offset: 0
ALL: Hash Adjusters:
ALL: Public Symbols
ALL-NEXT: ============================================================
ALL-NEXT: - S_PUB32 [size = 36] `?__purecall@@3PAXA`
ALL-NEXT: 0 | S_PUB32 [size = 36] `?__purecall@@3PAXA`
ALL-NEXT: flags = none, addr = 0003:0000
ALL-NEXT: - S_PUB32 [size = 20] `_main`
ALL-NEXT: 36 | S_PUB32 [size = 20] `_main`
ALL-NEXT: flags = function, addr = 0001:0016
ALL-NEXT: - S_PROCREF [size = 20] `main`
ALL-NEXT: 56 | S_PROCREF [size = 20] `main`
ALL-NEXT: module = 1, sum name = 0, offset = 120
ALL-NEXT: - S_GDATA32 [size = 28] `__purecall`
ALL-NEXT: 76 | S_GDATA32 [size = 28] `__purecall`
ALL-NEXT: type = 0x0403 (void*), addr = 0003:0000
ALL: Symbols
ALL-NEXT: ============================================================
ALL-NEXT: Mod 0000 | `d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj`:
ALL-NEXT: - S_OBJNAME [size = 56] sig=0, `d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj`
ALL-NEXT: - S_COMPILE3 [size = 60]
ALL-NEXT: machine = intel pentium 3, Ver = Microsoft (R) Optimizing Compiler, language = c++
ALL-NEXT: frontend = 18.0.31101.0, backend = 18.0.31101.0
ALL-NEXT: flags = security checks
ALL-NEXT: - S_GPROC32 [size = 44] `main`
ALL-NEXT: parent = 0, addr = 0001:0016, code size = 10, end = 196
ALL-NEXT: debug start = 3, debug end = 8, flags = has fp
ALL-NEXT: - S_FRAMEPROC [size = 32]
ALL-NEXT: size = 0, padding size = 0, offset to padding = 0
ALL-NEXT: bytes of callee saved registers = 0, exception handler addr = 0000:0000
ALL-NEXT: flags = has async eh | opt speed
ALL-NEXT: - S_END [size = 4]
ALL-NEXT: - S_BUILDINFO [size = 8] BuildId = `4110`
ALL-NEXT: 4 | S_OBJNAME [size = 56] sig=0, `d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj`
ALL-NEXT: 60 | S_COMPILE3 [size = 60]
ALL-NEXT: machine = intel pentium 3, Ver = Microsoft (R) Optimizing Compiler, language = c++
ALL-NEXT: frontend = 18.0.31101.0, backend = 18.0.31101.0
ALL-NEXT: flags = security checks
ALL-NEXT: 120 | S_GPROC32 [size = 44] `main`
ALL-NEXT: parent = 0, end = 196, addr = 0001:0016, code size = 10
ALL-NEXT: debug start = 3, debug end = 8, flags = has fp
ALL-NEXT: 164 | S_FRAMEPROC [size = 32]
ALL-NEXT: size = 0, padding size = 0, offset to padding = 0
ALL-NEXT: bytes of callee saved registers = 0, exception handler addr = 0000:0000
ALL-NEXT: flags = has async eh | opt speed
ALL-NEXT: 196 | S_END [size = 4]
ALL-NEXT: 200 | S_BUILDINFO [size = 8] BuildId = `4110`
ALL-NEXT: Mod 0001 | `* Linker *`:
ALL-NEXT: - S_OBJNAME [size = 20] sig=0, `* Linker *`
ALL-NEXT: - S_COMPILE3 [size = 48]
ALL-NEXT: machine = intel 80386, Ver = Microsoft (R) LINK, language = link
ALL-NEXT: frontend = 0.0.0.0, backend = 12.0.31101.0
ALL-NEXT: flags = none
ALL-NEXT: - S_ENVBLOCK [size = 172]
ALL-NEXT: - cwd
ALL-NEXT: - d:\src\llvm\test\DebugInfo\PDB\Inputs
ALL-NEXT: - exe
ALL-NEXT: - C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\link.exe
ALL-NEXT: - pdb
ALL-NEXT: - d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.pdb
ALL-NEXT: - S_TRAMPOLINE [size = 20]
ALL-NEXT: type = tramp incremental, size = 5, source = 0001:0005, target = 0001:0005
ALL-NEXT: - S_SECTION [size = 28] `.text`
ALL-NEXT: length = 4122, alignment = 12, rva = 4096, section # = 1, characteristics = 1610612768
ALL-NEXT: - S_COFFGROUP [size = 28] `.text$mn`
ALL-NEXT: length = 4122, addr = 0001:0000, characteristics = 1610612768
ALL-NEXT: - S_SECTION [size = 28] `.rdata`
ALL-NEXT: length = 690, alignment = 12, rva = 12288, section # = 2, characteristics = 1073741888
ALL-NEXT: - S_COFFGROUP [size = 28] `.rdata`
ALL-NEXT: length = 323, addr = 0002:0000, characteristics = 1073741888
ALL-NEXT: - S_COFFGROUP [size = 28] `.edata`
ALL-NEXT: length = 0, addr = 0002:0323, characteristics = 1073741888
ALL-NEXT: - S_COFFGROUP [size = 32] `.rdata$debug`
ALL-NEXT: length = 366, addr = 0002:0324, characteristics = 1073741888
ALL-NEXT: - S_SECTION [size = 28] `.data`
ALL-NEXT: length = 4, alignment = 12, rva = 16384, section # = 3, characteristics = 3221225536
ALL-NEXT: - S_COFFGROUP [size = 24] `.bss`
ALL-NEXT: length = 4, addr = 0003:0000, characteristics = 3221225600
ALL-NEXT: - S_SECTION [size = 28] `.reloc`
ALL-NEXT: length = 8, alignment = 12, rva = 20480, section # = 4, characteristics = 1107296320
ALL-NEXT: 4 | S_OBJNAME [size = 20] sig=0, `* Linker *`
ALL-NEXT: 24 | S_COMPILE3 [size = 48]
ALL-NEXT: machine = intel 80386, Ver = Microsoft (R) LINK, language = link
ALL-NEXT: frontend = 0.0.0.0, backend = 12.0.31101.0
ALL-NEXT: flags = none
ALL-NEXT: 72 | S_ENVBLOCK [size = 172]
ALL-NEXT: - cwd
ALL-NEXT: - d:\src\llvm\test\DebugInfo\PDB\Inputs
ALL-NEXT: - exe
ALL-NEXT: - C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\link.exe
ALL-NEXT: - pdb
ALL-NEXT: - d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.pdb
ALL-NEXT: 244 | S_TRAMPOLINE [size = 20]
ALL-NEXT: type = tramp incremental, size = 5, source = 0001:0005, target = 0001:0005
ALL-NEXT: 264 | S_SECTION [size = 28] `.text`
ALL-NEXT: length = 4122, alignment = 12, rva = 4096, section # = 1, characteristics = 1610612768
ALL-NEXT: 292 | S_COFFGROUP [size = 28] `.text$mn`
ALL-NEXT: length = 4122, addr = 0001:0000, characteristics = 1610612768
ALL-NEXT: 320 | S_SECTION [size = 28] `.rdata`
ALL-NEXT: length = 690, alignment = 12, rva = 12288, section # = 2, characteristics = 1073741888
ALL-NEXT: 348 | S_COFFGROUP [size = 28] `.rdata`
ALL-NEXT: length = 323, addr = 0002:0000, characteristics = 1073741888
ALL-NEXT: 376 | S_COFFGROUP [size = 28] `.edata`
ALL-NEXT: length = 0, addr = 0002:0323, characteristics = 1073741888
ALL-NEXT: 404 | S_COFFGROUP [size = 32] `.rdata$debug`
ALL-NEXT: length = 366, addr = 0002:0324, characteristics = 1073741888
ALL-NEXT: 436 | S_SECTION [size = 28] `.data`
ALL-NEXT: length = 4, alignment = 12, rva = 16384, section # = 3, characteristics = 3221225536
ALL-NEXT: 464 | S_COFFGROUP [size = 24] `.bss`
ALL-NEXT: length = 4, addr = 0003:0000, characteristics = 3221225600
ALL-NEXT: 488 | S_SECTION [size = 28] `.reloc`
ALL-NEXT: length = 8, alignment = 12, rva = 20480, section # = 4, characteristics = 1107296320
ALL: Section Contributions
ALL-NEXT: ============================================================
ALL-NEXT: SC | mod = 1, 0001:0000, size = 10, data crc = 0, reloc crc = 0

View File

@ -834,7 +834,8 @@ Error DumpOutputStyle::dumpModuleSyms() {
Pipeline.addCallbackToPipeline(Deserializer);
Pipeline.addCallbackToPipeline(Dumper);
CVSymbolVisitor Visitor(Pipeline);
if (auto EC = Visitor.visitSymbolStream(ModS.getSymbolArray())) {
auto SS = ModS.getSymbolsSubstream();
if (auto EC = Visitor.visitSymbolStream(ModS.getSymbolArray(), SS.Offset)) {
P.formatLine("Error while processing symbol records. {0}",
toString(std::move(EC)));
continue;
@ -863,13 +864,14 @@ Error DumpOutputStyle::dumpPublics() {
Pipeline.addCallbackToPipeline(Deserializer);
Pipeline.addCallbackToPipeline(Dumper);
CVSymbolVisitor Visitor(Pipeline);
auto ExpectedSymbols = Publics.getSymbolArray();
if (!ExpectedSymbols) {
P.formatLine("Could not read public symbol record stream");
return Error::success();
}
if (auto EC = Visitor.visitSymbolStream(*ExpectedSymbols))
if (auto EC = Visitor.visitSymbolStream(*ExpectedSymbols, 0))
P.formatLine("Error while processing public symbol records. {0}",
toString(std::move(EC)));

View File

@ -367,11 +367,17 @@ static std::string formatGaps(uint32_t IndentLevel,
}
Error MinimalSymbolDumper::visitSymbolBegin(codeview::CVSymbol &Record) {
return visitSymbolBegin(Record, 0);
}
Error MinimalSymbolDumper::visitSymbolBegin(codeview::CVSymbol &Record,
uint32_t Offset) {
// 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} [size = {1}]", getSymbolKindName(Record.Type),
Record.length());
P.formatLine("{0} | {1} [size = {2}]",
fmt_align(Offset, AlignStyle::Right, 6),
getSymbolKindName(Record.Type), Record.length());
P.Indent();
return Error::success();
}
@ -394,28 +400,31 @@ std::string MinimalSymbolDumper::typeIndex(TypeIndex TI) const {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, BlockSym &Block) {
P.format(" `{0}`", Block.Name);
AutoIndent Indent(P);
P.formatLine("parent = {0}, addr = {1}", Block.Parent,
AutoIndent Indent(P, 7);
;
P.formatLine("parent = {0}, end = {1}", Block.Parent, Block.End);
P.formatLine("code size = {0}, addr = {1}", Block.CodeSize,
formatSegmentOffset(Block.Segment, Block.CodeOffset));
P.formatLine("code size = {0}, end = {1}", Block.CodeSize, Block.End);
return Error::success();
}
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, Thunk32Sym &Thunk) {
P.format(" `{0}`", Thunk.Name);
AutoIndent Indent(P);
P.formatLine("parent = {0}, addr = {1}", Thunk.Parent,
formatSegmentOffset(Thunk.Segment, Thunk.Offset));
P.formatLine("kind = {0}, size = {1}, end = {2}, next = {3}",
formatThunkOrdinal(Thunk.Thunk), Thunk.Length, Thunk.End,
AutoIndent Indent(P, 7);
;
P.formatLine("parent = {0}, end = {1}, next = {2}", Thunk.Parent, Thunk.End,
Thunk.Next);
P.formatLine("kind = {0}, size = {1}, addr = {2}",
formatThunkOrdinal(Thunk.Thunk), Thunk.Length,
formatSegmentOffset(Thunk.Segment, Thunk.Offset));
return Error::success();
}
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
TrampolineSym &Tramp) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, size = {1}, source = {2}, target = {3}",
formatTrampolineType(Tramp.Type), Tramp.Size,
formatSegmentOffset(Tramp.ThunkSection, Tramp.ThunkOffset),
@ -427,7 +436,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
SectionSym &Section) {
P.format(" `{0}`", Section.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("length = {0}, alignment = {1}, rva = {2}, section # = {3}, "
"characteristics = {4}",
Section.Length, Section.Alignment, Section.Rva,
@ -437,7 +447,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, CoffGroupSym &CG) {
P.format(" `{0}`", CG.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("length = {0}, addr = {1}, characteristics = {2}", CG.Size,
formatSegmentOffset(CG.Segment, CG.Offset), CG.Characteristics);
return Error::success();
@ -446,7 +457,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, CoffGroupSym &CG) {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
BPRelativeSym &BPRel) {
P.format(" `{0}`", BPRel.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, offset = {1}", typeIndex(BPRel.Type), BPRel.Offset);
return Error::success();
}
@ -459,7 +471,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
CallSiteInfoSym &CSI) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, addr = {1}", typeIndex(CSI.Type),
formatSegmentOffset(CSI.Segment, CSI.CodeOffset));
return Error::success();
@ -467,6 +480,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
EnvBlockSym &EnvBlock) {
AutoIndent Indent(P, 7);
;
for (const auto &Entry : EnvBlock.Fields) {
P.formatLine("- {0}", Entry);
}
@ -475,7 +490,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FileStaticSym &FS) {
P.format(" `{0}`", FS.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, file name offset = {1}, flags = {2}",
typeIndex(FS.Index), FS.ModFilenameOffset,
formatLocalSymFlags(P.getIndentLevel() + 9, FS.Flags));
@ -484,7 +500,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FileStaticSym &FS) {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ExportSym &Export) {
P.format(" `{0}`", Export.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("ordinal = {0}, flags = {1}", Export.Ordinal,
formatExportFlags(P.getIndentLevel() + 9, Export.Flags));
return Error::success();
@ -492,7 +509,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ExportSym &Export) {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Compile2Sym &Compile2) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
SourceLanguage Lang = static_cast<SourceLanguage>(
Compile2.Flags & CompileSym2Flags::SourceLanguageMask);
P.formatLine("machine = {0}, ver = {1}, language = {2}",
@ -512,7 +530,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Compile3Sym &Compile3) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
SourceLanguage Lang = static_cast<SourceLanguage>(
Compile3.Flags & CompileSym3Flags::SourceLanguageMask);
P.formatLine("machine = {0}, Ver = {1}, language = {2}",
@ -531,7 +550,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
ConstantSym &Constant) {
P.format(" `{0}`", Constant.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, value = {1}", typeIndex(Constant.Type),
Constant.Value.toString(10));
return Error::success();
@ -539,7 +559,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, DataSym &Data) {
P.format(" `{0}`", Data.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, addr = {1}", typeIndex(Data.Type),
formatSegmentOffset(Data.Segment, Data.DataOffset));
return Error::success();
@ -553,7 +574,8 @@ Error MinimalSymbolDumper::visitKnownRecord(
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
DefRangeFramePointerRelSym &Def) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("offset = {0}, range = {1}", Def.Offset, formatRange(Def.Range));
P.formatLine("gaps = {2}", Def.Offset,
formatGaps(P.getIndentLevel() + 9, Def.Gaps));
@ -562,7 +584,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
DefRangeRegisterRelSym &Def) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("register = {0}, base ptr = {1}, offset in parent = {2}, has "
"spilled udt = {3}",
uint16_t(Def.Hdr.Register), int32_t(Def.Hdr.BasePointerOffset),
@ -574,7 +597,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(
CVSymbol &CVR, DefRangeRegisterSym &DefRangeRegister) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("register = {0}, may have no name = {1}, range start = "
"{2}, length = {3}",
uint16_t(DefRangeRegister.Hdr.Register),
@ -589,7 +613,8 @@ Error MinimalSymbolDumper::visitKnownRecord(
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
DefRangeSubfieldRegisterSym &Def) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
bool NoName = !!(Def.Hdr.MayHaveNoName == 0);
P.formatLine("register = {0}, may have no name = {1}, offset in parent = {2}",
uint16_t(Def.Hdr.Register), NoName,
@ -601,7 +626,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
DefRangeSubfieldSym &Def) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("program = {0}, offset in parent = {1}, range = {2}",
Def.Program, Def.OffsetInParent, formatRange(Def.Range));
P.formatLine("gaps = {0}", formatGaps(P.getIndentLevel() + 9, Def.Gaps));
@ -609,7 +635,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
}
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, DefRangeSym &Def) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("program = {0}, range = {1}", Def.Program,
formatRange(Def.Range));
P.formatLine("gaps = {0}", formatGaps(P.getIndentLevel() + 9, Def.Gaps));
@ -617,7 +644,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, DefRangeSym &Def) {
}
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FrameCookieSym &FC) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("code offset = {0}, Register = {1}, kind = {2}, flags = {3}",
FC.CodeOffset, FC.Register, formatCookieKind(FC.CookieKind),
FC.Flags);
@ -625,7 +653,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FrameCookieSym &FC) {
}
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FrameProcSym &FP) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("size = {0}, padding size = {1}, offset to padding = {2}",
FP.TotalFrameBytes, FP.PaddingFrameBytes, FP.OffsetToPadding);
P.formatLine("bytes of callee saved registers = {0}, exception handler addr "
@ -640,7 +669,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, FrameProcSym &FP) {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
HeapAllocationSiteSym &HAS) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, addr = {1} call size = {2}", typeIndex(HAS.Type),
formatSegmentOffset(HAS.Segment, HAS.CodeOffset),
HAS.CallInstructionSize);
@ -648,7 +678,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
}
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, InlineSiteSym &IS) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
auto Bytes = makeArrayRef(IS.AnnotationData);
StringRef Annotations(reinterpret_cast<const char *>(Bytes.begin()),
Bytes.size());
@ -662,7 +693,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, InlineSiteSym &IS) {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
RegisterSym &Register) {
P.format(" `{0}`", Register.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("register = {0}, type = {1}",
formatRegisterId(Register.Register), typeIndex(Register.Index));
return Error::success();
@ -671,7 +703,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
PublicSym32 &Public) {
P.format(" `{0}`", Public.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("flags = {0}, addr = {1}",
formatPublicSymFlags(P.getIndentLevel() + 9, Public.Flags),
formatSegmentOffset(Public.Segment, Public.Offset));
@ -680,7 +713,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ProcRefSym &PR) {
P.format(" `{0}`", PR.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("module = {0}, sum name = {1}, offset = {2}", PR.Module,
PR.SumName, PR.SymOffset);
return Error::success();
@ -689,7 +723,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ProcRefSym &PR) {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, LabelSym &Label) {
P.format(" `{0}` (addr = {1})", Label.Name,
formatSegmentOffset(Label.Segment, Label.CodeOffset));
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("flags = {0}",
formatProcSymFlags(P.getIndentLevel() + 9, Label.Flags));
return Error::success();
@ -697,7 +732,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, LabelSym &Label) {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, LocalSym &Local) {
P.format(" `{0}`", Local.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
std::string FlagStr =
formatLocalSymFlags(P.getIndentLevel() + 9, Local.Flags);
@ -713,10 +749,12 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, ProcSym &Proc) {
P.format(" `{0}`", Proc.Name);
AutoIndent Indent(P);
P.formatLine("parent = {0}, addr = {1}, code size = {2}, end = {3}",
Proc.Parent, formatSegmentOffset(Proc.Segment, Proc.CodeOffset),
Proc.CodeSize, Proc.End);
AutoIndent Indent(P, 7);
;
P.formatLine("parent = {0}, end = {1}, addr = {2}, code size = {3}",
Proc.Parent, Proc.End,
formatSegmentOffset(Proc.Segment, Proc.CodeOffset),
Proc.CodeSize);
P.formatLine("debug start = {0}, debug end = {1}, flags = {2}", Proc.DbgStart,
Proc.DbgEnd,
formatProcSymFlags(P.getIndentLevel() + 9, Proc.Flags));
@ -729,7 +767,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
}
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, CallerSym &Caller) {
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
for (const auto &I : Caller.Indices) {
P.formatLine("callee: {0}", typeIndex(I));
}
@ -739,7 +778,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, CallerSym &Caller) {
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
RegRelativeSym &RegRel) {
P.format(" `{0}`", RegRel.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, register = {1}, offset = {2}",
typeIndex(RegRel.Type), formatRegisterId(RegRel.Register),
RegRel.Offset);
@ -749,7 +789,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
ThreadLocalDataSym &Data) {
P.format(" `{0}`", Data.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("type = {0}, addr = {1}", typeIndex(Data.Type),
formatSegmentOffset(Data.Segment, Data.DataOffset));
return Error::success();
@ -757,7 +798,8 @@ Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR, UDTSym &UDT) {
P.format(" `{0}`", UDT.Name);
AutoIndent Indent(P);
AutoIndent Indent(P, 7);
;
P.formatLine("original type = {0}", UDT.Type);
return Error::success();
}

View File

@ -27,6 +27,7 @@ public:
: P(P), Types(Types) {}
Error visitSymbolBegin(codeview::CVSymbol &Record) override;
Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t Offset) override;
Error visitSymbolEnd(codeview::CVSymbol &Record) override;
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \