diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ToolBox/SOS/Strike/datatarget.cpp | 12 | ||||
-rw-r--r-- | src/ToolBox/SOS/Strike/datatarget.h | 6 | ||||
-rw-r--r-- | src/ToolBox/SOS/Strike/strike.cpp | 5 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/debugclient.cpp | 100 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/debugclient.h | 12 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/inc/dbgeng.h | 5 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/sosplugin.h | 1 | ||||
-rw-r--r-- | src/debug/daccess/dacfn.cpp | 10 | ||||
-rw-r--r-- | src/debug/di/shimdatatarget.cpp | 24 | ||||
-rw-r--r-- | src/debug/di/shimdatatarget.h | 7 | ||||
-rw-r--r-- | src/debug/di/shimprocess.cpp | 18 | ||||
-rw-r--r-- | src/inc/cordebug.idl | 8 | ||||
-rw-r--r-- | src/inc/daccess.h | 2 | ||||
-rw-r--r-- | src/pal/prebuilt/idl/cordebug_i.c | 17 | ||||
-rw-r--r-- | src/pal/prebuilt/inc/cordebug.h | 35 | ||||
-rw-r--r-- | src/vm/amd64/gmsamd64.cpp | 21 | ||||
-rw-r--r-- | src/vm/amd64/gmscpu.h | 1 | ||||
-rw-r--r-- | src/vm/arm/gmscpu.h | 1 | ||||
-rw-r--r-- | src/vm/arm/stubs.cpp | 1 | ||||
-rw-r--r-- | src/vm/arm64/gmscpu.h | 1 | ||||
-rw-r--r-- | src/vm/arm64/stubs.cpp | 1 | ||||
-rw-r--r-- | src/vm/frames.cpp | 6 | ||||
-rw-r--r-- | src/vm/i386/gmscpu.h | 1 | ||||
-rw-r--r-- | src/vm/i386/gmsx86.cpp | 1 |
24 files changed, 204 insertions, 92 deletions
diff --git a/src/ToolBox/SOS/Strike/datatarget.cpp b/src/ToolBox/SOS/Strike/datatarget.cpp index 6da8f7100f..08436f7548 100644 --- a/src/ToolBox/SOS/Strike/datatarget.cpp +++ b/src/ToolBox/SOS/Strike/datatarget.cpp @@ -196,8 +196,14 @@ DataTarget::Request( } HRESULT STDMETHODCALLTYPE -DataTarget::GetPid( - /* [out] */ DWORD *pdwProcessId) +DataTarget::VirtualUnwind( + /* [in] */ DWORD threadId, + /* [in] */ ULONG32 contextSize, + /* [in, out, size_is(contextSize)] */ PBYTE context) { - return g_ExtSystem->GetCurrentProcessId(pdwProcessId); + if (g_ExtClient == NULL) + { + return E_UNEXPECTED; + } + return g_ExtClient->VirtualUnwind(threadId, contextSize, context); }
\ No newline at end of file diff --git a/src/ToolBox/SOS/Strike/datatarget.h b/src/ToolBox/SOS/Strike/datatarget.h index 407ddc00d9..49137af216 100644 --- a/src/ToolBox/SOS/Strike/datatarget.h +++ b/src/ToolBox/SOS/Strike/datatarget.h @@ -85,6 +85,8 @@ public: // ICorDebugDataTarget4 - virtual HRESULT STDMETHODCALLTYPE GetPid( - /* [out] */ DWORD *pdwProcessId); + virtual HRESULT STDMETHODCALLTYPE VirtualUnwind( + /* [in] */ DWORD threadId, + /* [in] */ ULONG32 contextSize, + /* [in, out, size_is(contextSize)] */ PBYTE context); };
\ No newline at end of file diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp index 13449eb95d..eb71163d1a 100644 --- a/src/ToolBox/SOS/Strike/strike.cpp +++ b/src/ToolBox/SOS/Strike/strike.cpp @@ -6892,8 +6892,13 @@ HRESULT HandleCLRNotificationEvent() if (!CheckCLRNotificationEvent(&dle)) { +#ifndef FEATURE_PAL ExtOut("Expecting first chance CLRN exception\n"); return E_FAIL; +#else + g_ExtControl->Execute(DEBUG_EXECUTE_NOT_LOGGED, "process continue", 0); + return S_OK; +#endif } // Notification only needs to live for the lifetime of the call below, so it's a non-static diff --git a/src/ToolBox/SOS/lldbplugin/debugclient.cpp b/src/ToolBox/SOS/lldbplugin/debugclient.cpp index ebb4504bf5..fad404a820 100644 --- a/src/ToolBox/SOS/lldbplugin/debugclient.cpp +++ b/src/ToolBox/SOS/lldbplugin/debugclient.cpp @@ -7,7 +7,6 @@ #include <cstdlib> #include "sosplugin.h" #include <string.h> -#include <dbgtargetcontext.h> #include <string> ULONG g_currentThreadIndex = -1; @@ -708,8 +707,8 @@ DebugClient::GetModuleDirectory( // Internal function ULONG64 DebugClient::GetModuleBase( - lldb::SBTarget target, - lldb::SBModule module) + /* const */ lldb::SBTarget& target, + /* const */ lldb::SBModule& module) { // Find the first section with an valid base address int numSections = module.GetNumSections(); @@ -922,6 +921,19 @@ DebugClient::GetThreadContextById( dtcontext = (DT_CONTEXT*)context; dtcontext->ContextFlags = contextFlags; + GetContextFromFrame(frame, dtcontext); + hr = S_OK; + +exit: + return hr; +} + +// Internal function +void +DebugClient::GetContextFromFrame( + /* const */ lldb::SBFrame& frame, + DT_CONTEXT *dtcontext) +{ #ifdef DBG_TARGET_AMD64 dtcontext->Rip = frame.GetPC(); dtcontext->Rsp = frame.GetSP(); @@ -969,29 +981,19 @@ DebugClient::GetThreadContextById( dtcontext->R11 = GetRegister(frame, "r11"); dtcontext->R12 = GetRegister(frame, "r12"); #endif - - hr = S_OK; - -exit: - return hr; } // Internal function DWORD_PTR -DebugClient::GetRegister(lldb::SBFrame frame, const char *name) +DebugClient::GetRegister( + /* const */ lldb::SBFrame& frame, + const char *name) { lldb::SBValue regValue = frame.FindRegister(name); lldb::SBError error; DWORD_PTR result = regValue.GetValueAsUnsigned(error); -#ifdef _DEBUG - if (!regValue.IsValid() || error.Fail()) - { - Output(DEBUG_OUTPUT_ERROR, "Invalid register name '%s'\n", name); - } -#endif - return result; } @@ -1115,7 +1117,7 @@ DebugClient::GetExpression( // Internal function DWORD_PTR DebugClient::GetExpression( - lldb::SBFrame frame, + /* const */ lldb::SBFrame& frame, lldb::SBError& error, PCSTR exp) { @@ -1130,6 +1132,70 @@ DebugClient::GetExpression( return result; } +HRESULT +DebugClient::VirtualUnwind( + DWORD threadID, + ULONG32 contextSize, + PBYTE context) +{ + lldb::SBProcess process; + lldb::SBThread thread; + + if (context == NULL || contextSize < sizeof(DT_CONTEXT)) + { + return E_FAIL; + } + + process = GetCurrentProcess(); + if (!process.IsValid()) + { + return E_FAIL; + } + + thread = process.GetThreadByID(threadID); + if (!thread.IsValid()) + { + return E_FAIL; + } + + DT_CONTEXT *dtcontext = (DT_CONTEXT*)context; + lldb::SBFrame frameFound; + +#ifdef DBG_TARGET_AMD64 + DWORD64 spToFind = dtcontext->Rsp; +#elif DBG_TARGET_ARM + DWORD spToFind = dtcontext->Sp; +#endif + + int numFrames = thread.GetNumFrames(); + for (int i = 0; i < numFrames; i++) + { + lldb::SBFrame frame = thread.GetFrameAtIndex(i); + if (!frame.IsValid()) + { + break; + } + + lldb::addr_t sp = frame.GetSP(); + + if (sp == spToFind && (i + 1) < numFrames) + { + // Get next frame after finding the match + frameFound = thread.GetFrameAtIndex(i + 1); + break; + } + } + + if (!frameFound.IsValid()) + { + return E_FAIL; + } + + GetContextFromFrame(frameFound, dtcontext); + + return S_OK; +} + //---------------------------------------------------------------------------- // Helper functions //---------------------------------------------------------------------------- diff --git a/src/ToolBox/SOS/lldbplugin/debugclient.h b/src/ToolBox/SOS/lldbplugin/debugclient.h index c3978f21dd..036c17360f 100644 --- a/src/ToolBox/SOS/lldbplugin/debugclient.h +++ b/src/ToolBox/SOS/lldbplugin/debugclient.h @@ -13,9 +13,10 @@ private: lldb::SBProcess GetCurrentProcess(); lldb::SBThread GetCurrentThread(); lldb::SBFrame GetCurrentFrame(); - ULONG64 GetModuleBase(lldb::SBTarget target, lldb::SBModule module); - DWORD_PTR GetExpression(lldb::SBFrame frame, lldb::SBError& error, PCSTR exp); - DWORD_PTR GetRegister(lldb::SBFrame frame, const char *name); + ULONG64 GetModuleBase(lldb::SBTarget& target, lldb::SBModule& module); + DWORD_PTR GetExpression(lldb::SBFrame& frame, lldb::SBError& error, PCSTR exp); + void GetContextFromFrame(lldb::SBFrame& frame, DT_CONTEXT *dtcontext); + DWORD_PTR GetRegister(lldb::SBFrame& frame, const char *name); public: DebugClient(lldb::SBDebugger &debugger, lldb::SBCommandReturnObject &returnObject); @@ -192,4 +193,9 @@ public: DWORD_PTR GetExpression( PCSTR exp); + + HRESULT VirtualUnwind( + DWORD threadID, + ULONG32 contextSize, + PBYTE context); }; diff --git a/src/ToolBox/SOS/lldbplugin/inc/dbgeng.h b/src/ToolBox/SOS/lldbplugin/inc/dbgeng.h index 36c1c83073..04b27fbf8e 100644 --- a/src/ToolBox/SOS/lldbplugin/inc/dbgeng.h +++ b/src/ToolBox/SOS/lldbplugin/inc/dbgeng.h @@ -457,6 +457,11 @@ public: // Evaluates a lldb expression into a value. virtual DWORD_PTR GetExpression( /* [in] */ PCSTR exp) = 0; + + virtual HRESULT VirtualUnwind( + /* [in] */ DWORD threadID, + /* [in] */ ULONG32 contextSize, + /* [in, out, size_is(contextSize)] */ PBYTE context) = 0; }; typedef class IDebugClient* PDEBUG_CLIENT; diff --git a/src/ToolBox/SOS/lldbplugin/sosplugin.h b/src/ToolBox/SOS/lldbplugin/sosplugin.h index 54a7aee491..4b44589fe7 100644 --- a/src/ToolBox/SOS/lldbplugin/sosplugin.h +++ b/src/ToolBox/SOS/lldbplugin/sosplugin.h @@ -7,6 +7,7 @@ #include "mstypes.h" #define DEFINE_EXCEPTION_RECORD #include <dbgeng.h> +#include <dbgtargetcontext.h> #include "debugclient.h" typedef HRESULT (*CommandFunc)(PDEBUG_CLIENT client, const char *args); diff --git a/src/debug/daccess/dacfn.cpp b/src/debug/daccess/dacfn.cpp index 5bec3b4ca1..d96f3f9085 100644 --- a/src/debug/daccess/dacfn.cpp +++ b/src/debug/daccess/dacfn.cpp @@ -219,7 +219,7 @@ DacWriteAll(TADDR addr, PVOID buffer, ULONG32 size, bool throwEx) } HRESULT -DacGetPid(DWORD *pid) +DacVirtualUnwind(DWORD threadId, CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers) { if (!g_dacImpl) { @@ -227,11 +227,17 @@ DacGetPid(DWORD *pid) UNREACHABLE(); } + // The DAC code doesn't use these context pointers but zero them out to be safe. + if (contextPointers != NULL) + { + memset(contextPointers, 0, sizeof(KNONVOLATILE_CONTEXT_POINTERS)); + } + ReleaseHolder<ICorDebugDataTarget4> dt; HRESULT hr = g_dacImpl->m_pTarget->QueryInterface(IID_ICorDebugDataTarget4, (void **)&dt); if (SUCCEEDED(hr)) { - hr = dt->GetPid(pid); + hr = dt->VirtualUnwind(threadId, sizeof(CONTEXT), (BYTE*)context); } return hr; diff --git a/src/debug/di/shimdatatarget.cpp b/src/debug/di/shimdatatarget.cpp index d7bfbdc11d..8221a0582a 100644 --- a/src/debug/di/shimdatatarget.cpp +++ b/src/debug/di/shimdatatarget.cpp @@ -68,22 +68,30 @@ ULONG STDMETHODCALLTYPE ShimDataTarget::Release() return ref; } - //--------------------------------------------------------------------------------------- // // Get the OS Process ID that this DataTarget is for. // // Return Value: // The OS PID of the process this data target is representing. -HRESULT STDMETHODCALLTYPE ShimDataTarget::GetPid(DWORD *pdwProcessId) +DWORD ShimDataTarget::GetPid() { - if (pdwProcessId == NULL) - { - return E_INVALIDARG; - } + return m_processId; +} - *pdwProcessId = m_processId; - return S_OK; +//--------------------------------------------------------------------------------------- +// +// Unwind the stack to the next frame. +// +// Return Value: +// context and contextPointers filled in with the next frame +// +HRESULT STDMETHODCALLTYPE ShimDataTarget::VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context) +{ +#ifndef FEATURE_PAL + _ASSERTE(!"ShimDataTarget::VirtualUnwind NOT IMPLEMENTED"); +#endif + return E_NOTIMPL; } //--------------------------------------------------------------------------------------- diff --git a/src/debug/di/shimdatatarget.h b/src/debug/di/shimdatatarget.h index 9e3502bb48..145b30cde1 100644 --- a/src/debug/di/shimdatatarget.h +++ b/src/debug/di/shimdatatarget.h @@ -36,6 +36,9 @@ public: // is unavailable because it's running void SetError(HRESULT hr); + // Get the OS Process ID that this DataTarget is for. + DWORD GetPid(); + // // IUnknown. // @@ -86,8 +89,8 @@ public: // ICorDebugDataTarget4 // - // Get the OS Process ID that this DataTarget is for. - virtual HRESULT STDMETHODCALLTYPE GetPid(DWORD *pdwProcessId); + // Unwind to the next stack frame + virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context); protected: // Pid of the target process. diff --git a/src/debug/di/shimprocess.cpp b/src/debug/di/shimprocess.cpp index 463b35c4e9..ed315b6cad 100644 --- a/src/debug/di/shimprocess.cpp +++ b/src/debug/di/shimprocess.cpp @@ -133,9 +133,7 @@ void ShimProcess::SetProcess(ICorDebugProcess * pProcess) if (pProcess != NULL) { // Verify that DataTarget + new process have the same pid? - DWORD pid = 0; - _ASSERTE(SUCCEEDED(m_pLiveDataTarget->GetPid(&pid))); - _ASSERTE(m_pProcess->GetPid() == pid); + _ASSERTE(m_pProcess->GetPid() == m_pLiveDataTarget->GetPid()); } } @@ -740,11 +738,8 @@ HRESULT ShimProcess::HandleWin32DebugEvent(const DEBUG_EVENT * pEvent) // This assert could be our only warning of various catastrophic failures in the left-side. if (!dwFirstChance && (pRecord->ExceptionCode == STATUS_BREAKPOINT) && !m_fIsInteropDebugging) { - DWORD pid = 0; - if (m_pLiveDataTarget != NULL) - { - m_pLiveDataTarget->GetPid(&pid); - } + DWORD pid = (m_pLiveDataTarget == NULL) ? 0 : m_pLiveDataTarget->GetPid(); + CONSISTENCY_CHECK_MSGF(false, ("Unhandled breakpoint exception in debuggee (pid=%d (0x%x)) on thread %d(0x%x)\n" "This may mean there was an assert in the debuggee on that thread.\n" @@ -1748,11 +1743,8 @@ void ShimProcess::PreDispatchEvent(bool fRealCreateProcessEvent /*= false*/) CORDB_ADDRESS ShimProcess::GetCLRInstanceBaseAddress() { CORDB_ADDRESS baseAddress = CORDB_ADDRESS(NULL); - DWORD dwPid = 0; - if (FAILED(m_pLiveDataTarget->GetPid(&dwPid))) - { - return baseAddress; - } + DWORD dwPid = m_pLiveDataTarget->GetPid(); + #if defined(FEATURE_CORESYSTEM) // Debugger attaching to CoreCLR via CoreCLRCreateCordbObject should have already specified CLR module address. // Code that help to find it now lives in dbgshim. diff --git a/src/inc/cordebug.idl b/src/inc/cordebug.idl index f9017df097..cf6259ad0e 100644 --- a/src/inc/cordebug.idl +++ b/src/inc/cordebug.idl @@ -823,9 +823,11 @@ interface ICorDebugDataTarget3 : IUnknown interface ICorDebugDataTarget4 : IUnknown { /* - * gives back a process id - */ - HRESULT GetPid([out] DWORD *pdwProcessId); + * Unwinds one native stack frame in the target process/thread + */ + HRESULT VirtualUnwind([in] DWORD threadId, + [in] ULONG32 contextSize, + [in, out, size_is(contextSize)] BYTE *context); }; /* diff --git a/src/inc/daccess.h b/src/inc/daccess.h index 241c25ea21..715fe4a6f7 100644 --- a/src/inc/daccess.h +++ b/src/inc/daccess.h @@ -663,7 +663,7 @@ HRESULT DacFreeVirtual(TADDR mem, ULONG32 size, ULONG32 typeFlags, PVOID DacInstantiateTypeByAddress(TADDR addr, ULONG32 size, bool throwEx); PVOID DacInstantiateTypeByAddressNoReport(TADDR addr, ULONG32 size, bool throwEx); PVOID DacInstantiateClassByVTable(TADDR addr, ULONG32 minSize, bool throwEx); -HRESULT DacGetPid(DWORD *pid); +HRESULT DacVirtualUnwind(ULONG32 threadId, CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers); // Copy a null-terminated ascii or unicode string from the target to the host. // Note that most of the work here is to find the null terminator. If you know the exact length, diff --git a/src/pal/prebuilt/idl/cordebug_i.c b/src/pal/prebuilt/idl/cordebug_i.c index 8a947ccf49..e3c8d2edcb 100644 --- a/src/pal/prebuilt/idl/cordebug_i.c +++ b/src/pal/prebuilt/idl/cordebug_i.c @@ -1,8 +1,3 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ @@ -10,7 +5,17 @@ /* link this file in with the server and any clients */ - /* File created by MIDL compiler version 8.00.0603 */ + /* File created by MIDL compiler version 8.00.0613 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:/ssd/coreclr/src/inc/cordebug.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0613 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ diff --git a/src/pal/prebuilt/inc/cordebug.h b/src/pal/prebuilt/inc/cordebug.h index 153d3901ee..46f6929778 100644 --- a/src/pal/prebuilt/inc/cordebug.h +++ b/src/pal/prebuilt/inc/cordebug.h @@ -1,12 +1,19 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// + /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0603 */ + /* File created by MIDL compiler version 8.00.0613 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:/ssd/coreclr/src/inc/cordebug.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0613 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ @@ -22,7 +29,7 @@ #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> -#endif // __RPCNDR_H_VERSION__ +#endif /* __RPCNDR_H_VERSION__ */ #ifndef COM_NO_WINDOWS_H #include "windows.h" @@ -2853,8 +2860,10 @@ EXTERN_C const IID IID_ICorDebugDataTarget4; ICorDebugDataTarget4 : public IUnknown { public: - virtual HRESULT STDMETHODCALLTYPE GetPid( - /* [out] */ DWORD *pdwProcessId) = 0; + virtual HRESULT STDMETHODCALLTYPE VirtualUnwind( + /* [in] */ DWORD threadId, + /* [in] */ ULONG32 contextSize, + /* [size_is][out][in] */ BYTE *context) = 0; }; @@ -2877,9 +2886,11 @@ EXTERN_C const IID IID_ICorDebugDataTarget4; ULONG ( STDMETHODCALLTYPE *Release )( ICorDebugDataTarget4 * This); - HRESULT ( STDMETHODCALLTYPE *GetPid )( + HRESULT ( STDMETHODCALLTYPE *VirtualUnwind )( ICorDebugDataTarget4 * This, - /* [out] */ DWORD *pdwProcessId); + /* [in] */ DWORD threadId, + /* [in] */ ULONG32 contextSize, + /* [size_is][out][in] */ BYTE *context); END_INTERFACE } ICorDebugDataTarget4Vtbl; @@ -2904,8 +2915,8 @@ EXTERN_C const IID IID_ICorDebugDataTarget4; ( (This)->lpVtbl -> Release(This) ) -#define ICorDebugDataTarget4_GetPid(This,pdwProcessId) \ - ( (This)->lpVtbl -> GetPid(This,pdwProcessId) ) +#define ICorDebugDataTarget4_VirtualUnwind(This,threadId,contextSize,context) \ + ( (This)->lpVtbl -> VirtualUnwind(This,threadId,contextSize,context) ) #endif /* COBJMACROS */ diff --git a/src/vm/amd64/gmsamd64.cpp b/src/vm/amd64/gmsamd64.cpp index 49f45c96e5..ea9fd54734 100644 --- a/src/vm/amd64/gmsamd64.cpp +++ b/src/vm/amd64/gmsamd64.cpp @@ -10,16 +10,9 @@ #include "common.h" #include "gmscpu.h" -#if defined(DACCESS_COMPILE) -static BOOL DacReadAllAdapter(SIZE_T address, SIZE_T *value) -{ - HRESULT hr = DacReadAll((TADDR)address, (PVOID)value, sizeof(*value), false); - return SUCCEEDED(hr); -} -#endif //DACCESS_COMPILE - void LazyMachState::unwindLazyState(LazyMachState* baseState, MachState* unwoundState, + DWORD threadId, int funCallDepth /* = 1 */, HostCallPreference hostCallPreference /* = (HostCallPreference)(-1) */) { @@ -64,16 +57,8 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, #else // !FEATURE_PAL #if defined(DACCESS_COMPILE) - DWORD pid; - HRESULT hr = DacGetPid(&pid); - if (SUCCEEDED(hr)) - { - if (!PAL_VirtualUnwindOutOfProc(&ctx, &nonVolRegPtrs, pid, DacReadAllAdapter)) - { - DacError(E_FAIL); - } - } - else + HRESULT hr = DacVirtualUnwind(threadId, &ctx, &nonVolRegPtrs); + if (FAILED(hr)) { DacError(hr); } diff --git a/src/vm/amd64/gmscpu.h b/src/vm/amd64/gmscpu.h index 46a0d39f68..233f2f2b66 100644 --- a/src/vm/amd64/gmscpu.h +++ b/src/vm/amd64/gmscpu.h @@ -102,6 +102,7 @@ struct LazyMachState : public MachState void setLazyStateFromUnwind(MachState* copy); static void unwindLazyState(LazyMachState* baseState, MachState* lazyState, + DWORD threadId, int funCallDepth = 1, HostCallPreference hostCallPreference = AllowHostCalls); diff --git a/src/vm/arm/gmscpu.h b/src/vm/arm/gmscpu.h index bc41a008a0..fdefb32749 100644 --- a/src/vm/arm/gmscpu.h +++ b/src/vm/arm/gmscpu.h @@ -82,6 +82,7 @@ struct LazyMachState : public MachState { void setLazyStateFromUnwind(MachState* copy); static void unwindLazyState(LazyMachState* baseState, MachState* lazyState, + DWORD threadId, int funCallDepth = 1, HostCallPreference hostCallPreference = AllowHostCalls); diff --git a/src/vm/arm/stubs.cpp b/src/vm/arm/stubs.cpp index 342c73b0d0..42f56a6da7 100644 --- a/src/vm/arm/stubs.cpp +++ b/src/vm/arm/stubs.cpp @@ -494,6 +494,7 @@ void StompWriteBarrierEphemeral(void) #ifndef CROSSGEN_COMPILE void LazyMachState::unwindLazyState(LazyMachState* baseState, MachState* unwoundstate, + DWORD threadId, int funCallDepth, HostCallPreference hostCallPreference) { diff --git a/src/vm/arm64/gmscpu.h b/src/vm/arm64/gmscpu.h index 9105103395..996ddc5e40 100644 --- a/src/vm/arm64/gmscpu.h +++ b/src/vm/arm64/gmscpu.h @@ -42,6 +42,7 @@ struct LazyMachState : public MachState{ void setLazyStateFromUnwind(MachState* copy); static void unwindLazyState(LazyMachState* baseState, MachState* lazyState, + DWORD threadId, int funCallDepth = 1, HostCallPreference hostCallPreference = AllowHostCalls); }; diff --git a/src/vm/arm64/stubs.cpp b/src/vm/arm64/stubs.cpp index 52fdc0ead8..c3d8bc0504 100644 --- a/src/vm/arm64/stubs.cpp +++ b/src/vm/arm64/stubs.cpp @@ -271,6 +271,7 @@ static BYTE gLoadFromLabelIF[sizeof(LoadFromLabelInstructionFormat)]; #ifndef CROSSGEN_COMPILE void LazyMachState::unwindLazyState(LazyMachState* baseState, MachState* unwoundstate, + DWORD threadId, int funCallDepth, HostCallPreference hostCallPreference) { diff --git a/src/vm/frames.cpp b/src/vm/frames.cpp index f4d96e5f5d..0a2fe2c55d 100644 --- a/src/vm/frames.cpp +++ b/src/vm/frames.cpp @@ -1823,6 +1823,7 @@ BOOL HelperMethodFrame::InsureInit(bool initialInit, // Work with a copy so that we only write the values once. // this avoids race conditions. LazyMachState* lazy = &m_MachState; + DWORD threadId = m_pThread->GetOSThreadId(); MachState unwound; if (!initialInit && @@ -1832,6 +1833,7 @@ BOOL HelperMethodFrame::InsureInit(bool initialInit, LazyMachState::unwindLazyState( lazy, &unwound, + threadId, 0, hostCallPreference); @@ -1859,12 +1861,12 @@ BOOL HelperMethodFrame::InsureInit(bool initialInit, (m_Attribs & Frame::FRAME_ATTR_CAPTURE_DEPTH_2) != 0) { // explictly told depth - LazyMachState::unwindLazyState(lazy, &unwound, 2); + LazyMachState::unwindLazyState(lazy, &unwound, threadId, 2); } else { // True FCall - LazyMachState::unwindLazyState(lazy, &unwound, 1); + LazyMachState::unwindLazyState(lazy, &unwound, threadId, 1); } _ASSERTE(unwound.isValid()); diff --git a/src/vm/i386/gmscpu.h b/src/vm/i386/gmscpu.h index 202ded593f..33d3293d33 100644 --- a/src/vm/i386/gmscpu.h +++ b/src/vm/i386/gmscpu.h @@ -99,6 +99,7 @@ struct LazyMachState : public MachState { void setLazyStateFromUnwind(MachState* copy); static void unwindLazyState(LazyMachState* baseState, MachState* lazyState, + DWORD threadId, int funCallDepth = 1, HostCallPreference hostCallPreference = AllowHostCalls); diff --git a/src/vm/i386/gmsx86.cpp b/src/vm/i386/gmsx86.cpp index 6badea0af9..cb713612de 100644 --- a/src/vm/i386/gmsx86.cpp +++ b/src/vm/i386/gmsx86.cpp @@ -339,6 +339,7 @@ static bool shouldEnterCall(PTR_BYTE ip) { // void LazyMachState::unwindLazyState(LazyMachState* baseState, MachState* lazyState, + DWORD threadId, int funCallDepth /* = 1 */, HostCallPreference hostCallPreference /* = (HostCallPreference)(-1) */) { |