preserve runtime SetTraceback behavior in tiny mode - #1064
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a tiny-mode regression where garble emptied runtime.setTraceback, inadvertently changing non-traceback runtime behavior (notably Windows Error Reporting state toggled by debug.SetTraceback("wer")).
Changes:
- Stop stripping the
runtime.setTracebackfunction body in tiny mode so its non-printing side effects remain intact. - Add a Windows-only script test that asserts
debug.SetTraceback("wer")clearsSEM_NOGPFAULTERRORBOX(enabling WER behavior) even under-tiny.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| testdata/script/tiny-wer.txtar | Adds a Windows-only regression test verifying debug.SetTraceback("wer") still flips WER-related process state under -tiny. |
| runtime_patch.go | Removes the tiny-mode runtime patch that previously emptied runtime.setTraceback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
@Maremagnum can you explain this more I'm a bit lost here |
luantak
force-pushed
the
pr/tiny-settraceback
branch
from
August 11, 2026 23:56
aa8c8a4 to
7b2f2d6
Compare
Member
|
Thanks - the fix is correct, but I have a version of the test which is not windows-specific, which is much easier for us to run locally. |
Tiny mode empties runtime.setTraceback, so debug.SetTraceback("crash") no
longer makes a fatal error crash the process. The test asserts that broken
behavior for now; the default build already gets it right.
The program re-execs itself rather than adding another script, so this
reuses the tiny build tiny.txtar already pays for.
runtime1.go's setTraceback was emptied on the grounds that tiny mode hides tracebacks anyway, but the function does more than pick how much gets printed. It stores traceback_cache, which gotraceback reads to decide whether a fatal error crashes the process instead of exiting with status 2, and on Windows GOTRACEBACK=wer enables Windows Error Reporting. Since finishDebugVarsSetup routes GOTRACEBACK through it, tiny builds lost the env var too, along with the crash-on-fatal rule for c-archive and c-shared. Keeping it costs nothing measurable: a hello-world tiny build is 1343612 bytes either way, since the linker drops the body unless something references debug.SetTraceback.
mvdan
force-pushed
the
pr/tiny-settraceback
branch
from
August 23, 2026 18:31
7b2f2d6 to
27f4f7c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tiny mode empties
runtime.setTraceback, but the function also updates runtimestate used outside human-readable traceback printing. On Windows that includes
WER crash-reporting behavior.
Stop removing
runtime.setTraceback. Other tiny traceback-output cleanup isunchanged.