File 0004-disable-riscv-crash-reporting.patch of Package zed
--- a/crates/crashes/Cargo.toml
+++ b/crates/crashes/Cargo.toml
@@ -6,16 +6,18 @@
license = "GPL-3.0-or-later"
[dependencies]
-crash-handler.workspace = true
log.workspace = true
-minidumper.workspace = true
parking_lot.workspace = true
serde.workspace = true
serde_json.workspace = true
system_specs.workspace = true
zstd.workspace = true
-[target.'cfg(not(target_os = "windows"))'.dependencies]
+[target.'cfg(not(target_arch = "riscv64"))'.dependencies]
+crash-handler.workspace = true
+minidumper.workspace = true
+
+[target.'cfg(all(not(target_os = "windows"), not(target_arch = "riscv64")))'.dependencies]
async-process.workspace = true
[target.'cfg(target_os = "linux")'.dependencies]
--- a/crates/crashes/src/crashes.rs
+++ b/crates/crashes/src/crashes.rs
@@ -1,3 +1,10 @@
+#[cfg(target_arch = "riscv64")]
+mod riscv_stub;
+#[cfg(target_arch = "riscv64")]
+pub use riscv_stub::*;
+
+#[cfg(not(target_arch = "riscv64"))]
+mod native {
use crash_handler::{CrashEventResult, CrashHandler};
use log::info;
use minidumper::{LoopAction, MinidumpBinary, Server, SocketName};
@@ -929,3 +936,8 @@
}
}
}
+
+}
+
+#[cfg(not(target_arch = "riscv64"))]
+pub use native::*;
--- /dev/null
+++ b/crates/crashes/src/riscv_stub.rs
@@ -0,0 +1,87 @@
+use serde::{Deserialize, Serialize};
+use std::{
+ collections::BTreeMap,
+ env,
+ future::Future,
+ panic,
+ path::{Path, PathBuf},
+ pin::Pin,
+ sync::Arc,
+ time::Duration,
+};
+
+pub struct Client;
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+pub struct CrashInfo {
+ pub init: InitCrashHandler,
+ pub panic: Option<CrashPanic>,
+ pub minidump_error: Option<String>,
+ #[serde(default)]
+ pub abort_message: Option<String>,
+ pub gpus: Vec<system_specs::GpuInfo>,
+ pub active_gpu: Option<system_specs::GpuSpecs>,
+ #[serde(default)]
+ pub tags: BTreeMap<String, String>,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone, Copy)]
+pub struct AbortMessageLocation {
+ pub pid: u32,
+ pub address: u64,
+}
+
+#[derive(Debug, Deserialize, Serialize, Clone)]
+pub struct InitCrashHandler {
+ pub session_id: String,
+ pub zed_version: String,
+ pub binary: String,
+ pub release_channel: String,
+ pub commit_sha: String,
+}
+
+#[derive(Deserialize, Serialize, Debug, Clone)]
+pub struct CrashPanic {
+ pub message: String,
+ pub span: String,
+}
+
+pub const SENTRY_USER_ID: &str = "sentry[user][id]";
+
+#[derive(Debug, Clone)]
+pub struct UserInfo {
+ pub metrics_id: Option<String>,
+ pub is_staff: Option<bool>,
+}
+
+pub fn force_backtrace() {
+ let old_hook = panic::take_hook();
+ panic::set_hook(Box::new(move |info| {
+ unsafe { env::set_var("RUST_BACKTRACE", "1") };
+ old_hook(info);
+ if cfg!(target_os = "macos") {
+ std::process::exit(1);
+ }
+ }));
+}
+
+pub async fn init<F, S, C, P>(
+ _crash_init: InitCrashHandler,
+ _spawn: S,
+ _socket_path: P,
+ _wait_timer: C,
+) -> Arc<Client>
+where
+ F: Future<Output = ()> + Send + Sync + 'static,
+ C: (Fn(Duration) -> F) + Send + Sync + 'static,
+ S: FnOnce(Pin<Box<dyn Future<Output = ()> + Send + 'static>>),
+ P: FnOnce(u32) -> PathBuf,
+{
+ Arc::new(Client)
+}
+
+pub fn crash_server(_socket: &Path, _logs_dir: PathBuf) {}
+
+pub fn set_gpu_info(_crash_client: &Arc<Client>, _specs: system_specs::GpuSpecs) {}
+
+pub fn set_user_info(_crash_client: &Arc<Client>, _info: UserInfo) {}