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

No meaningful stacktrace on windows #75

Open
snylonue opened this issue Aug 10, 2024 · 1 comment
Open

No meaningful stacktrace on windows #75

snylonue opened this issue Aug 10, 2024 · 1 comment

Comments

@snylonue
Copy link

downstream issue: fzyzcjy/flutter_rust_bridge#2200

Environment:

  • windows: 10.0.22631.3880
  • flutter: 3.22.3
  • rustc: 1.79.0 (129f3b996 2024-06-10) stable-x86_64-pc-windows-msvc

Reproduction Steps

  1. clone cargokit's example repo
git clone https://github.com/irondash/hello_rust_ffi_plugin.git
  1. modify rust code to introduce a panic

diff (contains changes made by flutter):

diff --git a/example/pubspec.lock b/example/pubspec.lock
index 7b5d72d..c203e27 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -82,6 +82,30 @@ packages:
       relative: true
     source: path
     version: "0.0.1"
+  leak_tracker:
+    dependency: transitive
+    description:
+      name: leak_tracker
+      sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
+      url: "https://pub.dev"
+    source: hosted
+    version: "10.0.4"
+  leak_tracker_flutter_testing:
+    dependency: transitive
+    description:
+      name: leak_tracker_flutter_testing
+      sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
+      url: "https://pub.dev"
+    source: hosted
+    version: "3.0.3"
+  leak_tracker_testing:
+    dependency: transitive
+    description:
+      name: leak_tracker_testing
+      sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
+      url: "https://pub.dev"
+    source: hosted
+    version: "3.0.1"
   lints:
     dependency: transitive
     description:
@@ -94,34 +118,34 @@ packages:
     dependency: transitive
     description:
       name: matcher
-      sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
+      sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
       url: "https://pub.dev"
     source: hosted
-    version: "0.12.16"
+    version: "0.12.16+1"
   material_color_utilities:
     dependency: transitive
     description:
       name: material_color_utilities
-      sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
+      sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
       url: "https://pub.dev"
     source: hosted
-    version: "0.5.0"
+    version: "0.8.0"
   meta:
     dependency: transitive
     description:
       name: meta
-      sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
+      sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
       url: "https://pub.dev"
     source: hosted
-    version: "1.9.1"
+    version: "1.12.0"
   path:
     dependency: transitive
     description:
       name: path
-      sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
+      sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
       url: "https://pub.dev"
     source: hosted
-    version: "1.8.3"
+    version: "1.9.0"
   plugin_platform_interface:
     dependency: transitive
     description:
@@ -179,10 +203,10 @@ packages:
     dependency: transitive
     description:
       name: test_api
-      sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
+      sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
       url: "https://pub.dev"
     source: hosted
-    version: "0.6.1"
+    version: "0.7.0"
   vector_math:
     dependency: transitive
     description:
@@ -191,14 +215,14 @@ packages:
       url: "https://pub.dev"
     source: hosted
     version: "2.1.4"
-  web:
+  vm_service:
     dependency: transitive
     description:
-      name: web
-      sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
+      name: vm_service
+      sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
       url: "https://pub.dev"
     source: hosted
-    version: "0.1.4-beta"
+    version: "14.2.1"
 sdks:
-  dart: ">=3.1.0-185.0.dev <4.0.0"
-  flutter: ">=3.3.0"
+  dart: ">=3.3.0 <4.0.0"
+  flutter: ">=3.18.0-18.0.pre.54"
diff --git a/example/windows/flutter/CMakeLists.txt b/example/windows/flutter/CMakeLists.txt
index 930d207..903f489 100644
--- a/example/windows/flutter/CMakeLists.txt
+++ b/example/windows/flutter/CMakeLists.txt
@@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
 # https://github.com/flutter/flutter/issues/57146.
 set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
 
+# Set fallback configurations for older versions of the flutter tool.
+if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
+  set(FLUTTER_TARGET_PLATFORM "windows-x64")
+endif()
+
 # === Flutter Library ===
 set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
 
@@ -92,7 +97,7 @@ add_custom_command(
   COMMAND ${CMAKE_COMMAND} -E env
     ${FLUTTER_TOOL_ENVIRONMENT}
     "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
-      windows-x64 $<CONFIG>
+      ${FLUTTER_TARGET_PLATFORM} $<CONFIG>
   VERBATIM
 )
 add_custom_target(flutter_assemble DEPENDS
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 20f42e3..bb01b8e 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -2,6 +2,7 @@ use std::{time::Duration, usize};
 
 #[no_mangle]
 pub extern "C" fn sum(a: usize, b: usize) -> usize {
+    panic!();
     a + b
 }
 
@@ -20,4 +21,4 @@ mod tests {
         let result = sum(2, 2);
         assert_eq!(result, 4);
     }
-}
\ No newline at end of file
+
  1. run example app with backtrace enabled
$env:RUST_BACKTRACE='full'
cd example
flutter run
  1. see result
thread '<unnamed>' panicked at src\lib.rs:5:5:
explicit panic
stack backtrace:
   0:     0x7ffed5195288 - <unknown>
   1:     0x7ffed51a17a9 - <unknown>
   2:     0x7ffed5193ba1 - <unknown>
   3:     0x7ffed5195066 - <unknown>
   4:     0x7ffed5196858 - <unknown>
   5:     0x7ffed51964c7 - <unknown>
   6:     0x7ffed5196d88 - <unknown>
   7:     0x7ffed5196c47 - <unknown>
   8:     0x7ffed519597f - <unknown>
   9:     0x7ffed51968f8 - <unknown>
  10:     0x7ffed51a5fe4 - <unknown>
  11:     0x7ffed51a0ebd - <unknown>
  12:     0x7ffed51a6119 - <unknown>
  13:     0x7ffed5191219 - <unknown>
  14:     0x7ffed51911aa - <unknown>
  15:      0x1e1f8786c8f - <unknown>
  16:      0x1e183538d1f - <unknown>
  17:      0x1e1835384d4 - <unknown>
  18:      0x1e1835379c3 - <unknown>
  19:      0x1e1835378b5 - <unknown>
  20:      0x1e183529b66 - <unknown>
  21:      0x1e18350f446 - <unknown>
  22:      0x1e18350e3c4 - <unknown>
  23:      0x1e18350d7e7 - <unknown>
  24:      0x1e183511419 - <unknown>
  25:      0x1e183510300 - <unknown>
  26:      0x1e18350fc4f - <unknown>
  27:      0x1e18350f446 - <unknown>
  28:      0x1e18350e3c4 - <unknown>
  29:      0x1e18350d7e7 - <unknown>
  30:      0x1e183511419 - <unknown>
  31:      0x1e183532b2b - <unknown>
  32:      0x1e183510300 - <unknown>
  33:      0x1e18350fc4f - <unknown>
  34:      0x1e183529e26 - <unknown>
  35:      0x1e18350f446 - <unknown>
  36:      0x1e18350e3c4 - <unknown>
  37:      0x1e18350d7e7 - <unknown>
  38:      0x1e183511419 - <unknown>
  39:      0x1e183510300 - <unknown>
  40:      0x1e18350fc4f - <unknown>
  41:      0x1e18350f446 - <unknown>
  42:      0x1e18350e3c4 - <unknown>
  43:      0x1e18350d7e7 - <unknown>
  44:      0x1e183511419 - <unknown>
  45:      0x1e183510300 - <unknown>
  46:      0x1e18350fc4f - <unknown>
  47:      0x1e18350f446 - <unknown>
  48:      0x1e18350e3c4 - <unknown>
  49:      0x1e18350d7e7 - <unknown>
  50:      0x1e1835238d2 - <unknown>
  51:      0x1e183517edb - <unknown>
  52:      0x1e18350e3c4 - <unknown>
  53:      0x1e18350d7e7 - <unknown>
  54:      0x1e183511419 - <unknown>
  55:      0x1e183510300 - <unknown>
  56:      0x1e18350fc4f - <unknown>
  57:      0x1e18350f446 - <unknown>
  58:      0x1e18350e3c4 - <unknown>
  59:      0x1e18350d7e7 - <unknown>
  60:      0x1e18350c795 - <unknown>
  61:      0x1e18350aa87 - <unknown>
  62:      0x1e18350a917 - <unknown>
  63:      0x1e183507dcb - <unknown>
  64:      0x1e183505e0f - <unknown>
  65:      0x1e18350583c - <unknown>
  66:      0x1e183505211 - <unknown>
  67:      0x1e1835050ea - <unknown>
  68:      0x1e18350500d - <unknown>
  69:      0x1e183504652 - <unknown>
  70:      0x1e183502e6c - <unknown>
  71:      0x1e183502bf9 - <unknown>
  72:      0x1e1fbea163d - <unknown>
  73:      0x1e1fbea0e4c - <unknown>
  74:      0x1e1f8782f9f - <unknown>
  75:     0x7ffe64de7852 - InternalFlutterGpu_Texture_AsImage
  76:     0x7ffe64de9666 - InternalFlutterGpu_Texture_AsImage
  77:     0x7ffe64e06a3f - InternalFlutterGpu_Texture_AsImage
  78:     0x7ffe64e2c592 - InternalFlutterGpu_Texture_AsImage
  79:     0x7ffe64e2c70d - InternalFlutterGpu_Texture_AsImage
  80:     0x7ffe65494bff - InternalFlutterGpu_Texture_AsImage
  81:     0x7ffe64d1caf3 - InternalFlutterGpuTestProc
  82:     0x7ffe64d1cc4b - InternalFlutterGpuTestProc
  83:     0x7ffe64d86f11 - InternalFlutterGpuTestProc
  84:     0x7ffe646e589c - InternalFlutterGpuTestProc
  85:     0x7ffe646efb16 - InternalFlutterGpuTestProc
  86:     0x7ffe646e57b3 - InternalFlutterGpuTestProc
  87:     0x7ffe646e9e00 - InternalFlutterGpuTestProc
  88:     0x7ffe646e9c0c - InternalFlutterGpuTestProc
  89:     0x7ffe656277c2 - InternalFlutterGpu_Texture_AsImage
  90:     0x7ffef891257d - BaseThreadInitThunk
  91:     0x7ffef9c4af28 - RtlUserThreadStart
@temeddix
Copy link
Contributor

I could also confirm this issue during Rinf development.

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

2 participants