Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4c37642
Initial pass where names all changed
davidwrighton Feb 4, 2025
53cf3f4
Convert back to using member functions on Frame to reduce the delta s…
davidwrighton Feb 4, 2025
7fb5c3a
Handle more multi-arch scenarios
davidwrighton Feb 4, 2025
8fedbb6
Rename FrameType to FrameIdentifier
davidwrighton Feb 4, 2025
589263c
Rename the GetType api I added on Frame to GetFrameIdentifier which i…
davidwrighton Feb 4, 2025
93f81b4
Merge branch 'main' of https://github.com/dotnet/runtime into UseEnum…
davidwrighton Feb 5, 2025
496472e
Fix issues on more architectures
davidwrighton Feb 5, 2025
115d235
Fix issues found in testing
davidwrighton Feb 5, 2025
e3cfc5a
Remove GS Cookies
davidwrighton Feb 5, 2025
967934c
Get rid of FrameBase
davidwrighton Feb 6, 2025
b34284f
Merge branch 'main' of https://github.com/dotnet/runtime into UseEnum…
davidwrighton Feb 6, 2025
dc2464d
Fix build errors
davidwrighton Feb 6, 2025
7fe3e81
Fix windows arm64 build failure
davidwrighton Feb 6, 2025
ba80e02
Fix issues noted in X86 testing
davidwrighton Feb 6, 2025
e20b775
Merge branch 'main' of https://github.com/dotnet/runtime into UseEnum…
davidwrighton Feb 6, 2025
8577534
Most of Jan's feedback
davidwrighton Feb 7, 2025
a7d8057
Convert to switch statements
davidwrighton Feb 7, 2025
c01630f
Use UNREACHABLE to potentially make stuff faster
davidwrighton Feb 7, 2025
0cbc419
Address more feedback
davidwrighton Feb 7, 2025
cc5d9ed
Hopefully final nits
davidwrighton Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/coreclr/debug/daccess/dacdbiimplstackwalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ void DacDbiInterfaceImpl::EnumerateInternalFrames(VMPTR_Thread
// it. In this case, pMD will remain NULL.
EX_TRY_ALLOW_DATATARGET_MISSING_MEMORY
{
if (pFrame->GetVTablePtr() == ComMethodFrame::GetMethodFrameVPtr())
if (pFrame->GetFrameIdentifier() == FrameIdentifier::ComMethodFrame)
{
ComMethodFrame * pCOMFrame = dac_cast<PTR_ComMethodFrame>(pFrame);
PTR_VOID pUnkStackSlot = pCOMFrame->GetPointerToArguments();
Expand Down Expand Up @@ -1142,7 +1142,7 @@ CorDebugInternalFrameType DacDbiInterfaceImpl::GetInternalFrameType(Frame * pFra
}
else if (ft == Frame::TYPE_EXIT)
{
if ((pFrame->GetVTablePtr() != InlinedCallFrame::GetMethodFrameVPtr()) ||
if ((pFrame->GetFrameIdentifier() != FrameIdentifier::InlinedCallFrame) ||
InlinedCallFrame::FrameHasActiveCall(pFrame))
{
resultType = STUBFRAME_M2U;
Expand All @@ -1153,7 +1153,7 @@ CorDebugInternalFrameType DacDbiInterfaceImpl::GetInternalFrameType(Frame * pFra

case Frame::TT_M2U:
// Refer to the comment in DebuggerWalkStackProc() for StubDispatchFrame.
if (pFrame->GetVTablePtr() != StubDispatchFrame::GetMethodFrameVPtr())
if (pFrame->GetFrameIdentifier() != FrameIdentifier::StubDispatchFrame)
{
if (it == Frame::INTERCEPTION_SECURITY)
{
Expand Down
253 changes: 253 additions & 0 deletions src/coreclr/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16799,4 +16799,257 @@ void Debugger::ExternalMethodFixupNextStep(PCODE address)
}
#endif //DACCESS_COMPILE

unsigned FuncEvalFrame::GetFrameAttribs_Impl(void)
{
LIMITED_METHOD_DAC_CONTRACT;

if (GetDebuggerEval()->m_evalDuringException)
{
return FRAME_ATTR_NONE;
}
else
{
return FRAME_ATTR_RESUMABLE; // Treat the next frame as the top frame.
}
}

TADDR FuncEvalFrame::GetReturnAddressPtr_Impl()
{
LIMITED_METHOD_DAC_CONTRACT;

if (GetDebuggerEval()->m_evalDuringException)
{
return (TADDR)NULL;
}
else
{
return PTR_HOST_MEMBER_TADDR(FuncEvalFrame, this, m_ReturnAddress);
}
}

//
// This updates the register display for a FuncEvalFrame.
//
void FuncEvalFrame::UpdateRegDisplay_Impl(const PREGDISPLAY pRD, bool updateFloats)
{
SUPPORTS_DAC;
DebuggerEval * pDE = GetDebuggerEval();

// No context to update if we're doing a func eval from within exception processing.
if (pDE->m_evalDuringException)
{
return;
}

#ifndef FEATURE_EH_FUNCLETS
// Reset pContext; it's only valid for active (top-most) frame.
pRD->pContext = NULL;
#endif // !FEATURE_EH_FUNCLETS


#ifdef TARGET_X86
// Update all registers in the reg display from the CONTEXT we stored when the thread was hijacked for this func
// eval. We have to update all registers, not just the callee saved registers, because we can hijack a thread at any
// point for a func eval, not just at a call site.
pRD->SetEdiLocation(&(pDE->m_context.Edi));
pRD->SetEsiLocation(&(pDE->m_context.Esi));
pRD->SetEbxLocation(&(pDE->m_context.Ebx));
pRD->SetEdxLocation(&(pDE->m_context.Edx));
pRD->SetEcxLocation(&(pDE->m_context.Ecx));
pRD->SetEaxLocation(&(pDE->m_context.Eax));
pRD->SetEbpLocation(&(pDE->m_context.Ebp));
pRD->PCTAddr = GetReturnAddressPtr();

#ifdef FEATURE_EH_FUNCLETS

pRD->IsCallerContextValid = FALSE;
pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary.

pRD->pCurrentContext->Eip = *PTR_PCODE(pRD->PCTAddr);
pRD->pCurrentContext->Esp = (DWORD)GetSP(&pDE->m_context);

SyncRegDisplayToCurrentContext(pRD);

#else // FEATURE_EH_FUNCLETS

pRD->ControlPC = *PTR_PCODE(pRD->PCTAddr);
pRD->SP = (DWORD)GetSP(&pDE->m_context);

#endif // FEATURE_EH_FUNCLETS

#elif defined(TARGET_AMD64)
pRD->IsCallerContextValid = FALSE;
pRD->IsCallerSPValid = FALSE; // Don't add usage of this flag. This is only temporary.

memcpy(pRD->pCurrentContext, &(pDE->m_context), sizeof(CONTEXT));

pRD->pCurrentContextPointers->Rax = &(pDE->m_context.Rax);
pRD->pCurrentContextPointers->Rcx = &(pDE->m_context.Rcx);
pRD->pCurrentContextPointers->Rdx = &(pDE->m_context.Rdx);
pRD->pCurrentContextPointers->R8 = &(pDE->m_context.R8);
pRD->pCurrentContextPointers->R9 = &(pDE->m_context.R9);
pRD->pCurrentContextPointers->R10 = &(pDE->m_context.R10);
pRD->pCurrentContextPointers->R11 = &(pDE->m_context.R11);

pRD->pCurrentContextPointers->Rbx = &(pDE->m_context.Rbx);
pRD->pCurrentContextPointers->Rsi = &(pDE->m_context.Rsi);
pRD->pCurrentContextPointers->Rdi = &(pDE->m_context.Rdi);
pRD->pCurrentContextPointers->Rbp = &(pDE->m_context.Rbp);
pRD->pCurrentContextPointers->R12 = &(pDE->m_context.R12);
pRD->pCurrentContextPointers->R13 = &(pDE->m_context.R13);
pRD->pCurrentContextPointers->R14 = &(pDE->m_context.R14);
pRD->pCurrentContextPointers->R15 = &(pDE->m_context.R15);

// SyncRegDisplayToCurrentContext() sets the pRD->SP and pRD->ControlPC on AMD64.
SyncRegDisplayToCurrentContext(pRD);

#elif defined(TARGET_ARM)
pRD->IsCallerContextValid = FALSE;
pRD->IsCallerSPValid = FALSE; // Don't add usage of this flag. This is only temporary.

memcpy(pRD->pCurrentContext, &(pDE->m_context), sizeof(T_CONTEXT));

pRD->pCurrentContextPointers->R4 = &(pDE->m_context.R4);
pRD->pCurrentContextPointers->R5 = &(pDE->m_context.R5);
pRD->pCurrentContextPointers->R6 = &(pDE->m_context.R6);
pRD->pCurrentContextPointers->R7 = &(pDE->m_context.R7);
pRD->pCurrentContextPointers->R8 = &(pDE->m_context.R8);
pRD->pCurrentContextPointers->R9 = &(pDE->m_context.R9);
pRD->pCurrentContextPointers->R10 = &(pDE->m_context.R10);
pRD->pCurrentContextPointers->R11 = &(pDE->m_context.R11);
pRD->pCurrentContextPointers->Lr = &(pDE->m_context.Lr);

pRD->volatileCurrContextPointers.R0 = &(pDE->m_context.R0);
pRD->volatileCurrContextPointers.R1 = &(pDE->m_context.R1);
pRD->volatileCurrContextPointers.R2 = &(pDE->m_context.R2);
pRD->volatileCurrContextPointers.R3 = &(pDE->m_context.R3);
pRD->volatileCurrContextPointers.R12 = &(pDE->m_context.R12);

SyncRegDisplayToCurrentContext(pRD);

#elif defined(TARGET_ARM64)
pRD->IsCallerContextValid = FALSE;
pRD->IsCallerSPValid = FALSE; // Don't add usage of this flag. This is only temporary.

memcpy(pRD->pCurrentContext, &(pDE->m_context), sizeof(T_CONTEXT));

pRD->pCurrentContextPointers->X19 = &(pDE->m_context.X19);
pRD->pCurrentContextPointers->X20 = &(pDE->m_context.X20);
pRD->pCurrentContextPointers->X21 = &(pDE->m_context.X21);
pRD->pCurrentContextPointers->X22 = &(pDE->m_context.X22);
pRD->pCurrentContextPointers->X23 = &(pDE->m_context.X23);
pRD->pCurrentContextPointers->X24 = &(pDE->m_context.X24);
pRD->pCurrentContextPointers->X25 = &(pDE->m_context.X25);
pRD->pCurrentContextPointers->X26 = &(pDE->m_context.X26);
pRD->pCurrentContextPointers->X27 = &(pDE->m_context.X27);
pRD->pCurrentContextPointers->X28 = &(pDE->m_context.X28);
pRD->pCurrentContextPointers->Lr = &(pDE->m_context.Lr);
pRD->pCurrentContextPointers->Fp = &(pDE->m_context.Fp);

pRD->volatileCurrContextPointers.X0 = &(pDE->m_context.X0);
pRD->volatileCurrContextPointers.X1 = &(pDE->m_context.X1);
pRD->volatileCurrContextPointers.X2 = &(pDE->m_context.X2);
pRD->volatileCurrContextPointers.X3 = &(pDE->m_context.X3);
pRD->volatileCurrContextPointers.X4 = &(pDE->m_context.X4);
pRD->volatileCurrContextPointers.X5 = &(pDE->m_context.X5);
pRD->volatileCurrContextPointers.X6 = &(pDE->m_context.X6);
pRD->volatileCurrContextPointers.X7 = &(pDE->m_context.X7);
pRD->volatileCurrContextPointers.X8 = &(pDE->m_context.X8);
pRD->volatileCurrContextPointers.X9 = &(pDE->m_context.X9);
pRD->volatileCurrContextPointers.X10 = &(pDE->m_context.X10);
pRD->volatileCurrContextPointers.X11 = &(pDE->m_context.X11);
pRD->volatileCurrContextPointers.X12 = &(pDE->m_context.X12);
pRD->volatileCurrContextPointers.X13 = &(pDE->m_context.X13);
pRD->volatileCurrContextPointers.X14 = &(pDE->m_context.X14);
pRD->volatileCurrContextPointers.X15 = &(pDE->m_context.X15);
pRD->volatileCurrContextPointers.X16 = &(pDE->m_context.X16);
pRD->volatileCurrContextPointers.X17 = &(pDE->m_context.X17);

SyncRegDisplayToCurrentContext(pRD);
#elif defined(TARGET_RISCV64)
pRD->IsCallerContextValid = FALSE;
pRD->IsCallerSPValid = FALSE; // Don't add usage of this flag. This is only temporary.

memcpy(pRD->pCurrentContext, &(pDE->m_context), sizeof(T_CONTEXT));

pRD->pCurrentContextPointers->S1 = &(pDE->m_context.S1);
pRD->pCurrentContextPointers->S2 = &(pDE->m_context.S2);
pRD->pCurrentContextPointers->S3 = &(pDE->m_context.S3);
pRD->pCurrentContextPointers->S4 = &(pDE->m_context.S4);
pRD->pCurrentContextPointers->S5 = &(pDE->m_context.S5);
pRD->pCurrentContextPointers->S6 = &(pDE->m_context.S6);
pRD->pCurrentContextPointers->S7 = &(pDE->m_context.S7);
pRD->pCurrentContextPointers->S8 = &(pDE->m_context.S8);
pRD->pCurrentContextPointers->S9 = &(pDE->m_context.S9);
pRD->pCurrentContextPointers->S10 = &(pDE->m_context.S10);
pRD->pCurrentContextPointers->S11 = &(pDE->m_context.S11);
pRD->pCurrentContextPointers->Fp = &(pDE->m_context.Fp);
pRD->pCurrentContextPointers->Gp = &(pDE->m_context.Gp);
pRD->pCurrentContextPointers->Tp = &(pDE->m_context.Tp);
pRD->pCurrentContextPointers->Ra = &(pDE->m_context.Ra);

pRD->volatileCurrContextPointers.R0 = &(pDE->m_context.R0);
pRD->volatileCurrContextPointers.A0 = &(pDE->m_context.A0);
pRD->volatileCurrContextPointers.A1 = &(pDE->m_context.A1);
pRD->volatileCurrContextPointers.A2 = &(pDE->m_context.A2);
pRD->volatileCurrContextPointers.A3 = &(pDE->m_context.A3);
pRD->volatileCurrContextPointers.A4 = &(pDE->m_context.A4);
pRD->volatileCurrContextPointers.A5 = &(pDE->m_context.A5);
pRD->volatileCurrContextPointers.A6 = &(pDE->m_context.A6);
pRD->volatileCurrContextPointers.A7 = &(pDE->m_context.A7);
pRD->volatileCurrContextPointers.T0 = &(pDE->m_context.T0);
pRD->volatileCurrContextPointers.T1 = &(pDE->m_context.T1);
pRD->volatileCurrContextPointers.T2 = &(pDE->m_context.T2);
pRD->volatileCurrContextPointers.T3 = &(pDE->m_context.T3);
pRD->volatileCurrContextPointers.T4 = &(pDE->m_context.T4);
pRD->volatileCurrContextPointers.T5 = &(pDE->m_context.T5);
pRD->volatileCurrContextPointers.T6 = &(pDE->m_context.T6);

SyncRegDisplayToCurrentContext(pRD);
#elif defined(TARGET_LOONGARCH64)
pRD->IsCallerContextValid = FALSE;
pRD->IsCallerSPValid = FALSE; // Don't add usage of this flag. This is only temporary.

memcpy(pRD->pCurrentContext, &(pDE->m_context), sizeof(T_CONTEXT));

pRD->pCurrentContextPointers->S0 = &(pDE->m_context.S0);
pRD->pCurrentContextPointers->S1 = &(pDE->m_context.S1);
pRD->pCurrentContextPointers->S2 = &(pDE->m_context.S2);
pRD->pCurrentContextPointers->S3 = &(pDE->m_context.S3);
pRD->pCurrentContextPointers->S4 = &(pDE->m_context.S4);
pRD->pCurrentContextPointers->S5 = &(pDE->m_context.S5);
pRD->pCurrentContextPointers->S6 = &(pDE->m_context.S6);
pRD->pCurrentContextPointers->S7 = &(pDE->m_context.S7);
pRD->pCurrentContextPointers->S8 = &(pDE->m_context.S8);
pRD->pCurrentContextPointers->Tp = &(pDE->m_context.Tp);
pRD->pCurrentContextPointers->Fp = &(pDE->m_context.Fp);
pRD->pCurrentContextPointers->Ra = &(pDE->m_context.Ra);

pRD->volatileCurrContextPointers.R0 = &(pDE->m_context.R0);
pRD->volatileCurrContextPointers.A0 = &(pDE->m_context.A0);
pRD->volatileCurrContextPointers.A1 = &(pDE->m_context.A1);
pRD->volatileCurrContextPointers.A2 = &(pDE->m_context.A2);
pRD->volatileCurrContextPointers.A3 = &(pDE->m_context.A3);
pRD->volatileCurrContextPointers.A4 = &(pDE->m_context.A4);
pRD->volatileCurrContextPointers.A5 = &(pDE->m_context.A5);
pRD->volatileCurrContextPointers.A6 = &(pDE->m_context.A6);
pRD->volatileCurrContextPointers.A7 = &(pDE->m_context.A7);
pRD->volatileCurrContextPointers.T0 = &(pDE->m_context.T0);
pRD->volatileCurrContextPointers.T1 = &(pDE->m_context.T1);
pRD->volatileCurrContextPointers.T2 = &(pDE->m_context.T2);
pRD->volatileCurrContextPointers.T3 = &(pDE->m_context.T3);
pRD->volatileCurrContextPointers.T4 = &(pDE->m_context.T4);
pRD->volatileCurrContextPointers.T5 = &(pDE->m_context.T5);
pRD->volatileCurrContextPointers.T6 = &(pDE->m_context.T6);
pRD->volatileCurrContextPointers.T7 = &(pDE->m_context.T7);
pRD->volatileCurrContextPointers.T8 = &(pDE->m_context.T8);
pRD->volatileCurrContextPointers.X0 = &(pDE->m_context.X0);

SyncRegDisplayToCurrentContext(pRD);

#else
PORTABILITY_ASSERT("FuncEvalFrame::UpdateRegDisplay is not implemented on this platform.");
#endif
}

#endif //DEBUGGING_SUPPORTED
Loading
Loading