From af8e7af2657293918ff72367f51a1689f5a34891 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 13 Jun 2024 12:40:52 -0700 Subject: [PATCH] Keep symbol names in bundled linux binaries (#13006) This ensures that linux panics still contain symbol names. It also allows us to profile Zed on linux with `perf` and get symbol names. Release Notes: - N/A --- crates/zed/src/zed.rs | 9 +++++++++ script/bundle-linux | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index a393202776..8585eafcb7 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -73,6 +73,7 @@ actions!( ShowAll, ToggleFullScreen, Zoom, + TestPanic, ] ); @@ -84,6 +85,10 @@ pub fn init(cx: &mut AppContext) { #[cfg(target_os = "macos")] cx.on_action(|_: &ShowAll, cx| cx.unhide_other_apps()); cx.on_action(quit); + + if ReleaseChannel::global(cx) == ReleaseChannel::Dev { + cx.on_action(test_panic); + } } pub fn build_window_options(display_uuid: Option, cx: &mut AppContext) -> WindowOptions { @@ -484,6 +489,10 @@ fn about(_: &mut Workspace, _: &About, cx: &mut gpui::ViewContext) { .detach(); } +fn test_panic(_: &TestPanic, _: &mut AppContext) { + panic!("Ran the TestPanic action") +} + fn quit(_: &Quit, cx: &mut AppContext) { let should_confirm = WorkspaceSettings::get_global(cx).confirm_quit; cx.spawn(|mut cx| async move { diff --git a/script/bundle-linux b/script/bundle-linux index 60a83d8aff..cc4ce9fa1b 100755 --- a/script/bundle-linux +++ b/script/bundle-linux @@ -43,8 +43,8 @@ cargo build --release --target "${target_triple}" --package zed --package cli # Strip the binary of all debug symbols # Later, we probably want to do something like this: https://github.com/GabrielMajeri/separate-symbols -strip "target/${target_triple}/release/zed" -strip "target/${target_triple}/release/cli" +strip --strip-debug "target/${target_triple}/release/zed" +strip --strip-debug "target/${target_triple}/release/cli" suffix="" if [ "$channel" != "stable" ]; then