From 2f7efbc9ce62d84a215529133f1c384c25a7858e Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 23 Oct 2018 16:37:53 +0000 Subject: [NativePDB] Add basic support for tag types to the native pdb plugin. This adds support to LLDB for named types (class, struct, union, and enum). This is true cross platform support, and hits the PDB file directly without a dependency on Windows. Tests are added which compile a program with certain interesting types and then use load the target in LLDB and use "type lookup -- " to dump the layout of the type in LLDB without a running process. Currently only fields are parsed -- we do not parse methods. Also we don't deal with bitfields or virtual bases correctly. Those will make good followups. Differential Revision: https://reviews.llvm.org/D53511 llvm-svn: 345047 --- lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp') diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp index c9bd9a48568..cda9508c07a 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp @@ -17,6 +17,7 @@ #include "llvm/DebugInfo/PDB/Native/PDBFile.h" #include "llvm/DebugInfo/PDB/Native/PublicsStream.h" #include "llvm/DebugInfo/PDB/Native/SymbolStream.h" +#include "llvm/DebugInfo/PDB/Native/TpiStream.h" #include "llvm/Object/COFF.h" #include "llvm/Support/Error.h" @@ -51,6 +52,8 @@ PdbIndex::create(std::unique_ptr file) { ASSIGN_PTR_OR_RETURN(result->m_globals, file->getPDBGlobalsStream()); ASSIGN_PTR_OR_RETURN(result->m_symrecords, file->getPDBSymbolStream()); + result->m_tpi->buildHashMap(); + result->m_file = std::move(file); return std::move(result); @@ -101,6 +104,9 @@ void PdbIndex::ParseSectionContribs() { : m_ctx(ctx), m_imap(imap) {} void visit(const SectionContrib &C) override { + if (C.Size == 0) + return; + uint64_t va = m_ctx.MakeVirtualAddress(C.ISect, C.Off); uint64_t end = va + C.Size; // IntervalMap's start and end represent a closed range, not a half-open -- cgit v1.2.3