Commits (3)
......@@ -213,6 +213,7 @@ public:
virtual unsigned long getVirtualBaseOffset() = 0;
virtual SymbolPtrList findInlineFramesByVA(MEMOFFSET_64) = 0;
virtual void getInlineSourceLine(MEMOFFSET_64, std::wstring &fileName, unsigned long &lineNo) = 0;
virtual SymbolPtr getLexicalParent() = 0;
};
///////////////////////////////////////////////////////////////////////////////
......
......@@ -544,6 +544,11 @@ public:
{
NOT_IMPLEMENTED();
}
SymbolPtr getLexicalParent() override
{
NOT_IMPLEMENTED();
}
};
......
......@@ -826,6 +826,14 @@ void DiaSymbol::getInlineSourceLine(MEMOFFSET_64 offset, std::wstring &fileName,
//////////////////////////////////////////////////////////////////////////////
SymbolPtr DiaSymbol::getLexicalParent()
{
DiaSymbolPtr diaSymbol(callSymbol(get_lexicalParent));
return SymbolPtr(new DiaSymbol(diaSymbol, m_scope, m_machineType));
}
//////////////////////////////////////////////////////////////////////////////
std::wstring DiaSession::getScopeName( IDiaSession* session, IDiaSymbol *globalScope )
{
std::wstring scopeName;
......
......@@ -152,6 +152,8 @@ public:
void getInlineSourceLine(MEMOFFSET_64, std::wstring &fileName, unsigned long &lineNo) override;
SymbolPtr getLexicalParent() override;
public:
typedef std::pair<ULONG, const wchar_t *> ValueNameEntry;
static const ValueNameEntry basicTypeName[];
......
......@@ -267,6 +267,11 @@ class ExportSymbolBase : public Symbol
{
NOT_IMPLEMENTED();
}
SymbolPtr getLexicalParent() override
{
NOT_IMPLEMENTED();
}
};
///////////////////////////////////////////////////////////////////////////////
......
......@@ -596,26 +596,31 @@ void ModuleImp::getFileVersion(unsigned long& majorVersion, unsigned long& minor
void ModuleImp::findSymSessionSymbol(MEMOFFSET_64 offset, std::wstring &name, MEMDISPLACEMENT &displacement)
{
displacement = 0;
name.clear();
offset = addr64(offset);
try
{
while ( name.empty() )
{
SymbolPtr sym = getSymSession()->findByRva( (MEMDISPLACEMENT)(offset - m_base), SymTagNull, &displacement );
name = sym->getName();
if ( !name.empty() )
break;
long tempdisp;
SymbolPtr sym = getSymSession()->findByRva( static_cast<MEMDISPLACEMENT>(offset - m_base), SymTagNull, &tempdisp );
offset = offset - displacement - 1;
auto tag = sym->getSymTag();
while (tag == SymTagBlock)
{
sym = sym->getLexicalParent();
tag = sym->getSymTag();
}
name = sym->getName();
displacement = static_cast<MEMDISPLACEMENT>(offset - m_base) - sym->getRva();
}
catch (const DbgException &)
{
name.clear();
}
}
///////////////////////////////////////////////////////////////////////////////
ScopePtr ModuleImp::getScope()
......
......@@ -15,7 +15,13 @@ const TypeFieldPtr& FieldCollection::lookup(const std::wstring &name) const
FieldList::const_iterator it;
for (it = m_fields.begin(); it != m_fields.end(); ++it)
{
if ( (*it)->getName() == name )
if ( !(*it)->isInheritedMember() && (*it)->getName() == name)
return *it;
}
for (it = m_fields.begin(); it != m_fields.end(); ++it)
{
if ( (*it)->isInheritedMember() && (*it)->getName() == name )
return *it;
}
......
......@@ -221,6 +221,13 @@ TEST_F( TypedVarTest, DISABLED_StaticMember )
EXPECT_EQ( g_classChild.m_staticConst, *var->getElement(L"m_staticConst") );
}
TEST_F(TypedVarTest, AmbiguiousFields)
{
TypedVarPtr var;
ASSERT_NO_THROW(var = loadTypedVar(L"g_virtChild"));
EXPECT_EQ(g_virtChild.m_member, *var->getElement(L"m_member"));
}
TEST_F( TypedVarTest, VirtualMember )
{
......