Skip to content

Commit

Permalink
Fix NativeAOT unhandled exception stack trace
Browse files Browse the repository at this point in the history
The recent change to add a new exception handling mechanism to coreclr
has broken stack traces on unhandled exceptions in nativeaot.

This change fixes it by reverting the part of the change that caused the
problem and that turned out to not to be needed for the new exception
handling either.

Close dotnet#91298
  • Loading branch information
janvorli committed Aug 31, 2023
1 parent 87f3817 commit 0947cc2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -708,14 +708,14 @@ private static void DispatchEx(scoped ref StackFrameIterator frameIter, ref ExIn
uint startIdx = MaxTryRegionIdx;
for (; isValid; isValid = frameIter.Next(&startIdx, &unwoundReversePInvoke))
{
prevControlPC = frameIter.ControlPC;
prevOriginalPC = frameIter.OriginalControlPC;

// For GC stackwalking, we'll happily walk across native code blocks, but for EH dispatch, we
// disallow dispatching exceptions across native code.
if (unwoundReversePInvoke)
break;

prevControlPC = frameIter.ControlPC;
prevOriginalPC = frameIter.OriginalControlPC;

DebugScanCallFrame(exInfo._passNumber, frameIter.ControlPC, frameIter.SP);

UpdateStackTrace(exceptionObj, exInfo._frameIter.FramePointer, (IntPtr)frameIter.OriginalControlPC, frameIter.SP, ref isFirstRethrowFrame, ref prevFramePtr, ref isFirstFrame, ref exInfo);
Expand Down

0 comments on commit 0947cc2

Please sign in to comment.