Add ./script/symbolicate (#8165)
This lets you get a readable backtrace from an .ips file of a crash report. Release Notes: - N/A
This commit is contained in:
parent
4f40d3c801
commit
20b10fdca9
3 changed files with 90 additions and 9 deletions
|
@ -681,10 +681,11 @@ fn upload_panics_and_crashes(http: Arc<ZedHttpClient>, cx: &mut AppContext) {
|
|||
let telemetry_settings = *client::TelemetrySettings::get_global(cx);
|
||||
cx.background_executor()
|
||||
.spawn(async move {
|
||||
upload_previous_panics(http.clone(), telemetry_settings)
|
||||
let most_recent_panic = upload_previous_panics(http.clone(), telemetry_settings)
|
||||
.await
|
||||
.log_err();
|
||||
upload_previous_crashes(http, telemetry_settings)
|
||||
.log_err()
|
||||
.flatten();
|
||||
upload_previous_crashes(http, most_recent_panic, telemetry_settings)
|
||||
.await
|
||||
.log_err()
|
||||
})
|
||||
|
@ -695,9 +696,12 @@ fn upload_panics_and_crashes(http: Arc<ZedHttpClient>, cx: &mut AppContext) {
|
|||
async fn upload_previous_panics(
|
||||
http: Arc<ZedHttpClient>,
|
||||
telemetry_settings: client::TelemetrySettings,
|
||||
) -> Result<()> {
|
||||
) -> Result<Option<(i64, String)>> {
|
||||
let panic_report_url = http.zed_url("/api/panic");
|
||||
let mut children = smol::fs::read_dir(&*paths::LOGS_DIR).await?;
|
||||
|
||||
let mut most_recent_panic = None;
|
||||
|
||||
while let Some(child) = children.next().await {
|
||||
let child = child?;
|
||||
let child_path = child.path();
|
||||
|
@ -720,7 +724,7 @@ async fn upload_previous_panics(
|
|||
.await
|
||||
.context("error reading panic file")?;
|
||||
|
||||
let panic = serde_json::from_str(&panic_file_content)
|
||||
let panic: Option<Panic> = serde_json::from_str(&panic_file_content)
|
||||
.ok()
|
||||
.or_else(|| {
|
||||
panic_file_content
|
||||
|
@ -734,6 +738,8 @@ async fn upload_previous_panics(
|
|||
});
|
||||
|
||||
if let Some(panic) = panic {
|
||||
most_recent_panic = Some((panic.panicked_on, panic.payload.clone()));
|
||||
|
||||
let body = serde_json::to_string(&PanicRequest { panic }).unwrap();
|
||||
|
||||
let request = Request::post(&panic_report_url)
|
||||
|
@ -752,7 +758,7 @@ async fn upload_previous_panics(
|
|||
.context("error removing panic")
|
||||
.log_err();
|
||||
}
|
||||
Ok::<_, anyhow::Error>(())
|
||||
Ok::<_, anyhow::Error>(most_recent_panic)
|
||||
}
|
||||
|
||||
static LAST_CRASH_UPLOADED: &'static str = "LAST_CRASH_UPLOADED";
|
||||
|
@ -761,6 +767,7 @@ static LAST_CRASH_UPLOADED: &'static str = "LAST_CRASH_UPLOADED";
|
|||
/// (only if telemetry is enabled)
|
||||
async fn upload_previous_crashes(
|
||||
http: Arc<ZedHttpClient>,
|
||||
most_recent_panic: Option<(i64, String)>,
|
||||
telemetry_settings: client::TelemetrySettings,
|
||||
) -> Result<()> {
|
||||
if !telemetry_settings.diagnostics {
|
||||
|
@ -797,10 +804,17 @@ async fn upload_previous_crashes(
|
|||
.await
|
||||
.context("error reading crash file")?;
|
||||
|
||||
let request = Request::post(&crash_report_url)
|
||||
let mut request = Request::post(&crash_report_url)
|
||||
.redirect_policy(isahc::config::RedirectPolicy::Follow)
|
||||
.header("Content-Type", "text/plain")
|
||||
.body(body.into())?;
|
||||
.header("Content-Type", "text/plain");
|
||||
|
||||
if let Some((panicked_on, payload)) = most_recent_panic.as_ref() {
|
||||
request = request
|
||||
.header("x-zed-panicked-on", format!("{}", panicked_on))
|
||||
.header("x-zed-panic", payload)
|
||||
}
|
||||
|
||||
let request = request.body(body.into())?;
|
||||
|
||||
let response = http.send(request).await.context("error sending crash")?;
|
||||
if !response.status().is_success() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue