Commit 4e4f9f33 authored by ussrhero's avatar ussrhero
Browse files

fixed a bug in findSymbol routine

parent af784481
...@@ -213,6 +213,7 @@ public: ...@@ -213,6 +213,7 @@ public:
virtual unsigned long getVirtualBaseOffset() = 0; virtual unsigned long getVirtualBaseOffset() = 0;
virtual SymbolPtrList findInlineFramesByVA(MEMOFFSET_64) = 0; virtual SymbolPtrList findInlineFramesByVA(MEMOFFSET_64) = 0;
virtual void getInlineSourceLine(MEMOFFSET_64, std::wstring &fileName, unsigned long &lineNo) = 0; virtual void getInlineSourceLine(MEMOFFSET_64, std::wstring &fileName, unsigned long &lineNo) = 0;
virtual SymbolPtr getLexicalParent() = 0;
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
...@@ -544,6 +544,11 @@ public: ...@@ -544,6 +544,11 @@ public:
{ {
NOT_IMPLEMENTED(); NOT_IMPLEMENTED();
} }
SymbolPtr getLexicalParent() override
{
NOT_IMPLEMENTED();
}
}; };
......
...@@ -826,6 +826,14 @@ void DiaSymbol::getInlineSourceLine(MEMOFFSET_64 offset, std::wstring &fileName, ...@@ -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 DiaSession::getScopeName( IDiaSession* session, IDiaSymbol *globalScope )
{ {
std::wstring scopeName; std::wstring scopeName;
......
...@@ -152,6 +152,8 @@ public: ...@@ -152,6 +152,8 @@ public:
void getInlineSourceLine(MEMOFFSET_64, std::wstring &fileName, unsigned long &lineNo) override; void getInlineSourceLine(MEMOFFSET_64, std::wstring &fileName, unsigned long &lineNo) override;
SymbolPtr getLexicalParent() override;
public: public:
typedef std::pair<ULONG, const wchar_t *> ValueNameEntry; typedef std::pair<ULONG, const wchar_t *> ValueNameEntry;
static const ValueNameEntry basicTypeName[]; static const ValueNameEntry basicTypeName[];
......
...@@ -267,6 +267,11 @@ class ExportSymbolBase : public Symbol ...@@ -267,6 +267,11 @@ class ExportSymbolBase : public Symbol
{ {
NOT_IMPLEMENTED(); NOT_IMPLEMENTED();
} }
SymbolPtr getLexicalParent() override
{
NOT_IMPLEMENTED();
}
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
...@@ -596,26 +596,31 @@ void ModuleImp::getFileVersion(unsigned long& majorVersion, unsigned long& minor ...@@ -596,26 +596,31 @@ void ModuleImp::getFileVersion(unsigned long& majorVersion, unsigned long& minor
void ModuleImp::findSymSessionSymbol(MEMOFFSET_64 offset, std::wstring &name, MEMDISPLACEMENT &displacement) void ModuleImp::findSymSessionSymbol(MEMOFFSET_64 offset, std::wstring &name, MEMDISPLACEMENT &displacement)
{ {
displacement = 0; displacement = 0;
name.clear();
offset = addr64(offset); offset = addr64(offset);
try try
{ {
while ( name.empty() ) long tempdisp;
{ SymbolPtr sym = getSymSession()->findByRva( static_cast<MEMDISPLACEMENT>(offset - m_base), SymTagNull, &tempdisp );
SymbolPtr sym = getSymSession()->findByRva( (MEMDISPLACEMENT)(offset - m_base), SymTagNull, &displacement );
name = sym->getName();
if ( !name.empty() )
break;
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 &) catch (const DbgException &)
{ {
name.clear();
} }
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
ScopePtr ModuleImp::getScope() ScopePtr ModuleImp::getScope()
......
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