Skip to content

[strip -ST] Disable runtime stack trace dumping on Darwin when assert… #9311

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 1 commit into from
May 5, 2017

Conversation

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented May 5, 2017

  • Explanation: This PR changes the dladdr based backtraces to only be emitted when the standard library is compiled with assertions enabled. This restores the dladdr backtraces to their original purpose, namely as a tool meant for compiler authors. It additionally has a build system unit test to ensure that no parts of the runtime refer to dladdr. The reason we are doing this is so that we can safely strip -ST the swift standard library.

  • Scope: Without this, a stdlib that has strip -ST performed upon it will print out incorrect backtraces.

  • Radar: rdar://31372220

  • Risk: Minimal. This code only gets triggered upon a program already crashing. So only programs that are already crashing can be affected by a bug in this change. That being said, I think the testing here is relatively comprehensive, so I feel very confidant in this change.

  • Testing: I added compiler tests that verify that we produce correctly formed stack traces when the relevant settings are enabled and that we do not emit any stack traces when they are disabled. I tested with/without stdlib assertions locally and tested with assertions on the bots. The normal bots will double check the no-assertions case as well. I also added a build system unit test that ensures that no object files reference dladdr.

…s are disabled.

This commit disables runtime stack trace dumping via dladdr on Darwin when
asserts are disabled.

This stack trace dumping was added as a way to improve the ability to debug the
compiler for compiler developers. This is all well and good but having such a
feature always enabled prevents us from reducing the size of the swift standard
library by eliminating the swift nlist.

rdar://31372220
@gottesmm
Copy link
Contributor Author

gottesmm commented May 5, 2017

Roman reviewed this on the PR for master: #9170

@gottesmm
Copy link
Contributor Author

gottesmm commented May 5, 2017

@swift-ci clean test

@swift-ci
Copy link
Contributor

swift-ci commented May 5, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 8c3cd2f
Test requested by - @gottesmm

@gottesmm
Copy link
Contributor Author

gottesmm commented May 5, 2017

The failure on Linux here was an unrelated llbuild failure. I am going to try again real quick.

@gottesmm
Copy link
Contributor Author

gottesmm commented May 5, 2017

@swift-ci please clean test linux platform.

@gottesmm gottesmm merged commit 4dc5c48 into swiftlang:swift-4.0-branch May 5, 2017
@gottesmm gottesmm deleted the radar31372220 branch May 5, 2017 07:31
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