Skip to content

Commit 4daefae

Browse files
authored
Reunification of ExInfo (#114591)
* Reunification of ExInfo - Move the static methods from the ExceptionTracker to the ExInfo - Remove the ExceptionTracker completely - Merge the ExceptionTrackerBase into the ExInfo * win-x64 build fix
1 parent 159f40e commit 4daefae

30 files changed

+361
-412
lines changed

src/coreclr/debug/daccess/dacdbiimpl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5141,9 +5141,9 @@ void DacDbiInterfaceImpl::Hijack(
51415141
CORDB_ADDRESS esp = GetSP(&ctx);
51425142

51435143
//
5144-
// Find out where the OS exception dispatcher has pushed the EXCEPTION_RECORD and CONTEXT. The ExInfo and
5145-
// ExceptionTracker have pointers to these data structures, but when we get the unhandled exception
5146-
// notification, the OS exception dispatcher is no longer on the stack, so these pointers are no longer
5144+
// Find out where the OS exception dispatcher has pushed the EXCEPTION_RECORD and CONTEXT. The ExInfo
5145+
// has pointers to these data structures, but when we get the unhandled exception notification,
5146+
// the OS exception dispatcher is no longer on the stack, so these pointers are no longer
51475147
// valid. We need to either update these pointers in the ExInfo/ExcepionTracker, or reuse the stack
51485148
// space used by the OS exception dispatcher. We are using the latter approach here.
51495149
//
@@ -5158,8 +5158,8 @@ void DacDbiInterfaceImpl::Hijack(
51585158
// The managed exception may not be related to the unhandled exception for which we are trying to
51595159
// hijack. An example would be when a thread hits a managed exception, VS tries to do func eval on
51605160
// the thread, but the func eval causes an unhandled exception (e.g. AV in mscorwks.dll). In this
5161-
// case, the pointers stored on the ExInfo/ExceptionTracker are closer to the root than the current
5162-
// SP of the thread. The check below makes sure we don't reuse the pointers in this case.
5161+
// case, the pointers stored on the ExInfo are closer to the root than the current SP of the thread.
5162+
// The check below makes sure we don't reuse the pointers in this case.
51635163
if (espOSContext < esp)
51645164
{
51655165
SafeWriteStructOrThrow(espOSContext, &ctx);

src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
#include "interpexec.h"
2424
#endif // FEATURE_INTERPRETER
2525

26+
#ifdef FEATURE_EH_FUNCLETS
27+
#include "exinfo.h"
28+
#endif // FEATURE_EH_FUNCLETS
29+
2630
typedef IDacDbiInterface::StackWalkHandle StackWalkHandle;
2731

2832

@@ -618,9 +622,9 @@ BOOL DacDbiInterfaceImpl::IsMatchingParentFrame(FramePointer fpToCheck, FramePoi
618622

619623
StackFrame sfParent = StackFrame((UINT_PTR)fpParent.GetSPValue());
620624

621-
// Ask the ExceptionTracker to figure out the answer.
625+
// Ask the ExInfo to figure out the answer.
622626
// Don't try to compare the StackFrames/FramePointers ourselves.
623-
return ExceptionTracker::IsUnwoundToTargetParentFrame(sfToCheck, sfParent);
627+
return ExInfo::IsUnwoundToTargetParentFrame(sfToCheck, sfParent);
624628

625629
#else // !FEATURE_EH_FUNCLETS
626630
return FALSE;
@@ -973,25 +977,25 @@ void DacDbiInterfaceImpl::InitParentFrameInfo(CrawlFrame * pCF,
973977
if (pCF->IsFunclet())
974978
{
975979
DWORD dwParentOffset;
976-
StackFrame sfParent = ExceptionTracker::FindParentStackFrameEx(pCF, &dwParentOffset);
980+
StackFrame sfParent = ExInfo::FindParentStackFrameEx(pCF, &dwParentOffset);
977981

978982
//
979983
// For funclets, fpParentOrSelf is the FramePointer of the parent.
980984
// Don't mess around with this FramePointer. The only thing we can do with it is to pass it back
981-
// to the ExceptionTracker when we are checking if a particular frame is the parent frame.
985+
// to the ExInfo when we are checking if a particular frame is the parent frame.
982986
//
983987

984988
pJITFuncData->fpParentOrSelf = FramePointer::MakeFramePointer(sfParent.SP);
985989
pJITFuncData->parentNativeOffset = dwParentOffset;
986990
}
987991
else
988992
{
989-
StackFrame sfSelf = ExceptionTracker::GetStackFrameForParentCheck(pCF);
993+
StackFrame sfSelf = ExInfo::GetStackFrameForParentCheck(pCF);
990994

991995
//
992996
// For non-funclets, fpParentOrSelf is the FramePointer of the current frame itself.
993997
// Don't mess around with this FramePointer. The only thing we can do with it is to pass it back
994-
// to the ExceptionTracker when we are checking if a particular frame is the parent frame.
998+
// to the ExInfo when we are checking if a particular frame is the parent frame.
995999
//
9961000

9971001
pJITFuncData->fpParentOrSelf = FramePointer::MakeFramePointer(sfSelf.SP);

src/coreclr/debug/daccess/dacimpl.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,12 +3420,7 @@ class ClrDataFrame : public IXCLRDataFrame,
34203420
//
34213421
//----------------------------------------------------------------------------
34223422

3423-
#ifdef FEATURE_EH_FUNCLETS
3424-
typedef ExceptionTrackerBase ClrDataExStateType;
3425-
#else // FEATURE_EH_FUNCLETS
34263423
typedef ExInfo ClrDataExStateType;
3427-
#endif // FEATURE_EH_FUNCLETS
3428-
34293424

34303425
class ClrDataExceptionState : public IXCLRDataExceptionState
34313426
{

src/coreclr/debug/daccess/request.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,11 +3287,7 @@ ClrDataAccess::GetNestedExceptionData(CLRDATA_ADDRESS exception, CLRDATA_ADDRESS
32873287

32883288
SOSDacEnter();
32893289

3290-
#ifdef FEATURE_EH_FUNCLETS
3291-
ExceptionTrackerBase *pExData = PTR_ExceptionTrackerBase(TO_TADDR(exception));
3292-
#else
32933290
ExInfo *pExData = PTR_ExInfo(TO_TADDR(exception));
3294-
#endif // FEATURE_EH_FUNCLETS
32953291

32963292
if (!pExData)
32973293
{

src/coreclr/debug/ee/controller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9216,7 +9216,7 @@ bool DebuggerContinuableExceptionBreakpoint::SendEvent(Thread *thread, bool fIpC
92169216
}
92179217

92189218
// On WIN64, by the time we get here the DebuggerExState is gone already.
9219-
// ExceptionTrackers are cleaned up before we resume execution for a handled exception.
9219+
// ExInfos are cleaned up before we resume execution for a handled exception.
92209220
#if !defined(FEATURE_EH_FUNCLETS)
92219221
thread->GetExceptionState()->GetDebuggerState()->SetDebuggerInterceptContext(NULL);
92229222
#endif // !FEATURE_EH_FUNCLETS

src/coreclr/debug/ee/debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8255,7 +8255,7 @@ void Debugger::ManagedExceptionUnwindBegin(Thread *pThread)
82558255
*
82568256
* This function is called by the VM to release any debugger specific information for an
82578257
* exception object. It is called when the VM releases its internal exception stuff, i.e.
8258-
* ExInfo on X86 and ExceptionTracker on WIN64.
8258+
* ExInfo.
82598259
*
82608260
*
82618261
* Parameters:

src/coreclr/debug/ee/frameinfo.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#include "COMToClrCall.h"
1717
#endif
1818

19+
#ifdef FEATURE_EH_FUNCLETS
20+
#include "exinfo.h"
21+
#endif // FEATURE_EH_FUNCLETS
22+
1923
// Get a frame pointer from a RegDisplay.
2024
// This is mostly used for chains and stub frames (i.e. internal frames), where we don't need an exact
2125
// frame pointer. This is why it is okay to use the current SP instead of the caller SP on IA64.
@@ -1310,7 +1314,7 @@ FramePointer GetFramePointerForDebugger(DebuggerFrameData* pData, CrawlFrame* pC
13101314
// frame pointer for the parent method frame. Otherwise we return LEAF_MOST_FRAME. If we are already skipping
13111315
// frames, then we return the current frame pointer for the parent method frame.
13121316
//
1313-
// The return value of this function corresponds to the return value of ExceptionTracker::FindParentStackFrame().
1317+
// The return value of this function corresponds to the return value of ExInfo::FindParentStackFrame().
13141318
// Refer to that function for more information.
13151319
//
13161320
// Arguments:
@@ -1524,7 +1528,7 @@ StackWalkAction DebuggerWalkStackProc(CrawlFrame *pCF, void *data)
15241528
// skipping if the current frame pointer matches fpParent. In either case, clear fpParent, and
15251529
// then check again.
15261530
if ((d->fpParent == ROOT_MOST_FRAME) ||
1527-
ExceptionTracker::IsUnwoundToTargetParentFrame(pCF, ConvertFPToStackFrame(d->fpParent)))
1531+
ExInfo::IsUnwoundToTargetParentFrame(pCF, ConvertFPToStackFrame(d->fpParent)))
15281532
{
15291533
LOG((LF_CORDB, LL_INFO100000, "DWSP: Stopping to skip funclet at 0x%p.\n", d->fpParent.GetSPValue()));
15301534

src/coreclr/debug/inc/dacdbiinterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ class IDacDbiInterface
14771477
//
14781478
// Note:
14791479
// Because of the complexity involved in checking for the parent frame, we should always
1480-
// ask the ExceptionTracker to do it.
1480+
// ask the ExInfo to do it.
14811481
//
14821482

14831483
virtual

src/coreclr/debug/runtimeinfo/datadescriptor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "cdacplatformmetadata.hpp"
1313
#include "methodtable.h"
1414
#include "threads.h"
15+
#include "exinfo.h"
1516

1617
#include "configure.h"
1718

src/coreclr/debug/runtimeinfo/datadescriptor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,8 @@ CDAC_TYPE_END(Exception)
168168

169169
CDAC_TYPE_BEGIN(ExceptionInfo)
170170
CDAC_TYPE_INDETERMINATE(ExceptionInfo)
171-
#if FEATURE_EH_FUNCLETS
172-
CDAC_TYPE_FIELD(ExceptionInfo, /*pointer*/, ThrownObject, offsetof(ExceptionTrackerBase, m_hThrowable))
173-
CDAC_TYPE_FIELD(PreviousNestedInfo, /*pointer*/, PreviousNestedInfo, offsetof(ExceptionTrackerBase, m_pPrevNestedInfo))
174-
#else
175171
CDAC_TYPE_FIELD(ExceptionInfo, /*pointer*/, ThrownObject, offsetof(ExInfo, m_hThrowable))
176172
CDAC_TYPE_FIELD(PreviousNestedInfo, /*pointer*/, PreviousNestedInfo, offsetof(ExInfo, m_pPrevNestedInfo))
177-
#endif
178173
CDAC_TYPE_END(ExceptionInfo)
179174

180175

src/coreclr/vm/dwreport.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#include "utilcode.h"
2424
#include "../dlls/mscorrc/resource.h" // for resource ids
2525

26+
#ifdef FEATURE_EH_FUNCLETS
27+
#include "exinfo.h"
28+
#endif
2629

2730
EFaultRepRetVal DoReportFault(EXCEPTION_POINTERS * pExceptionInfo);
2831

src/coreclr/vm/eedbginterfaceimpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ StackFrame EEDbgInterfaceImpl::FindParentStackFrame(CrawlFrame* pCF)
592592
return StackFrame();
593593

594594
#else // !DACCESS_COMPILE
595-
return ExceptionTracker::FindParentStackFrameForStackWalk(pCF);
595+
return ExInfo::FindParentStackFrameForStackWalk(pCF);
596596

597597
#endif // !DACCESS_COMPILE
598598
}

src/coreclr/vm/eedbginterfaceimpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "eetwain.h"
2222
#include "jitinterface.h"
2323
#include "stubmgr.h"
24+
#include "exinfo.h"
2425

2526
#include "eedbginterface.h"
2627
#include "debugdebugger.h"

src/coreclr/vm/eetwain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ size_t EECodeManager::GetCallerSp( PREGDISPLAY pRD )
948948
} CONTRACTL_END;
949949

950950
// Don't add usage of this field. This is only temporary.
951-
// See ExceptionTracker::InitializeCrawlFrame() for more information.
951+
// See ExInfo::InitializeCrawlFrame() for more information.
952952
if (!pRD->IsCallerSPValid)
953953
{
954954
ExecutionManager::GetDefaultCodeManager()->EnsureCallerContextIsValid(pRD, NULL);

src/coreclr/vm/eventtrace.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "finalizerthread.h"
3232
#include "clrversion.h"
3333
#include "typestring.h"
34+
#include "exinfo.h"
3435

3536
#define Win32EventWrite EventWrite
3637

@@ -2836,11 +2837,7 @@ VOID ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownExcept
28362837
gc.innerExceptionObj = ((EXCEPTIONREF)gc.exceptionObj)->GetInnerException();
28372838

28382839
ThreadExceptionState *pExState = pThread->GetExceptionState();
2839-
#ifndef FEATURE_EH_FUNCLETS
28402840
PTR_ExInfo pExInfo = NULL;
2841-
#else
2842-
PTR_ExceptionTrackerBase pExInfo = NULL;
2843-
#endif //!FEATURE_EH_FUNCLETS
28442841
pExInfo = pExState->GetCurrentExceptionTracker();
28452842
_ASSERTE(pExInfo != NULL);
28462843
bIsNestedException = (pExInfo->GetPreviousExceptionTracker() != NULL);

src/coreclr/vm/excep.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6050,7 +6050,7 @@ AdjustContextForJITHelpers(
60506050
// instruction where the call will return.
60516051
//
60526052
// On ARM, just like we perform ControlPC adjustment
6053-
// during exception dispatch (refer to ExceptionTracker::InitializeCrawlFrame),
6053+
// during exception dispatch (refer to ExInfo::InitializeCrawlFrame),
60546054
// we will need to perform the corresponding adjustment of IP
60556055
// we got from unwind above, so as to indicate that the AV
60566056
// happened "before" the call to the writebarrier and not at
@@ -8371,13 +8371,8 @@ BOOL IsThrowableThreadAbortException(OBJECTREF oThrowable)
83718371
// The caller can also specify the starting EHTracker to walk the list from.
83728372
// If not specified, this will default to the current exception tracker active
83738373
// on the thread.
8374-
#if defined(FEATURE_EH_FUNCLETS)
8375-
PTR_ExceptionTrackerBase GetEHTrackerForPreallocatedException(OBJECTREF oPreAllocThrowable,
8376-
PTR_ExceptionTrackerBase pStartingEHTracker)
8377-
#else
83788374
PTR_ExInfo GetEHTrackerForPreallocatedException(OBJECTREF oPreAllocThrowable,
83798375
PTR_ExInfo pStartingEHTracker)
8380-
#endif
83818376
{
83828377
CONTRACTL
83838378
{
@@ -8392,11 +8387,7 @@ PTR_ExInfo GetEHTrackerForPreallocatedException(OBJECTREF oPreAllocThrowable,
83928387
CONTRACTL_END;
83938388

83948389
// Get the reference to the current exception tracker
8395-
#if defined(FEATURE_EH_FUNCLETS)
8396-
PTR_ExceptionTrackerBase pEHTracker = (pStartingEHTracker != NULL) ? pStartingEHTracker : GetThread()->GetExceptionState()->GetCurrentExceptionTracker();
8397-
#else
83988390
PTR_ExInfo pEHTracker = (pStartingEHTracker != NULL) ? pStartingEHTracker : GetThread()->GetExceptionState()->GetCurrentExceptionTracker();
8399-
#endif
84008391

84018392
BOOL fFoundTracker = FALSE;
84028393

@@ -8468,13 +8459,8 @@ PTR_EHWatsonBucketTracker GetWatsonBucketTrackerForPreallocatedException(OBJECTR
84688459
{
84698460
// Find the reference to the exception tracker corresponding to the preallocated exception,
84708461
// starting the search from the current exception tracker (2nd arg of NULL specifies that).
8471-
#if defined(FEATURE_EH_FUNCLETS)
8472-
PTR_ExceptionTrackerBase pEHTracker = NULL;
8473-
PTR_ExceptionTrackerBase pPreviousEHTracker = NULL;
8474-
#else
84758462
PTR_ExInfo pEHTracker = NULL;
84768463
PTR_ExInfo pPreviousEHTracker = NULL;
8477-
#endif
84788464

84798465
if (fStartSearchFromPreviousTracker)
84808466
{

0 commit comments

Comments
 (0)