Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP: Submit the full backtrace to the crash reporter #7323

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion editors/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ function startClient(
const location = new vscode.TelemetryTrustedValue(
lines[1],
);
const message = lines.slice(2).join("\n");
const backtrace = lines[2];
const message = lines.slice(3).join("\n");
telemetryLogger.logError("lsp-panic", {
version: version,
location: location,
message: message,
backtrace: backtrace,
});
vscode.workspace.fs.delete(slint_lsp_panic_file);
});
Expand Down
1 change: 1 addition & 0 deletions tools/lsp/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ fn main() {
} else {
writeln!(file, "unknown location")
};
let _ = writeln!(file, "{:?}", std::backtrace::Backtrace::force_capture());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is multiple lines, how come const backtrace = lines[2]; works on the TypeScript side?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a single line. Looks like this:

Backtrace [{ fn: "slint_lsp::main::{{closure}}", file: "<REDACTED: user-file-path>", line: 248 }, { fn: "<alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call", file: "<REDACTED: user-file-path>", line: 2245 }, { fn: "std::panicking::rust_panic_with_hook", file: "<REDACTED: user-file-path>", line: 805 }, { fn: "std::panicking::begin_panic_handler::{{closure}}", file: "<REDACTED: user-file-path>", line: 671 }, { fn: "std::sys::backtrace::__rust_end_short_backtrace", file: "<REDACTED: user-file-path>", line: 170 }, { fn: "rust_begin_unwind", file: "<REDACTED: user-file-path>", line: 662 }, { fn: "core::panicking::panic_fmt", file: "<REDACTED: user-file-path>", line: 74 }, { fn: "slint_interpreter::dynamic_item_tree::instantiate::{{closure}}", file: "<REDACTED: user-file-path>", line: 1713 }, { fn: "i_slint_compiler::generator::handle_property_bindings_init::handle_property_inner", file: "<REDACTED: user-file-path>", line: 434 }]

Note that the "file", and "line" are going to be omited when the LSP is build in release.
You can see that there: https://play.rust-lang.org/?version=stable&mode=release&edition=2021&gist=a78149bd02864dcf20a843b4e270f0c7

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, makes sense. Thanks :)

let _ = writeln!(file, "{info}");
}
default_hook(info);
Expand Down
Loading