LLVM CodeView library
authorDave Bartolomeo <dbartol@microsoft.com>
Thu, 24 Dec 2015 18:12:38 +0000 (18:12 +0000)
committerDave Bartolomeo <dbartol@microsoft.com>
Thu, 24 Dec 2015 18:12:38 +0000 (18:12 +0000)
commit994a189088a783823631917910b805b6127efd07
tree32fd4402847f66a6108c9fc9f9f88260827e6584
parent20bc430a1853036074fedccc99bce9d852833fe8
LLVM CodeView library

Summary: This diff is the initial implementation of the LLVM CodeView library. There is much more work to be done, namely a CodeView dumper and tests. This patch should help others make progress on the LLVM->CodeView debug info emission while I continue with the implementation of the dumper and tests.

This library implements support for emitting debug info in the CodeView format. This phase of the implementation only includes support for CodeView type records. Clients that need to emit type records will use a class derived from TypeTableBuilder. TypeTableBuilder provides member functions for writing each kind of type record; each of these functions eventually calls the writeRecord virtual function to emit the actual bits of the record. Derived classes override writeRecord to implement the folding of duplicate records and the actual emission to the appropriate destination. LLVMCodeView provides MemoryTypeTableBuilder, which creates the table in memory. In the future, other classes derived from TypeTableBuilder will write to other destinations, such as the type stream in a PDB.

The rest of the types in LLVMCodeView define the actual CodeView type records and all of the supporting enums and other types used in the type records. The TypeIndex class is of particular interest, because it is used by clients as a handle to a type in the type table.

The library provides a relatively low-level interface based on the actual on-disk format of CodeView. For example, type records refer to other type records by TypeIndex, rather than by an actual pointer to the referent record. This allows clients to emit type records one at a time, rather than having to keep the entire transitive closure of type records in memory until everything has been emitted. At some point, having a higher-level interface layered on top of this one may be useful for debuggers and other tools that want a more holistic view of the debug info. The lower-level interface should be sufficient for compilers and linkers to do the debug info manipulation that they need to do efficiently.

Reviewers: rnk, majnemer

Subscribers: silvas, rnk, jevinskie, llvm-commits

Differential Revision: http://reviews.llvm.org/D14961

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256385 91177308-0d34-0410-b5e6-96231b3b80d8
25 files changed:
include/llvm/DebugInfo/CodeView/CodeView.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/CodeViewOStream.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/FieldListRecordBuilder.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/FunctionId.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/Line.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/ListRecordBuilder.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/MethodListRecordBuilder.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/TypeIndex.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/TypeRecord.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/TypeRecordBuilder.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/TypeSymbolEmitter.h [new file with mode: 0644]
include/llvm/DebugInfo/CodeView/TypeTableBuilder.h [new file with mode: 0644]
lib/DebugInfo/CMakeLists.txt
lib/DebugInfo/CodeView/CMakeLists.txt [new file with mode: 0644]
lib/DebugInfo/CodeView/FieldListRecordBuilder.cpp [new file with mode: 0644]
lib/DebugInfo/CodeView/LLVMBuild.txt [new file with mode: 0644]
lib/DebugInfo/CodeView/Line.cpp [new file with mode: 0644]
lib/DebugInfo/CodeView/ListRecordBuilder.cpp [new file with mode: 0644]
lib/DebugInfo/CodeView/MemoryTypeTableBuilder.cpp [new file with mode: 0644]
lib/DebugInfo/CodeView/MethodListRecordBuilder.cpp [new file with mode: 0644]
lib/DebugInfo/CodeView/TypeRecordBuilder.cpp [new file with mode: 0644]
lib/DebugInfo/CodeView/TypeTableBuilder.cpp [new file with mode: 0644]
lib/DebugInfo/LLVMBuild.txt
lib/DebugInfo/Makefile