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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user