To resolve symbol context at a particular address, we need to determine the compiland for the address. We are able to determine the parent compiland of PDBSymbolFunc, PDBSymbolTypeUDT, PDBSymbolTypeEnum symbols indirectly through line information. However no such information is availabile for PDBSymbolData, i.e. variables. The Section Contribution table from PDBs has information about each compiland's contribution to sections by address. For example, a piece of a contribution looks like, VA RelativeVA Sect No. Offset Length Compiland 14000087B0 000087B0 0001 000077B0 000000BB exe_main.obj So given an address, it's possible to determine its compiland with this information. llvm-svn: 328178
55 lines
1.8 KiB
C++
55 lines
1.8 KiB
C++
//==- DIAEnumSectionContribs.cpp ---------------------------------*- C++ -*-==//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h"
|
|
#include "llvm/DebugInfo/PDB/DIA/DIASectionContrib.h"
|
|
#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::pdb;
|
|
|
|
DIAEnumSectionContribs::DIAEnumSectionContribs(
|
|
const DIASession &PDBSession,
|
|
CComPtr<IDiaEnumSectionContribs> DiaEnumerator)
|
|
: Session(PDBSession), Enumerator(DiaEnumerator) {}
|
|
|
|
uint32_t DIAEnumSectionContribs::getChildCount() const {
|
|
LONG Count = 0;
|
|
return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;
|
|
}
|
|
|
|
std::unique_ptr<IPDBSectionContrib>
|
|
DIAEnumSectionContribs::getChildAtIndex(uint32_t Index) const {
|
|
CComPtr<IDiaSectionContrib> Item;
|
|
if (S_OK != Enumerator->Item(Index, &Item))
|
|
return nullptr;
|
|
|
|
return std::unique_ptr<IPDBSectionContrib>(
|
|
new DIASectionContrib(Session, Item));
|
|
}
|
|
|
|
std::unique_ptr<IPDBSectionContrib> DIAEnumSectionContribs::getNext() {
|
|
CComPtr<IDiaSectionContrib> Item;
|
|
ULONG NumFetched = 0;
|
|
if (S_OK != Enumerator->Next(1, &Item, &NumFetched))
|
|
return nullptr;
|
|
|
|
return std::unique_ptr<IPDBSectionContrib>(
|
|
new DIASectionContrib(Session, Item));
|
|
}
|
|
|
|
void DIAEnumSectionContribs::reset() { Enumerator->Reset(); }
|
|
|
|
DIAEnumSectionContribs *DIAEnumSectionContribs::clone() const {
|
|
CComPtr<IDiaEnumSectionContribs> EnumeratorClone;
|
|
if (S_OK != Enumerator->Clone(&EnumeratorClone))
|
|
return nullptr;
|
|
return new DIAEnumSectionContribs(Session, EnumeratorClone);
|
|
}
|