Skip to content

Commit

Permalink
Use correct PDBDiaFile instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt authored and mrexodia committed Jul 1, 2018
1 parent 45b4999 commit c8af1f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
25 changes: 10 additions & 15 deletions src/dbg/symbolsourcedia.cpp
Expand Up @@ -6,7 +6,8 @@
SymbolSourceDIA::SymbolSourceDIA()
: _requiresShutdown(false),
_imageBase(0),
_loadCounter(0)
_loadCounter(0),
_isOpen(false)
{
}

Expand All @@ -16,11 +17,6 @@ SymbolSourceDIA::~SymbolSourceDIA()
{
cancelLoading();
}

if(_pdb.isOpen())
{
_pdb.close();
}
}

static void SetThreadDescription(std::thread & thread, WString name)
Expand All @@ -42,10 +38,12 @@ bool SymbolSourceDIA::loadPDB(const std::string & path, duint imageBase, duint i
return false;
}

bool res = _pdb.open(path.c_str(), 0, validationData);
PDBDiaFile pdb; // Instance used for validation only.
_isOpen = pdb.open(path.c_str(), 0, validationData);
#if 1 // Async loading.
if(res)
if(_isOpen)
{

_imageSize = imageSize;
_imageBase = imageBase;
_requiresShutdown = false;
Expand All @@ -56,12 +54,12 @@ bool SymbolSourceDIA::loadPDB(const std::string & path, duint imageBase, duint i
SetThreadDescription(_symbolsThread, L"SourceLinesThread");
}
#endif
return res;
return _isOpen;
}

bool SymbolSourceDIA::isOpen() const
{
return _pdb.isOpen();
return _isOpen;
}

bool SymbolSourceDIA::isLoading() const
Expand Down Expand Up @@ -158,7 +156,7 @@ bool SymbolSourceDIA::loadSymbolsAsync(String path)
return true;
};

bool res = _pdb.enumerateLexicalHierarchy(query);
bool res = pdb.enumerateLexicalHierarchy(query);

if(!res)
{
Expand Down Expand Up @@ -238,7 +236,7 @@ bool SymbolSourceDIA::loadSourceLinesAsync(String path)

std::map<uint64_t, DiaLineInfo_t> lines;

bool res = _pdb.getFunctionLineNumbers(rva, rangeSize, _imageBase, lines);
bool res = pdb.getFunctionLineNumbers(rva, rangeSize, _imageBase, lines);
for(const auto & line : lines)
{
if(_requiresShutdown)
Expand Down Expand Up @@ -367,9 +365,6 @@ void SymbolSourceDIA::enumSymbols(const CbEnumSymbol & cbEnum)

bool SymbolSourceDIA::findSourceLineInfo(duint rva, LineInfo & lineInfo)
{
if(isOpen() == false)
return false;

ScopedSpinLock lock(_lockLines);

auto it = _lines.find(rva);
Expand Down
3 changes: 1 addition & 2 deletions src/dbg/symbolsourcedia.h
Expand Up @@ -54,8 +54,7 @@ class SymbolSourceDIA : public SymbolSourceBase
};

private:
PDBDiaFile _pdb;

bool _isOpen;
std::vector<SymbolInfo> _symData;

struct AddrIndex
Expand Down

0 comments on commit c8af1f9

Please sign in to comment.