-
Notifications
You must be signed in to change notification settings - Fork 309
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
Stack trace still entirely unknown
even after following documentation entirely
#2200
Comments
Hmm, your error does not seem to have a Backtrace field. IIRC the thiserror package requires that field in order to provide a backtrace? |
I also don't have backtraces on panics. |
Hmm then that's weird. Could you please follow the quickstart and get a brand new project, and see whether panic has stack traces? |
Close since no response and it seems to not be directly related to frb (but a general rust question), but feel free to reopen if needed! |
Not really fixed, I‘m on vacation until next week and can‘t add any information until then. |
Take your time! |
I can reproduce this bug. My environment:
Steps:
diff --git a/rust/src/api/simple.rs b/rust/src/api/simple.rs
index 4360c82..d8bc331 100644
--- a/rust/src/api/simple.rs
+++ b/rust/src/api/simple.rs
@@ -1,6 +1,7 @@
#[flutter_rust_bridge::frb(sync)] // Synchronous mode for simplicity of the demo
pub fn greet(name: String) -> String {
- format!("Hello, {name}!")
+ // format!("Hello, {name}!")
+ panic!("panic")
}
#[flutter_rust_bridge::frb(init)]
|
Hmm, could you please firstly check,
|
I'm not sure how the rust code is built since the building process is managed by frb and flutter and I don't find how to configure it. diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index e6e9502..cd79081 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -8,3 +8,6 @@ crate-type = ["cdylib", "staticlib"]
[dependencies]
flutter_rust_bridge = "=2.1.0"
+
+[profile.release]
+debug = true
diff --git a/rust/src/api/simple.rs b/rust/src/api/simple.rs
index 4360c82..8e5967c 100644
--- a/rust/src/api/simple.rs
+++ b/rust/src/api/simple.rs
@@ -1,6 +1,9 @@
#[flutter_rust_bridge::frb(sync)] // Synchronous mode for simplicity of the demo
pub fn greet(name: String) -> String {
- format!("Hello, {name}!")
+ // format!("Hello, {name}!")
+ #[cfg(debug_assertions)]
+ println!("in debug mode");
+ panic!("panic")
}
#[flutter_rust_bridge::frb(init)] As for symbols, could you give a guide on how to check them? |
I do not have windows at hand and different platforms differ. Usually just google about that. For linux it is e.g. nm and objdump. |
Here's the result of dumpbin It seems that the debug symbols are stored in the pdb file, as with other executables compiled with msvc toolchains. BTW, my rust toolchain is:
|
Great, then if the symbols are there, then maybe rust does not find it? This is a general Rust question instead of specific to frb I guess. So maybe search "rust + windows" or "rust + flutter + windows" and see whether there are some discussions about symbolication. Another way is that, since it gives you addresses (0x7ffdef373c48 etc; but may need conversion), and you have pdb file, then you can symbolicate using that pdb file and the address manually (via some commands or scripts). Yet another way is to use libraries like Sentry to handle symbol files. |
However, a regular rust program prints useful stack trace on panic even in release mode. So I think it has something to do with frb, particularly the building process which may differ from a simple
I would try it if we can't get rust to find the symbols. |
Yes I think so. Maybe also ask on Cargokit repo, because frb uses that to compile rust inside a flutter project. |
Their example repo also fails to print meaningful stacktrace. Will report the issue to them. |
Cargokit should copy the pdb file alongside the dll, but that doesn't seem to be happening for some reason. Maybe an issue with cmake integration. You could try to find the appropriate PDB files in the build directory and copy them next to final executable - do you get stacktrace then? |
the pdb file is together with the executable and dlls when they are built. Here's the structure:
BTW, I checked the
so I copied dump of |
There should be |
In fact there are 3:
However, none of them worked when I copied them to the exectuable's directory. |
TBF I'm not sure what Rust is doing on Windows to symbolicate the stacktrace. I looked now at some of my C++ code where I need to symbolicate stacktraces and I noticed that I had to manually append executable path to |
Briefly looking at backtrace-rs implementation, it seems like it should be doing the same thing... |
Close this issue since this is not a bug of flutter_rust_bridge, but something related to Rust + Windows (+ Flutter). I add some doc to point to this for future readers though. Feel free to reopen / create another issue to discuss if there is anything new! |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue. |
Describe the bug
Things I tried:
RUST_BACKTRACE=1
(and making sure it's set)backtrace
feature forflutter_rust_bridge
My error structs look like this:
I return an anyhow::Result with the error inside using the
?
syntax.Am I missing something?
Steps to reproduce
Logs
Expected behavior
No response
Generated binding code
No response
OS
No response
Version of
flutter_rust_bridge_codegen
No response
Flutter info
No response
Version of
clang++
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: