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

Panic stacktrace is not detailed on some platforms #180

Open
temeddix opened this issue Sep 30, 2023 · 1 comment
Open

Panic stacktrace is not detailed on some platforms #180

temeddix opened this issue Sep 30, 2023 · 1 comment

Comments

@temeddix
Copy link
Member

temeddix commented Sep 30, 2023

Report

On Windows and Android, there are not enough frames showing up in the stacktrace. Most of the frames are missing because they cannot be resolved.

On macOS and iOS, the code filenames are not visible because frames in that Rust code don't include the filename information. It would be great to enable filepath information.

Things that don't make any difference:

  • Using the default panic hook of Rust without set_hook
  • RUST_BACKTRACE=1 /RUST_BACKTRACE=full environment variables

Windows, Android:

image

macOS, iOS:

image

Ubuntu:

image

web: Not handled by Rinf. Handled by wasm_bindgen.

This is the panic handler code. We replace the native panic hook with the std::panic::set_hook function, sending the panic info to Flutter to print it in the CLI(Only in debug mode, of course) with our debug_print! macro.

https://github.com/cunarist/rust-in-flutter/blob/8869298306ec585d9cfb37503fcbf7a3d2ef583a/example/native/hub/src/bridge/api.rs#L166-L198

On Android, if you disable the resolve step by commenting it out, many more unnamed frames appear in the stacktrace, which seem to derive from our Rust code.

https://github.com/cunarist/rust-in-flutter/blob/8869298306ec585d9cfb37503fcbf7a3d2ef583a/example/native/hub/src/bridge/api.rs#L192

This issue can be related to cargokit or missing .pdb files after compilation, but we do need deeper anaylsis.

Steps to Reproduce

Just use panic! anywhere in the Rust code.

System Information

I'm testing on multiple platforms, but they all pass these checks.

rustc --version
protoc --version
flutter doctor
@temeddix temeddix changed the title Panic stacktrace is not helpful on Windows and Android. Panic stacktrace is not helpful on Windows and Android Sep 30, 2023
@temeddix temeddix changed the title Panic stacktrace is not helpful on Windows and Android Panic stacktrace is not helpful on some platforms Sep 30, 2023
@temeddix temeddix changed the title Panic stacktrace is not helpful on some platforms Panic stacktrace is not detailed on some platforms Oct 4, 2023
@temeddix
Copy link
Member Author

temeddix commented Oct 4, 2023

Also, it will be good to print panics to the CLI on the web, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant