1
0
Fork 0

DBG: Fix function boundary computation when getting x64 stack frames

RUNTIME_FUNCTION range: [BeginAddress, EndAddress)

Old code:
Find `func` where:
`func.BeginAddress <= rva <= func.EndAddress`

New code:
Find `func` where:
`func.BeginAddress <= rva < func.EndAddress`
This commit is contained in:
now-raymond 2019-11-23 17:45:41 +08:00 committed by Duncan Ogilvie
parent 824100eea8
commit ec451897a5
1 changed files with 4 additions and 7 deletions

View File

@ -162,15 +162,12 @@ static PVOID CALLBACK StackSymFunctionTableAccess64(HANDLE hProcess, DWORD64 Add
return nullptr;
DWORD rva = DWORD(AddrBase - info->base);
RUNTIME_FUNCTION needle;
needle.BeginAddress = rva;
needle.EndAddress = rva;
needle.UnwindData = 0;
auto found = binary_find(info->runtimeFunctions.begin(), info->runtimeFunctions.end(), needle, [](const RUNTIME_FUNCTION & a, const RUNTIME_FUNCTION & b)
auto found = std::lower_bound(info->runtimeFunctions.begin(), info->runtimeFunctions.end(), rva, [](const RUNTIME_FUNCTION & a, const DWORD & rva)
{
return a.EndAddress < b.BeginAddress;
return a.EndAddress <= rva;
});
if(found != info->runtimeFunctions.end())
if(found != info->runtimeFunctions.end() && rva >= found->BeginAddress)
return &found->BeginAddress;
#endif // _WIN64