diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-02-06 03:10:32 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-02-06 03:10:32 -0500 |
| commit | 07a71fc3221dfba05caea5a50ebe3dac5c76d643 (patch) | |
| tree | a7c56f5069bd9a04cbc2b590f4120691deb8fa06 /std/debug.zig | |
| parent | 28f63b8a4f2e55d2596a0e3daea106500a479791 (diff) | |
| download | zig-07a71fc3221dfba05caea5a50ebe3dac5c76d643.tar.gz zig-07a71fc3221dfba05caea5a50ebe3dac5c76d643.zip | |
improved behavior on debug safety crash
* instead of emitting a breakpoint for a debug safety crash,
zig calls a panic function which prints an error message
and a stack trace and then calls abort.
* on freestanding OS, this panic function has a default
implementation of a simple infinite loop.
* users can override the panic implementation by providing
`pub fn panic(message: []const u8) -> unreachable { }`
* workaround for LLVM segfaulting when you try to use cold
calling convention on ARM.
closes #245
Diffstat (limited to 'std/debug.zig')
| -rw-r--r-- | std/debug.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/std/debug.zig b/std/debug.zig index 85e5503fa8..435d572ac2 100644 --- a/std/debug.zig +++ b/std/debug.zig @@ -42,6 +42,8 @@ pub fn writeStackTrace(out_stream: &io.OutStream) -> %void { st.debug_str = (%return st.elf.findSection(".debug_str")) ?? return error.MissingDebugInfo; %return scanAllCompileUnits(st); + %return out_stream.printf("(...work-in-progress stack unwinding code follows...)\n"); + var maybe_fp: ?&const u8 = @frameAddress(); while (true) { const fp = maybe_fp ?? break; |
