-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
std: add std.options.debug_stacktrace_kind #19650
base: master
Are you sure you want to change the base?
Conversation
|
a version that prints out stack addresses without needing any debug info (so no file, line, or symbol name info) could be useful too |
|
afaik that's already what happens if you use |
|
if you strip debug info then dumpStackTrace prints out a warning and returns early, and writeStackTrace returns error.MissingDebugInfo, though printSourceAtAddress does work for what you describe |
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.
Thank you. I think it is a good idea. Happy to merge if you:
- rebase on latest master
- rename "kind" to "mode" (Since "mode" applies in fewer places than "kind" it a better name when it can be used)
- expose the enum inside the
std.Optionsnamespace - default to "none" when strip is true
- double check that it still works (test it again) and let me know that you did that
| /// thread 183137 panic: oops! | ||
| /// Aborted (core dumped) | ||
| /// ``` | ||
| debug_stacktrace_kind: enum { none, slim, full } = .full, |
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.
| debug_stacktrace_kind: enum { none, slim, full } = .full, | |
| debug_stacktrace_mode: DebugStacktraceMode = if (builtin.strip) .none else .full, |
| /// /src/test4.zig:24:10: 0x10660e8 in lorem (test4) | ||
| /// ``` | ||
| /// | ||
| /// 'none': this will print no stack trace. By not inlcuding the stack printer code this option can |
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.
| /// 'none': this will print no stack trace. By not inlcuding the stack printer code this option can | |
| /// 'none': this will print no stack trace. By not including the stack printer code this option can |
given the following test file we can run it with the various option values.
beyond stylistic desires, the various options also have performance and binary size ramifications.
.noneexits faster not having to inspect the program's debug info and results in a smaller file. however since this does not require the file to be stripped to get the effect, using an external debugger remains totally possible.