Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit c05eeef

Browse files
authored
Delete dead code to support OSes prior to Windows 7 (#17367)
1 parent 42ae2c0 commit c05eeef

17 files changed

+213
-3244
lines changed

src/debug/di/process.cpp

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11582,54 +11582,6 @@ void CordbProcess::HandleSyncCompleteRecieved()
1158211582

1158311583
#ifdef FEATURE_INTEROP_DEBUGGING
1158411584

11585-
// Get a Thread's _user_ starting address (the real starting address may be some
11586-
// OS shim.)
11587-
// This may return NULL for the Async-Break thread.
11588-
void* GetThreadUserStartAddr(const DEBUG_EVENT* pCreateThreadEvent)
11589-
{
11590-
// On Win7 and above, we can trust the lpStartAddress field of the CREATE_THREAD_DEBUG_EVENT
11591-
// to be the user start address (the actual OS start address is an implementation detail that
11592-
// doesn't need to be exposed to users). Note that we are assuming that the target process
11593-
// is running on Win7 if mscordbi is. If we ever have some remoting scenario where the target
11594-
// can run on a different windows machine with a different OS version we will need a way to
11595-
// determine the target's OS version
11596-
if(RunningOnWin7())
11597-
{
11598-
return pCreateThreadEvent->u.CreateThread.lpStartAddress;
11599-
}
11600-
11601-
// On pre-Win7 OSes, we rely on an OS implementation detail to get the real user thread start:
11602-
// it exists in EAX at thread start time.
11603-
// Note that for a brief period of time there was a GetThreadStartInformation API in Longhorn
11604-
// we could use for this, but it was removed during the Longhorn reset.
11605-
HANDLE hThread = pCreateThreadEvent->u.CreateThread.hThread;
11606-
#if defined(DBG_TARGET_X86)
11607-
// Grab the thread's context.
11608-
DT_CONTEXT c;
11609-
c.ContextFlags = DT_CONTEXT_FULL;
11610-
BOOL succ = DbiGetThreadContext(hThread, &c);
11611-
11612-
if (succ)
11613-
{
11614-
return (void*) c.Eax;
11615-
}
11616-
#elif defined(DBG_TARGET_AMD64)
11617-
DT_CONTEXT c;
11618-
c.ContextFlags = DT_CONTEXT_FULL;
11619-
BOOL succ = DbiGetThreadContext(hThread, &c);
11620-
11621-
if (succ)
11622-
{
11623-
return (void*) c.Rcx;
11624-
}
11625-
#else
11626-
PORTABILITY_ASSERT("port GetThreadUserStartAddr");
11627-
#endif
11628-
11629-
return NULL;
11630-
}
11631-
11632-
1163311585
//---------------------------------------------------------------------------------------
1163411586
//
1163511587
// Get (create if needed) the unmanaged thread for an unmanaged debug event.
@@ -11706,7 +11658,7 @@ CordbUnmanagedThread * CordbProcess::GetUnmanagedThreadFromEvent(const DEBUG_EVE
1170611658
UpdateRightSideDCB();
1170711659
if ((this->GetDCB()->m_helperThreadStartAddr != NULL) && (pUnmanagedThread != NULL))
1170811660
{
11709-
void * pStartAddr = GetThreadUserStartAddr(pEvent);
11661+
void * pStartAddr = pEvent->u.CreateThread.lpStartAddress;
1171011662

1171111663
if (pStartAddr == this->GetDCB()->m_helperThreadStartAddr)
1171211664
{

src/debug/ee/debugger.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13525,8 +13525,7 @@ void Debugger::UnhandledHijackWorker(CONTEXT * pContext, EXCEPTION_RECORD * pRec
1352513525
// On Win7 WatsonLastChance returns CONTINUE_SEARCH for unhandled exceptions execpt stack overflow, and
1352613526
// lets OS launch debuggers for us. Before the unhandled exception reaches the OS, CLR UEF has already
1352713527
// processed this unhandled exception. Thus, we should not call into CLR UEF again if it is the case.
13528-
if (RunningOnWin7() &&
13529-
pThread &&
13528+
if (pThread &&
1353013529
(pThread->HasThreadStateNC(Thread::TSNC_ProcessedUnhandledException) ||
1353113530
pThread->HasThreadStateNC(Thread::TSNC_AppDomainContainUnhandled) ||
1353213531
fSOException))

0 commit comments

Comments
 (0)