diff options
author | Koundinya Veluri <kouvel@users.noreply.github.com> | 2018-02-11 16:57:09 -0800 |
---|---|---|
committer | Noah Falk <noahfalk@users.noreply.github.com> | 2018-02-11 16:57:08 -0800 |
commit | ce060415550334e598ee2efbc4beed0f07ede3f9 (patch) | |
tree | 47e868f8019cf55ef537a5508503fb971f960278 /src/debug | |
parent | 78cd08538b59e8c2cff032f39a919b00eb552d74 (diff) | |
download | coreclr-ce060415550334e598ee2efbc4beed0f07ede3f9.tar.gz coreclr-ce060415550334e598ee2efbc4beed0f07ede3f9.tar.bz2 coreclr-ce060415550334e598ee2efbc4beed0f07ede3f9.zip |
Fix stack trace population to get proper source/line info for tier 1 methods (#16302)
Fixes https://github.com/dotnet/coreclr/issues/16224
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/ee/debugger.cpp | 38 | ||||
-rw-r--r-- | src/debug/ee/debugger.h | 2 | ||||
-rw-r--r-- | src/debug/ee/functioninfo.cpp | 6 |
3 files changed, 31 insertions, 15 deletions
diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index 94792dac2c..c5b8a633bd 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -14139,6 +14139,9 @@ bool Debugger::GetILOffsetFromNative (MethodDesc *pFunc, const BYTE *pbAddr, } CONTRACTL_END; + _ASSERTE(pFunc != NULL); + _ASSERTE(pbAddr != NULL); + if (!HasLazyData()) { DebuggerLockHolder dbgLockHolder(this); @@ -14152,23 +14155,36 @@ bool Debugger::GetILOffsetFromNative (MethodDesc *pFunc, const BYTE *pbAddr, pFunc = pFunc->GetWrappedMethodDesc(); } - DebuggerJitInfo *jitInfo = - GetJitInfo(pFunc, (const BYTE *)pbAddr); + if (pFunc->IsDynamicMethod()) + { + return false; + } - if (jitInfo != NULL) + DebuggerMethodInfo *methodInfo = GetOrCreateMethodInfo(pFunc->GetModule(), pFunc->GetMemberDef()); + if (methodInfo == NULL) { - CorDebugMappingResult map; - DWORD whichIDontCare; + return false; + } - *ilOffset = jitInfo->MapNativeOffsetToIL( - nativeOffset, - &map, - &whichIDontCare); + PCODE methodStartAddress = g_pEEInterface->GetNativeCodeStartAddress((PCODE)pbAddr); + if (methodStartAddress == NULL) + { + return false; + } - return true; + DebuggerJitInfo *jitInfo = methodInfo->FindOrCreateInitAndAddJitInfo(pFunc, methodStartAddress); + if (jitInfo == NULL) + { + return false; } - return false; + CorDebugMappingResult map; + DWORD whichIDontCare; + *ilOffset = jitInfo->MapNativeOffsetToIL( + nativeOffset, + &map, + &whichIDontCare); + return true; } /****************************************************************************** diff --git a/src/debug/ee/debugger.h b/src/debug/ee/debugger.h index 25e4682418..6ba4e69868 100644 --- a/src/debug/ee/debugger.h +++ b/src/debug/ee/debugger.h @@ -1010,7 +1010,7 @@ public: DebuggerJitInfo * FindJitInfo(MethodDesc * pMD, TADDR addrNativeStartAddr); // Creating the Jit-infos. - DebuggerJitInfo *FindOrCreateInitAndAddJitInfo(MethodDesc* fd, TADDR startAddr); + DebuggerJitInfo *FindOrCreateInitAndAddJitInfo(MethodDesc* fd, PCODE startAddr); DebuggerJitInfo *CreateInitAndAddJitInfo(MethodDesc* fd, TADDR startAddr, BOOL* jitInfoWasCreated); diff --git a/src/debug/ee/functioninfo.cpp b/src/debug/ee/functioninfo.cpp index fc443f9ed5..d4521110ba 100644 --- a/src/debug/ee/functioninfo.cpp +++ b/src/debug/ee/functioninfo.cpp @@ -1548,7 +1548,7 @@ DebuggerJitInfo * DebuggerMethodInfo::FindJitInfo(MethodDesc * pMD, * */ -DebuggerJitInfo *DebuggerMethodInfo::FindOrCreateInitAndAddJitInfo(MethodDesc* fd, TADDR startAddr) +DebuggerJitInfo *DebuggerMethodInfo::FindOrCreateInitAndAddJitInfo(MethodDesc* fd, PCODE startAddr) { CONTRACTL { @@ -1569,7 +1569,7 @@ DebuggerJitInfo *DebuggerMethodInfo::FindOrCreateInitAndAddJitInfo(MethodDesc* f if (startAddr == NULL) { // This will grab the start address for the current code version. - startAddr = (TADDR)g_pEEInterface->GetFunctionAddress(fd); + startAddr = g_pEEInterface->GetFunctionAddress(fd); if (startAddr == NULL) { return NULL; @@ -1577,7 +1577,7 @@ DebuggerJitInfo *DebuggerMethodInfo::FindOrCreateInitAndAddJitInfo(MethodDesc* f } else { - _ASSERTE(g_pEEInterface->GetNativeCodeMethodDesc((PCODE)startAddr) == fd); + _ASSERTE(g_pEEInterface->GetNativeCodeMethodDesc(startAddr) == fd); } // Check the lsit to see if we've already populated an entry for this JitInfo. |