Update crash handling docs (#38026)

Julia Ryan created

Also removed the symbolicate script, which we could replace with a
`minidump-stackwalk` wrapper that downloaded sources/unstripped binaries
from github releases if that's helpful for folks.

Release Notes:

- N/A

Change summary

docs/src/development/debugging-crashes.md | 33 ++--------
script/symbolicate                        | 77 -------------------------
2 files changed, 7 insertions(+), 103 deletions(-)

Detailed changes

docs/src/development/debugging-crashes.md 🔗

@@ -1,39 +1,20 @@
 # Debugging Crashes
 
-## Crashes
+When Zed panics or otherwise crashes, Zed sends a message to a sidecar process which inspects the memory of the crashing editor to create a [minidump](https://chromium.googlesource.com/breakpad/breakpad/+/master/docs/getting_started_with_breakpad.md#the-minidump-file-format) file in `~/Library/Logs/Zed` or `$XDG_DATA_HOME/zed/logs`. This minidump can be used to generate backtraces for the stacks of all threads.
 
-When an app crashes,
+If you have enabled Zed's telemetry these will be uploaded to us when you restart the app. They end up in a [Slack channel](https://zed-industries.slack.com/archives/C0977J9MA1Y) and in [Sentry](https://zed-dev.sentry.io/issues) (both of which are Zed-staff-only).
 
-- macOS creates a `.ips` file in `~/Library/Logs/DiagnosticReports`. You can view these using the built in Console app (`cmd-space Console`) under "Crash Reports".
-- Linux creates a core dump. See the [man pages](https://man7.org/linux/man-pages/man5/core.5.html) for pointers to how your system might be configured to manage core dumps.
-- Windows doesn't create crash reports by default, but can be configured to create "minidump" memory dumps upon applications crashing.
-
-If you have enabled Zed's telemetry these will be uploaded to us when you restart the app. They end up in a [Slack channel (internal only)](https://zed-industries.slack.com/archives/C04S6T1T7TQ).
-
-These crash reports are generated by the crashing binary, and contain a wealth of information; but they are hard to read for a few reasons:
-
-- They don't contain source files and line numbers
-- The symbols are [mangled](https://doc.rust-lang.org/rustc/symbol-mangling/index.html)
-- Inlined functions are elided
-
-On macOS, to get a better sense of the backtrace of a crash you can download the `.ips` file locally and run:
+These crash reports contain rich information; but they are hard to read because they don't contain spans or symbol information. You can still work with them locally by downloading sources and an unstripped binary (or separate symbols file) for your Zed release and running:
 
 ```sh
-./script/symbolicate ~/path/zed-XXX-XXX.ips
+zstd -d ~/.local/share/zed/<uuid>.dmp -o minidump.dmp
+minidump-stackwalk minidump.dmp
 ```
 
-This will download the correct debug symbols from our public [digital ocean bucket](https://zed-debug-symbols.nyc3.digitaloceanspaces.com), and run [symbolicate](https://crates.io/crates/symbolicate) for you.
-
-The output contains the source file and line number, and the demangled symbol information for every inlined frame.
-
-## Panics
-
-When the app panics at the rust level, Zed creates a file in `~/Library/Logs/Zed` or `$XDG_DATA_HOME/zed/logs` with the text of the panic, and a summary of the backtrace. On boot, if you have telemetry enabled, we upload these panics so we can keep track of them.
-
-A panic is also considered a crash, and so for most panics we get both the crash report and the panic.
+Alongside the minidump file in your logs dir, there should be a `<uuid>.json` which contains additional metadata like the panic message, span, and system specs.
 
 ## Using a Debugger
 
-If you can reproduce the crash consistently, a debugger can be used to inspect the state of the program at the time of the crash, often providing very useful insights into the cause of the crash.
+If you can reproduce the crash consistently, a debugger can be used to inspect the state of the program at the time of the crash, often providing useful insights into the cause of the crash.
 
 You can read more about setting up and using a debugger with Zed, and specifically for debugging crashes [here](./debuggers.md#debugging-panics-and-crashes)

script/symbolicate 🔗

@@ -1,77 +0,0 @@
-#!/usr/bin/env bash
-
-set -eu
-if [[ $# -eq 0 ]] || [[ "$1" == "--help" ]]; then
-  echo "Usage: $(basename $0) <path_to_ips_file_or_json>"
-  echo "This script symbolicates the provided .ips file or .json panic report using the appropriate debug symbols from DigitalOcean"
-  echo ""
-  exit 1
-fi
-
-input_file=$1;
-
-if [[ "$input_file" == *.json ]]; then
-    version=$(cat $input_file | jq -r .panic.app_version)
-    channel=$(cat $input_file | jq -r .panic.release_channel)
-    target_triple=$(cat $input_file | jq -r .panic.target)
-
-    which llvm-symbolizer rustfilt >/dev/null || (echo Need to install llvm-symbolizer and rustfilt && exit 1)
-
-    echo $channel;
-
-    mkdir -p target/dsyms/$channel
-
-    if [[ "$version" == "remote-server-"* ]]; then
-        version="${version#remote-server-}"
-        dsym="$channel/remote_server-$version-$target_triple.dbg"
-    else
-        dsym="$channel/zed-$version-$target_triple.dbg"
-    fi
-    if [[ ! -f target/dsyms/$dsym ]]; then
-        echo "Downloading $dsym..."
-        curl -o target/dsyms/$dsym.gz "https://zed-debug-symbols.nyc3.digitaloceanspaces.com/$dsym.gz"
-        gunzip  target/dsyms/$dsym.gz
-    fi
-
-    cat $input_file | jq -r .panic.backtrace[] | sed s'/.*+//' | llvm-symbolizer --no-demangle --obj=target/dsyms/$dsym | rustfilt
-
-else # ips file
-
-    version=$(cat $input_file | head -n 1 | jq -r .app_version)
-    bundle_id=$(cat $input_file | head -n 1 | jq -r .bundleID)
-    cpu_type=$(cat $input_file | tail -n+2 | jq -r .cpuType)
-
-    which symbolicate >/dev/null || cargo install symbolicate
-
-    arch="x86_64-apple-darwin"
-    if [[ "$cpu_type" == *ARM-64* ]]; then
-        arch="aarch64-apple-darwin"
-    fi
-    echo $bundle_id;
-
-    channel="stable"
-    if [[ "$bundle_id" == *Nightly* ]]; then
-        channel="nightly"
-    elif [[ "$bundle_id" == *Preview* ]]; then
-        channel="preview"
-    fi
-
-    mkdir -p target/dsyms/$channel
-
-    # NOTE: if you see "no such file --uuid", you need to update your symbolicate
-    uuid=$(symbolicate $input_file --uuid || true)
-    if [[ $? -ne 0 ]]; then
-        echo "You need to update your symbolicate: cargo install symbolicate"
-        exit 1
-    fi
-    dsym="$uuid.dwarf"
-    if [[ ! -f target/dsyms/$dsym ]]; then
-        echo "Downloading $dsym..."
-        curl -f -o target/dsyms/$dsym.gz "https://zed-debug-symbols.nyc3.digitaloceanspaces.com/by-uuid/${uuid}.dwarf.gz" ||
-            curl -f -o target/dsyms/$dsym.gz "https://zed-debug-symbols.nyc3.digitaloceanspaces.com/$channel/Zed-$version-$arch.dwarf.gz"
-        gunzip  target/dsyms/$dsym.gz
-    fi
-
-    symbolicate $input_file target/dsyms/$dsym
-
-fi