本文整理汇总了C++中CVSymbol类的典型用法代码示例。如果您正苦于以下问题:C++ CVSymbol类的具体用法?C++ CVSymbol怎么用?C++ CVSymbol使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CVSymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cantFail
SymIndexId SymbolCache::getOrCreateGlobalSymbolByOffset(uint32_t Offset) {
auto Iter = GlobalOffsetToSymbolId.find(Offset);
if (Iter != GlobalOffsetToSymbolId.end())
return Iter->second;
SymbolStream &SS = cantFail(Session.getPDBFile().getPDBSymbolStream());
CVSymbol CVS = SS.readRecord(Offset);
SymIndexId Id = 0;
switch (CVS.kind()) {
case SymbolKind::S_UDT: {
UDTSym US = cantFail(SymbolDeserializer::deserializeAs<UDTSym>(CVS));
Id = createSymbol<NativeTypeTypedef>(std::move(US));
break;
}
default:
Id = createSymbolPlaceholder();
break;
}
if (Id != 0) {
assert(GlobalOffsetToSymbolId.count(Offset) == 0);
GlobalOffsetToSymbolId[Offset] = Id;
}
return Id;
}
示例2: addSymbol
void DbiModuleDescriptorBuilder::addSymbol(CVSymbol Symbol) {
Symbols.push_back(Symbol);
// Symbols written to a PDB file are required to be 4 byte aligned. The same
// is not true of object files.
assert(Symbol.length() % alignOf(CodeViewContainer::Pdb) == 0 &&
"Invalid Symbol alignment!");
SymbolByteSize += Symbol.length();
}
示例3: switch
bool lldb_private::npdb::SymbolHasAddress(const CVSymbol &sym) {
switch (sym.kind()) {
case S_GPROC32:
case S_LPROC32:
case S_GPROC32_ID:
case S_LPROC32_ID:
case S_LPROC32_DPC:
case S_LPROC32_DPC_ID:
case S_THUNK32:
case S_TRAMPOLINE:
case S_COFFGROUP:
case S_BLOCK32:
case S_LABEL32:
case S_CALLSITEINFO:
case S_HEAPALLOCSITE:
case S_LDATA32:
case S_GDATA32:
case S_LMANDATA:
case S_GMANDATA:
case S_LTHREAD32:
case S_GTHREAD32:
return true;
default:
return false;
}
}
示例4: visitSymbolEnd
Error MinimalSymbolDumper::visitSymbolEnd(CVSymbol &Record) {
if (RecordBytes) {
AutoIndent Indent(P, 7);
P.formatBinary("bytes", Record.content(), 0);
}
P.Unindent();
return Error::success();
}
示例5: visitSymbolEnd
Error CVSymbolDumperImpl::visitSymbolEnd(CVSymbol &CVR) {
if (PrintRecordBytes && ObjDelegate)
ObjDelegate->printBinaryBlockWithRelocs("SymData", CVR.content());
W.unindent();
W.startLine() << "}\n";
return Error::success();
}
示例6: addSymbol
void addSymbol(const CVSymbol &Symbol) {
if (Symbol.kind() == S_UDT) {
auto Iter = UdtHashes.insert(Symbol);
if (!Iter.second)
return;
}
Records.push_back(Symbol);
}
示例7: reg
VariableInfo lldb_private::npdb::GetVariableNameInfo(CVSymbol sym) {
VariableInfo result;
if (sym.kind() == S_REGREL32) {
RegRelativeSym reg(SymbolRecordKind::RegRelativeSym);
cantFail(SymbolDeserializer::deserializeAs<RegRelativeSym>(sym, reg));
result.type = reg.Type;
result.name = reg.Name;
return result;
}
if (sym.kind() == S_REGISTER) {
RegisterSym reg(SymbolRecordKind::RegisterSym);
cantFail(SymbolDeserializer::deserializeAs<RegisterSym>(sym, reg));
result.type = reg.Index;
result.name = reg.Name;
return result;
}
if (sym.kind() == S_LOCAL) {
LocalSym local(SymbolRecordKind::LocalSym);
cantFail(SymbolDeserializer::deserializeAs<LocalSym>(sym, local));
result.type = local.Type;
result.name = local.Name;
return result;
}
if (sym.kind() == S_GDATA32 || sym.kind() == S_LDATA32) {
DataSym data(SymbolRecordKind::DataSym);
cantFail(SymbolDeserializer::deserializeAs<DataSym>(sym, data));
result.type = data.Type;
result.name = data.Name;
return result;
}
if (sym.kind() == S_GTHREAD32 || sym.kind() == S_LTHREAD32) {
ThreadLocalDataSym data(SymbolRecordKind::ThreadLocalDataSym);
cantFail(SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym, data));
result.type = data.Type;
result.name = data.Name;
return result;
}
if (sym.kind() == S_CONSTANT) {
ConstantSym constant(SymbolRecordKind::ConstantSym);
cantFail(SymbolDeserializer::deserializeAs<ConstantSym>(sym, constant));
result.type = constant.Type;
result.name = constant.Name;
return result;
}
lldbassert(false && "Invalid variable record kind!");
return {};
}
示例8: fromCodeViewSymbolImpl
static inline Expected<CodeViewYAML::SymbolRecord>
fromCodeViewSymbolImpl(CVSymbol Symbol) {
CodeViewYAML::SymbolRecord Result;
auto Impl = std::make_shared<SymbolType>(Symbol.kind());
if (auto EC = Impl->fromCodeViewSymbol(Symbol))
return std::move(EC);
Result.Symbol = Impl;
return Result;
}
示例9: getSymbolNameOffset
static int getSymbolNameOffset(CVSymbol Sym) {
switch (Sym.kind()) {
// See ProcSym
case SymbolKind::S_GPROC32:
case SymbolKind::S_LPROC32:
case SymbolKind::S_GPROC32_ID:
case SymbolKind::S_LPROC32_ID:
case SymbolKind::S_LPROC32_DPC:
case SymbolKind::S_LPROC32_DPC_ID:
return 35;
// See Thunk32Sym
case SymbolKind::S_THUNK32:
return 21;
// See SectionSym
case SymbolKind::S_SECTION:
return 16;
// See CoffGroupSym
case SymbolKind::S_COFFGROUP:
return 14;
// See PublicSym32, FileStaticSym, RegRelativeSym, DataSym, ThreadLocalDataSym
case SymbolKind::S_PUB32:
case SymbolKind::S_FILESTATIC:
case SymbolKind::S_REGREL32:
case SymbolKind::S_GDATA32:
case SymbolKind::S_LDATA32:
case SymbolKind::S_LMANDATA:
case SymbolKind::S_GMANDATA:
case SymbolKind::S_LTHREAD32:
case SymbolKind::S_GTHREAD32:
case SymbolKind::S_PROCREF:
case SymbolKind::S_LPROCREF:
return 10;
// See RegisterSym and LocalSym
case SymbolKind::S_REGISTER:
case SymbolKind::S_LOCAL:
return 6;
// See BlockSym
case SymbolKind::S_BLOCK32:
return 18;
// See LabelSym
case SymbolKind::S_LABEL32:
return 7;
// See ObjNameSym, ExportSym, and UDTSym
case SymbolKind::S_OBJNAME:
case SymbolKind::S_EXPORT:
case SymbolKind::S_UDT:
return 4;
// See BPRelativeSym
case SymbolKind::S_BPREL32:
return 8;
default:
return -1;
}
}
示例10: Reader
StringRef llvm::codeview::getSymbolName(CVSymbol Sym) {
if (Sym.kind() == SymbolKind::S_CONSTANT) {
// S_CONSTANT is preceded by an APSInt, which has a variable length. So we
// have to do a full deserialization.
BinaryStreamReader Reader(Sym.content(), llvm::support::little);
// The container doesn't matter for single records.
SymbolRecordMapping Mapping(Reader, CodeViewContainer::ObjectFile);
ConstantSym Const(SymbolKind::S_CONSTANT);
cantFail(Mapping.visitSymbolBegin(Sym));
cantFail(Mapping.visitKnownRecord(Sym, Const));
cantFail(Mapping.visitSymbolEnd(Sym));
return Const.Name;
}
int Offset = getSymbolNameOffset(Sym);
if (Offset == -1)
return StringRef();
StringRef StringData = toStringRef(Sym.content()).drop_front(Offset);
return StringData.split('\0').first;
}
示例11: switch
Expected<CodeViewYAML::SymbolRecord>
CodeViewYAML::SymbolRecord::fromCodeViewSymbol(CVSymbol Symbol) {
#define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \
case EnumName: \
return fromCodeViewSymbolImpl<SymbolRecordImpl<ClassName>>(Symbol);
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
SYMBOL_RECORD(EnumName, EnumVal, ClassName)
switch (Symbol.kind()) {
#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
default:
return fromCodeViewSymbolImpl<UnknownSymbolRecord>(Symbol);
}
return make_error<CodeViewError>(cv_error_code::corrupt_record);
}
示例12: copySymbolForPdb
/// Copy the symbol record. In a PDB, symbol records must be 4 byte aligned.
/// The object file may not be aligned.
static MutableArrayRef<uint8_t> copySymbolForPdb(const CVSymbol &Sym,
BumpPtrAllocator &Alloc) {
size_t Size = alignTo(Sym.length(), alignOf(CodeViewContainer::Pdb));
assert(Size >= 4 && "record too short");
assert(Size <= MaxRecordLength && "record too long");
void *Mem = Alloc.Allocate(Size, 4);
// Copy the symbol record and zero out any padding bytes.
MutableArrayRef<uint8_t> NewData(reinterpret_cast<uint8_t *>(Mem), Size);
memcpy(NewData.data(), Sym.data().data(), Sym.length());
memset(NewData.data() + Sym.length(), 0, Size - Sym.length());
// Update the record prefix length. It should point to the beginning of the
// next record. MSVC does some canonicalization of the record kind, so we do
// that as well.
auto *Prefix = reinterpret_cast<RecordPrefix *>(Mem);
Prefix->RecordKind = canonicalizeSymbolKind(Sym.kind());
Prefix->RecordLen = Size - 2;
return NewData;
}
示例13:
bool llvm::codeview::discoverTypeIndices(const CVSymbol &Sym,
SmallVectorImpl<TiReference> &Refs) {
SymbolKind K = Sym.kind();
return ::discoverTypeIndices(Sym.content(), K, Refs);
}
示例14: visitUnknownSymbol
Error CVSymbolDumperImpl::visitUnknownSymbol(CVSymbol &CVR) {
W.printNumber("Length", CVR.length());
return Error::success();
}
示例15: visitKnownRecord
Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR, CallerSym &Caller) {
ListScope S(W, CVR.kind() == S_CALLEES ? "Callees" : "Callers");
for (auto FuncID : Caller.Indices)
printTypeIndex("FuncID", FuncID);
return Error::success();
}