Previous patches added support for dumping global variables of primitive types, so we now do the same for class types. For the most part, everything just worked, there was only one minor bug needing fixed, which was that for variables of modified types (e.g. const, volatile, etc) we can't resolve the forward decl in CreateAndCacheType because the PdbSymUid must point to the LF_MODIFIER which must point to the forward decl. So when it comes time to call CompleteType, an assert was firing because we expected to get a class, struct, union, or enum, but we were getting an LF_MODIFIER instead. The other issue is that one the newly added tests is for an array member, which was not yet supported, so we add support for that now in this patch. There's probably room for other interesting layout test cases here, but this at least should test the basics. Differential Revision: https://reviews.llvm.org/D53822 llvm-svn: 345629
71 lines
2.0 KiB
C++
71 lines
2.0 KiB
C++
//===-- PdbUtil.h -----------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLDB_PLUGINS_SYMBOLFILENATIVEPDB_PDBUTIL_H
|
|
#define LLDB_PLUGINS_SYMBOLFILENATIVEPDB_PDBUTIL_H
|
|
|
|
#include "lldb/lldb-enumerations.h"
|
|
|
|
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
|
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
|
|
|
#include <tuple>
|
|
#include <utility>
|
|
|
|
namespace lldb_private {
|
|
namespace npdb {
|
|
|
|
struct SegmentOffset {
|
|
SegmentOffset() = default;
|
|
SegmentOffset(uint16_t s, uint32_t o) : segment(s), offset(o) {}
|
|
uint16_t segment = 0;
|
|
uint32_t offset = 0;
|
|
};
|
|
|
|
struct SegmentOffsetLength {
|
|
SegmentOffsetLength() = default;
|
|
SegmentOffsetLength(uint16_t s, uint32_t o, uint32_t l)
|
|
: so(s, o), length(l) {}
|
|
SegmentOffset so;
|
|
uint32_t length = 0;
|
|
};
|
|
|
|
llvm::pdb::PDB_SymType CVSymToPDBSym(llvm::codeview::SymbolKind kind);
|
|
llvm::pdb::PDB_SymType CVTypeToPDBType(llvm::codeview::TypeLeafKind kind);
|
|
|
|
bool SymbolHasAddress(const llvm::codeview::CVSymbol &sym);
|
|
bool SymbolIsCode(const llvm::codeview::CVSymbol &sym);
|
|
|
|
SegmentOffset GetSegmentAndOffset(const llvm::codeview::CVSymbol &sym);
|
|
SegmentOffsetLength
|
|
GetSegmentOffsetAndLength(const llvm::codeview::CVSymbol &sym);
|
|
|
|
template <typename RecordT> bool IsValidRecord(const RecordT &sym) {
|
|
return true;
|
|
}
|
|
|
|
inline bool IsValidRecord(const llvm::codeview::ProcRefSym &sym) {
|
|
// S_PROCREF symbols have 1-based module indices.
|
|
return sym.Module > 0;
|
|
}
|
|
|
|
bool IsForwardRefUdt(llvm::codeview::CVType cvt);
|
|
|
|
lldb::AccessType TranslateMemberAccess(llvm::codeview::MemberAccess access);
|
|
llvm::codeview::TypeIndex GetFieldListIndex(llvm::codeview::CVType cvt);
|
|
llvm::codeview::TypeIndex
|
|
LookThroughModifierRecord(llvm::codeview::CVType modifier);
|
|
|
|
llvm::StringRef DropNameScope(llvm::StringRef name);
|
|
|
|
} // namespace npdb
|
|
} // namespace lldb_private
|
|
|
|
#endif
|