Skip to content

Commit 67cbaf4

Browse files
committed
Revert "Remove main entrypoints checks"
This reverts commit 43c19bf.
1 parent 01f8a6b commit 67cbaf4

File tree

11 files changed

+26
-18
lines changed

11 files changed

+26
-18
lines changed

src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::UnwindStackWalkFrame(StackWalkHan
307307
continue;
308308
}
309309

310-
// Runtime-invoked UCO entrypoint method (Environment.CallEntryPoint)
311-
if (pMD == g_pEnvironmentCallEntryPointMethodDesc)
310+
// Runtime-invoked UCO entrypoint methods (Environment.CallEntryPoint, Thread.StartCallback, GC.RunFinalizers)
311+
if (pMD == g_pEnvironmentCallEntryPointMethodDesc || pMD == g_pThreadStartCallbackMethodDesc || pMD == g_pGCRunFinalizersMethodDesc)
312312
{
313313
continue;
314314
}
@@ -427,8 +427,8 @@ HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetStackWalkCurrentFrameInfo(Stac
427427
{
428428
ftResult = kManagedExceptionHandlingCodeFrame;
429429
}
430-
// Runtime-invoked UCO entrypoint method (Environment.CallEntryPoint)
431-
else if (pMD == g_pEnvironmentCallEntryPointMethodDesc)
430+
// Runtime-invoked UCO entrypoint methods
431+
else if (pMD == g_pEnvironmentCallEntryPointMethodDesc || pMD == g_pThreadStartCallbackMethodDesc || pMD == g_pGCRunFinalizersMethodDesc)
432432
{
433433
ftResult = kRuntimeEntryPointFrame;
434434
}

src/coreclr/debug/ee/controller.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6776,8 +6776,10 @@ bool DebuggerStepper::IsInterestingFrame(FrameInfo * pFrame)
67766776
return false;
67776777
}
67786778

6779-
// Ignore runtime-invoked UCO entrypoint method (Environment.CallEntryPoint)
6780-
if (pFrame->md == g_pEnvironmentCallEntryPointMethodDesc)
6779+
// Ignore runtime-invoked UCO entrypoint methods
6780+
if (pFrame->md == g_pEnvironmentCallEntryPointMethodDesc ||
6781+
pFrame->md == g_pThreadStartCallbackMethodDesc ||
6782+
pFrame->md == g_pGCRunFinalizersMethodDesc)
67816783
{
67826784
return false;
67836785
}

src/coreclr/inc/dacvars.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pExceptionServicesInternalCallsClass,
126126
DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pStackFrameIteratorClass, ::g_pStackFrameIteratorClass)
127127

128128
DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pEnvironmentCallEntryPointMethodDesc, ::g_pEnvironmentCallEntryPointMethodDesc)
129+
DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pThreadStartCallbackMethodDesc, ::g_pThreadStartCallbackMethodDesc)
130+
DEFINE_DACVAR(UNKNOWN_POINTER_TYPE, dac__g_pGCRunFinalizersMethodDesc, ::g_pGCRunFinalizersMethodDesc)
129131

130132
DEFINE_DACVAR(PTR_SString, SString__s_Empty, SString::s_Empty)
131133

src/coreclr/vm/comsynchronizable.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
#include "utilcode.h"
3232
#endif
3333

34-
MethodDesc* g_pThreadStartCallbackMethodDesc = nullptr;
35-
3634

3735
// For the following helpers, we make no attempt to synchronize. The app developer
3836
// is responsible for managing their own race conditions.

src/coreclr/vm/debugdebugger.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ static StackWalkAction GetStackFramesCallback(CrawlFrame* pCf, VOID* data)
193193
// because we asked the stackwalker for it!
194194
MethodDesc* pFunc = pCf->GetFunction();
195195

196-
if (pFunc != nullptr && pFunc == g_pEnvironmentCallEntryPointMethodDesc)
196+
if (pFunc != nullptr && (pFunc == g_pEnvironmentCallEntryPointMethodDesc ||
197+
pFunc == g_pThreadStartCallbackMethodDesc ||
198+
pFunc == g_pGCRunFinalizersMethodDesc))
197199
{
198200
return SWA_CONTINUE;
199201
}

src/coreclr/vm/eepolicy.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,11 @@ class CallStackLogger
178178

179179
MethodDesc* pMD = pCF->GetFunction();
180180

181-
// Skip Environment.CallEntryPoint so it doesn't appear in
181+
// Skip runtime-invoked UCO entrypoint methods so they don't appear in
182182
// unhandled exception experiences.
183-
if (pMD != nullptr && pMD == g_pEnvironmentCallEntryPointMethodDesc)
183+
if (pMD != nullptr && (pMD == g_pEnvironmentCallEntryPointMethodDesc ||
184+
pMD == g_pThreadStartCallbackMethodDesc ||
185+
pMD == g_pGCRunFinalizersMethodDesc))
184186
{
185187
return SWA_CONTINUE;
186188
}

src/coreclr/vm/exceptionhandling.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#include "exinfo.h"
1919
#include "configuration.h"
2020

21-
extern MethodDesc* g_pThreadStartCallbackMethodDesc;
22-
extern MethodDesc* g_pGCRunFinalizersMethodDesc;
23-
2421
#if defined(TARGET_X86)
2522
#define USE_CURRENT_CONTEXT_IN_FILTER
2623
#endif // TARGET_X86

src/coreclr/vm/finalizerthread.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ CLREvent * FinalizerThread::hEventFinalizerToShutDown = NULL;
3434

3535
HANDLE FinalizerThread::MHandles[kHandleCount];
3636

37-
MethodDesc* g_pGCRunFinalizersMethodDesc = nullptr;
38-
3937
bool FinalizerThread::IsCurrentThreadFinalizer()
4038
{
4139
LIMITED_METHOD_CONTRACT;

src/coreclr/vm/proftoeeinterfaceimpl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8066,9 +8066,12 @@ StackWalkAction ProfilerStackWalkCallback(CrawlFrame *pCf, PROFILER_STACK_WALK_D
80668066
}
80678067

80688068
//
8069-
// Skip runtime-invoked UCO entrypoint method (Environment.CallEntryPoint)
8069+
// Skip runtime-invoked UCO entrypoint methods
80708070
//
8071-
if (pFunc != NULL && pFunc == g_pEnvironmentCallEntryPointMethodDesc)
8071+
if (pFunc != NULL && (
8072+
pFunc == g_pEnvironmentCallEntryPointMethodDesc ||
8073+
pFunc == g_pThreadStartCallbackMethodDesc ||
8074+
pFunc == g_pGCRunFinalizersMethodDesc))
80728075
{
80738076
return SWA_CONTINUE;
80748077
}

src/coreclr/vm/vars.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ GPTR_IMPL(MethodTable, g_pExceptionServicesInternalCallsClass);
113113
GPTR_IMPL(MethodTable, g_pStackFrameIteratorClass);
114114

115115
GPTR_IMPL(MethodDesc, g_pEnvironmentCallEntryPointMethodDesc);
116+
GPTR_IMPL(MethodDesc, g_pThreadStartCallbackMethodDesc);
117+
GPTR_IMPL(MethodDesc, g_pGCRunFinalizersMethodDesc);
116118

117119
GVAL_IMPL_INIT(PTR_WSTR, g_EntryAssemblyPath, NULL);
118120

0 commit comments

Comments
 (0)