Skip to content

Fix issues are stackwalking, and viewing Exception stack walks in the debugger #115405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion src/coreclr/vm/excep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11341,7 +11341,7 @@ void SoftwareExceptionFrame::UpdateRegDisplay_Impl(const PREGDISPLAY pRD, bool u
pRD->IsCallerContextValid = FALSE;
pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary.
#elif defined(TARGET_X86)
#define CALLEE_SAVED_REGISTER(regname) pRD->Set##regname##Location(m_ContextPointers.regname);
#define CALLEE_SAVED_REGISTER(regname) pRD->Set##regname##Location(&m_Context.regname);
ENUM_CALLEE_SAVED_REGISTERS();
#undef CALLEE_SAVED_REGISTER

Expand All @@ -11366,6 +11366,7 @@ void SoftwareExceptionFrame::UpdateContextFromTransitionBlock(TransitionBlock *p
m_Context.Eax = 0;
m_Context.Ecx = pTransitionBlock->m_argumentRegisters.ECX;
m_Context.Edx = pTransitionBlock->m_argumentRegisters.EDX;
#ifdef FEATURE_EH_FUNCLETS
m_ContextPointers.Ecx = &m_Context.Ecx;
m_ContextPointers.Edx = &m_Context.Edx;

Expand All @@ -11374,6 +11375,12 @@ void SoftwareExceptionFrame::UpdateContextFromTransitionBlock(TransitionBlock *p
m_ContextPointers.reg = &m_Context.reg;
ENUM_CALLEE_SAVED_REGISTERS();
#undef CALLEE_SAVED_REGISTER
#else // FEATURE_EH_FUNCLETS
#define CALLEE_SAVED_REGISTER(reg) \
m_Context.reg = pTransitionBlock->m_calleeSavedRegisters.reg;
ENUM_CALLEE_SAVED_REGISTERS();
#undef CALLEE_SAVED_REGISTER
#endif // FEATURE_EH_FUNCLETS

m_Context.Esp = (UINT_PTR)(pTransitionBlock + 1);
m_Context.Eip = pTransitionBlock->m_ReturnAddress;
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/frames.h
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,9 @@ typedef DPTR(class SoftwareExceptionFrame) PTR_SoftwareExceptionFrame;
class SoftwareExceptionFrame : public Frame
{
TADDR m_ReturnAddress;
#if !defined(TARGET_X86) || defined(FEATURE_EH_FUNCLETS)
T_KNONVOLATILE_CONTEXT_POINTERS m_ContextPointers;
#endif
// This T_CONTEXT field needs to be the last field in the class because it is a
// different size between Linux (pal.h) and the Windows cross-DAC (winnt.h).
T_CONTEXT m_Context;
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/vm/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,11 @@ class ExceptionObject : public Object

void GetStackTrace(StackTraceArray & stackTrace, PTRARRAYREF * outKeepaliveArray = NULL) const
{
#ifdef DACCESS_COMPILE
return GetStackTrace(stackTrace, outKeepaliveArray, NULL);
#else
return GetStackTrace(stackTrace, outKeepaliveArray, GetThread());
#endif // DACCESS_COMPILE
}

private:
Expand Down