Commit 383991d7 authored by ussrhero's avatar ussrhero
Browse files

Merge branch 'fix_inline_overloads' into 'dev-1.0'

Fix inline frames of overloaded functions

See merge request !30
parents d6c85ac7 aa40d725
...@@ -441,7 +441,12 @@ bool StackFrameImpl::findStaticVar(const std::wstring& varName) ...@@ -441,7 +441,12 @@ bool StackFrameImpl::findStaticVar(const std::wstring& varName)
TypedVarPtr StackFrameImpl::getFunction() TypedVarPtr StackFrameImpl::getFunction()
{ {
auto funcPtr = loadTypedVar(kdlib::findSymbol(m_ip)); MEMDISPLACEMENT displacement;
auto module = loadModule(m_ip);
module->getSymbolByVa(m_ip, SymTagFunction, &displacement);
auto funcPtr = module->getTypedVarByAddr(m_ip - displacement);
if (m_inlineIndex == 0 ) if (m_inlineIndex == 0 )
return funcPtr; return funcPtr;
...@@ -465,17 +470,10 @@ std::wstring StackFrameImpl::findSymbol(MEMDISPLACEMENT &displacement) ...@@ -465,17 +470,10 @@ std::wstring StackFrameImpl::findSymbol(MEMDISPLACEMENT &displacement)
if (m_inlineIndex == 0) if (m_inlineIndex == 0)
return kdlib::findSymbol(m_ip, displacement); return kdlib::findSymbol(m_ip, displacement);
auto funcPtr = loadTypedVar(kdlib::findSymbol(m_ip));
for (MEMDISPLACEMENT i = 0; i <= 1; ++i)
{
const auto& inlineFunctions = funcPtr->getInlineFunctions(m_ip - i);
if (inlineFunctions.size() >= m_inlineIndex) auto func = getFunction();
return (*std::next(inlineFunctions.rbegin(), m_inlineIndex - 1))->getName(); displacement = (MEMDISPLACEMENT)((long long)m_ip - (long long)func->getAddress());
} return func->getName();
throw TypeException(L"failed to find inline function");
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
...@@ -489,7 +487,11 @@ void StackFrameImpl::getSourceLine(std::wstring& fileName, unsigned long& lineNo ...@@ -489,7 +487,11 @@ void StackFrameImpl::getSourceLine(std::wstring& fileName, unsigned long& lineNo
return; return;
} }
auto funcPtr = loadTypedVar(kdlib::findSymbol(m_ip)); MEMDISPLACEMENT displacement;
auto module = loadModule(m_ip);
module->getSymbolByVa(m_ip, SymTagFunction, &displacement);
auto funcPtr = module->getTypedVarByAddr(m_ip - displacement);
for (MEMDISPLACEMENT i = 0; i <= 1; ++i) for (MEMDISPLACEMENT i = 0; i <= 1; ++i)
{ {
......
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