-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[NativeAOT] Do not overwrite throw frame with first rethrow frame #123763
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug in NativeAOT where exception stack traces incorrectly showed the location of a throw; rethrow statement instead of the original throw location. The fix aligns NativeAOT's behavior with CoreCLR by skipping stack frame recording during rethrow operations, preserving the original throw location.
Changes:
- Modified
AppendStackIPto remove theisFirstRethrowFrameparameter and the logic that overwrote stack frames during rethrows - Updated
AppendExceptionStackFrameto skip callingAppendStackIPentirely whenisFirstRethrowFrameis true
janvorli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
|
Fixes #107507? |
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
LGTM once runtime-nativeaot-outerloop shows no regressions related to this change. |
|
/ba-g infrastructure timeouts |
Currently in NativeAOT, we overwrite the stack trace frame before a rethrow with the rethrow frame. This means that for the following code:
The exception stacktrace includes
throw new Exceptionandthrow, as opposed tothrow new ExceptionandTest2(). This was spotted as a bug in #9518 and fixed in dotnet/coreclr#16464; the corresponding coreclr code isruntime/src/coreclr/vm/exceptionhandling.cpp
Line 2992 in 59b270c
Fixes #107507?