aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-09-08 14:32:02 +0100
committermlugg <mlugg@mlugg.co.uk>2025-09-30 13:44:52 +0100
commitd9661e9e05af7a4be31c17cbfbbd8bc44d7c9000 (patch)
tree3a13bbd3391f31707089ba5f3f54569fe131612f /src/main.zig
parent3a561da38d42ba331eb67bdb7d86d4a3e9b74533 (diff)
downloadzig-d9661e9e05af7a4be31c17cbfbbd8bc44d7c9000.tar.gz
zig-d9661e9e05af7a4be31c17cbfbbd8bc44d7c9000.zip
compiler: better crash handler
Far simpler, because everything which `crash_report.zig` did is now handled pretty well by `std.debug` anyway. All we want is to print some context around panics and segfaults. Using the new ability to override the default segfault handler while still having std handle the target-specific bits for us, that's really simple.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig
index 1111031e87..89a552de0b 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -43,7 +43,6 @@ const thread_stack_size = 60 << 20;
pub const std_options: std.Options = .{
.wasiCwd = wasi_cwd,
.logFn = log,
- .enable_segfault_handler = false,
.log_level = switch (builtin.mode) {
.Debug => .debug,
@@ -53,6 +52,7 @@ pub const std_options: std.Options = .{
};
pub const panic = crash_report.panic;
+pub const debug = crash_report.debug;
var wasi_preopens: fs.wasi.Preopens = undefined;
pub fn wasi_cwd() std.os.wasi.fd_t {
@@ -165,8 +165,6 @@ var debug_allocator: std.heap.DebugAllocator(.{
}) = .init;
pub fn main() anyerror!void {
- crash_report.initialize();
-
const gpa, const is_debug = gpa: {
if (build_options.debug_gpa) break :gpa .{ debug_allocator.allocator(), true };
if (native_os == .wasi) break :gpa .{ std.heap.wasm_allocator, false };
@@ -192,6 +190,8 @@ pub fn main() anyerror!void {
const args = try process.argsAlloc(arena);
+ if (args.len > 0) crash_report.zig_argv0 = args[0];
+
if (tracy.enable_allocation) {
var gpa_tracy = tracy.tracyAllocator(gpa);
return mainArgs(gpa_tracy.allocator(), arena, args);