Skip to content

Conversation

@drodriguez
Copy link
Contributor

In order to generate stack traces when exceptions happen, it seems that VS2017 needs of frame pointers in some of the functions. This recovers a small override that was present up to the introduction of #31986 but only for VS2017.

Without this change crash-in-user-code.swift test fails (because the output doesn't include the stack trace as provided by LLVM exception stack trace capturing), but the test passes with it. In order to not change VS2019 (or other compilers), which succeed at the test already, the fix is gated to only compile in VS2017.

…S2017.

In order to generate stack traces when exceptions happen, it seems that VS2017 needs of frame pointers in some of the functions. This recovers a small override that was present up to the introduction of swiftlang#31986 but only for VS2017.

Without this change crash-in-user-code.swift test fails (because the output doesn't include the stack trace as provided by LLVM exception stack trace capturing), but the test passes with it. In order to not change VS2019 (or other compilers), which succeed at the test already, the fix is gated to only compile in VS2017.
@compnerd
Copy link
Member

I'm not sure I like this solution too much. I think that it might be better to just XFAIL the test on VS2017. This basically is paying runtime costs for a test.

@drodriguez
Copy link
Contributor Author

I'm not sure I like this solution too much. I think that it might be better to just XFAIL the test on VS2017. This basically is paying runtime costs for a test.

While it might look like that, people that run VS2017 will also not see backtraces when the tools hit an exception, and will miss interesting information to report like the command line parameters. I understand that everyone is affected, but one cannot know when an exception will happen, so everyone needs to be considered suspicious.

Also, can we actually XFAIL depending on the compiler? Is there an example of that? Or would that mean changes to inject such information into the test system?

Also, if someone directs me to how to do it, this might only affect to programs that are interpreted (it is a crash in user code, not in the compiler code). If someone knows if the IRGenModule can know if it is being used for interpret mode, that would reduce the affected area a lot.

drodriguez added a commit to drodriguez/swift that referenced this pull request Oct 1, 2020
See also swiftlang#33383 where this problem is better explained.

MSVC doesn't seem to trigger the exception code when no frame pointers are generated. The only thing missing would be for interpreted code to have a more informative crash message.

Add a new LLVM Lit feature with the value of the VisualStudioVersion environment variable (it seems to not change even for minor versions, so it is an easy way to figure out the 2017/2019 difference, even if updates are applied).

Use the new feature in a XFAIL check in the test.
@drodriguez
Copy link
Contributor Author

Abandoned in favor of #34143

@drodriguez drodriguez closed this Oct 1, 2020
@drodriguez drodriguez deleted the vs2017-frame-pointers branch October 1, 2020 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants