#define ASSERTE_ALL_BUILDS(expr) _ASSERTE_ALL_BUILDS((expr))
#ifdef TARGET_UNIX
-#define NO_HOSTING_API_FRAME_ADDRESS ((void*)ULONG_PTR_MAX)
-void* g_hostingApiFrameAddress = NO_HOSTING_API_FRAME_ADDRESS;
+#define NO_HOSTING_API_RETURN_ADDRESS ((void*)ULONG_PTR_MAX)
+void* g_hostingApiReturnAddress = NO_HOSTING_API_RETURN_ADDRESS;
class HostingApiFrameHolder
{
public:
- HostingApiFrameHolder(void* frameAddress)
+ HostingApiFrameHolder(void* returnAddress)
{
- g_hostingApiFrameAddress = frameAddress;
+ g_hostingApiReturnAddress = returnAddress;
}
~HostingApiFrameHolder()
{
- g_hostingApiFrameAddress = NO_HOSTING_API_FRAME_ADDRESS;
+ g_hostingApiReturnAddress = NO_HOSTING_API_RETURN_ADDRESS;
}
};
#endif // TARGET_UNIX
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
+NOINLINE
DLLEXPORT
int coreclr_initialize(
const char* exePath,
host_runtime_contract* hostContract = nullptr;
#ifdef TARGET_UNIX
- HostingApiFrameHolder apiFrameHolder(__builtin_frame_address(0));
+ HostingApiFrameHolder apiFrameHolder(_ReturnAddress());
#endif
ConvertConfigPropertiesToUnicode(
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
extern "C"
+NOINLINE
DLLEXPORT
int coreclr_execute_assembly(
void* hostHandle,
*exitCode = -1;
#ifdef TARGET_UNIX
- HostingApiFrameHolder apiFrameHolder(__builtin_frame_address(0));
+ HostingApiFrameHolder apiFrameHolder(_ReturnAddress());
#endif
ICLRRuntimeHost4* host = reinterpret_cast<ICLRRuntimeHost4*>(hostHandle);
EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
}
-extern void* g_hostingApiFrameAddress;
+extern void* g_hostingApiReturnAddress;
//---------------------------------------------------------------------------------------
//
STRESS_LOG2(LF_EH, LL_INFO100, "Processing exception at native frame: IP = %p, SP = %p \n", controlPc, sp);
// Consider the exception unhandled if the unwinding cannot proceed further or if it went past the coreclr_initialize or coreclr_execute_assembly
- if ((controlPc == 0) || (sp > (UINT_PTR)g_hostingApiFrameAddress))
+ if ((controlPc == 0) || (controlPc == (UINT_PTR)g_hostingApiReturnAddress))
{
if (!GetThread()->HasThreadStateNC(Thread::TSNC_ProcessedUnhandledException))
{
return uControlPc;
}
+extern void* g_hostingApiReturnAddress;
+
// static
UINT_PTR Thread::VirtualUnwindToFirstManagedCallFrame(T_CONTEXT* pContext)
{
uControlPc = GetIP(pContext);
- if (uControlPc == 0)
+ if ((uControlPc == 0) || (uControlPc == (PCODE)g_hostingApiReturnAddress))
{
+ uControlPc = 0;
break;
}
#endif // !TARGET_UNIX