From 9071341a1da9b0c9e3a88616e58646a4928c5414 Mon Sep 17 00:00:00 2001 From: Julia Ryan Date: Fri, 25 Jul 2025 07:40:26 -0500 Subject: [PATCH] Add TestCrash action (#35088) This triggers a crash that avoids our panic-handler, which is useful for testing that our crash reporting works even when you don't get a panic. Release Notes: - N/A --- crates/zed/src/zed.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 57534c8cd540c171069751281e2bc824ed05c343..0a90f89fa41d1ea087bfb6e24e010dbe81e90705 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -111,6 +111,8 @@ actions!( Zoom, /// Triggers a test panic for debugging. TestPanic, + /// Triggers a hard crash for debugging. + TestCrash, ] ); @@ -126,6 +128,14 @@ pub fn init(cx: &mut App) { cx.on_action(|_: &RestoreBanner, cx| title_bar::restore_banner(cx)); if ReleaseChannel::global(cx) == ReleaseChannel::Dev || cx.has_flag::() { cx.on_action(|_: &TestPanic, _| panic!("Ran the TestPanic action")); + cx.on_action(|_: &TestCrash, _| { + unsafe extern "C" { + fn puts(s: *const i8); + } + unsafe { + puts(0xabad1d3a as *const i8); + } + }); } cx.on_action(|_: &OpenLog, cx| { with_active_or_new_workspace(cx, |workspace, window, cx| {