Commit bb8a2859 authored by ussrhero's avatar ussrhero

Merge branch 'dev-1.0' of https://githomelab.ru/kdlibcpp/kdlibcpp into dev-1.0

parents bd0e7533 bcbda6ac
......@@ -765,14 +765,28 @@ unsigned long DiaSymbol::getVirtualBaseOffset()
//////////////////////////////////////////////////////////////////////////////
std::wstring DiaSession::getScopeName( IDiaSession* session )
{
ULONGLONG loadBase;
HRESULT hres = session->get_loadAddress(&loadBase);
if (S_OK != hres)
return L"";
std::wstring DiaSession::getScopeName( IDiaSession* session, IDiaSymbol *globalScope )
{
std::wstring scopeName;
// Try to get module name as scope
try
{
ULONGLONG loadBase;
HRESULT hres = session->get_loadAddress(&loadBase);
if (S_OK != hres)
return L"";
return getModuleName(loadBase);
scopeName = getModuleName(loadBase);
}
catch (DbgException e) // fallback to pdb name
{
HRESULT hres;
BSTR bstrName = NULL;
hres = globalScope->get_name(&bstrName);
if (S_OK == hres)
scopeName = std::wstring(_bstr_t(bstrName, false));
}
return scopeName;
}
//////////////////////////////////////////////////////////////////////////////
......@@ -799,7 +813,7 @@ SymbolPtr DiaSession::findByRva( ULONG rva, ULONG symTag, LONG* pdisplacement )
if (pdisplacement)
*pdisplacement = displacement;
return SymbolPtr( new DiaSymbol(child, getScopeName( m_session ), m_globalSymbol->getMachineType() ) );
return SymbolPtr( new DiaSymbol(child, m_globalSymbol->getScopeName(), m_globalSymbol->getMachineType() ) );
}
///////////////////////////////////////////////////////////////////////////////
......
......@@ -203,7 +203,7 @@ public:
DiaSession( IDiaSession* session, IDiaSymbol *globalScope, const std::wstring symbolFile ) :
m_globalScope( globalScope ),
m_globalSymbol( DiaSymbol::fromGlobalScope( globalScope, getScopeName( session ) ) ),
m_globalSymbol( DiaSymbol::fromGlobalScope( globalScope, getScopeName( session, globalScope ) ) ),
m_session( session ),
m_symbolFileName( symbolFile )
{}
......@@ -222,7 +222,7 @@ public:
private:
static std::wstring getScopeName( IDiaSession* session );
static std::wstring getScopeName( IDiaSession* session, IDiaSymbol *globalScope );
ULONG findRvaByName( const std::string &name );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment