dinghy icon indicating copy to clipboard operation
dinghy copied to clipboard

`catch_unwind` broken on `armv7-apple-ios`

Open madsmtm opened this issue 2 years ago • 1 comments

Tried the following on my iPad (1st generation, iOS 9.3.6), not sure if this is a Dinghy error or a rustc error?

// main.rs
fn main() {
    let res = std::panic::catch_unwind(|| {
        panic!("test");
    });
    println!("{:?}", res);
}
# Cargo.toml
[package]
name = "ios-panic"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "ios-panic"
path = "main.rs"
# .cargo/config.toml
[unstable]
# To allow building for armv7-apple-ios
build-std = ["core", "alloc", "std"]

Run with RUST_LOG=dinghy=debug cargo +nightly dinghy --device ipad run.

Traceback:

[2022-06-13T20:43:37Z DEBUG dinghy_lib::android] ADB found: "$HOME/Library/Android/sdk/platform-tools/adb"
[2022-06-13T20:43:37Z DEBUG dinghy_lib::android] Candidates SDK: []
[2022-06-13T20:43:37Z DEBUG dinghy_lib::android] Android NDK not found
[2022-06-13T20:43:38Z DEBUG dinghy_build::build_env] Setting environment variable "TARGET_CC"="gcc"
[2022-06-13T20:43:38Z DEBUG dinghy_build::build_env] Setting environment variable "CC_armv7-apple-ios"="gcc"
[2022-06-13T20:43:38Z DEBUG dinghy_build::build_env] Setting environment variable "TARGET_SYSROOT"="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk"
[2022-06-13T20:43:38Z DEBUG dinghy_build::build_env] Setting environment variable "CARGO_TARGET_ARMV7_APPLE_IOS_LINKER"="$PROJECT/target/armv7-apple-ios/auto-ios-armv7/linker"
[$HOME/.cargo/registry/src/github.com-1ecc6299db9ec823/dinghy-lib-0.4.71/src/ios/platform.rs:70] &self.toolchain = Toolchain {
    rustc_triple: "armv7-apple-ios",
}
[2022-06-13T20:43:38Z DEBUG dinghy_build::build_env] Setting environment variable "PKG_CONFIG_ALLOW_CROSS"="1"
[2022-06-13T20:43:38Z DEBUG dinghy_build::build_env] Setting environment variable "PKG_CONFIG_LIBPATH_armv7_apple_ios"=""
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
[2022-06-13T20:43:38Z DEBUG dinghy_lib::compiler] Found libraries {}
[2022-06-13T20:43:38Z DEBUG dinghy_lib::ios::xcode] signing identities: [SigningIdentity { id: "[redacted]", name: "Apple Development: [email protected] ([redacted])", team: "[redacted]" }]
[2022-06-13T20:43:38Z DEBUG dinghy_lib::ios::xcode] considering profile "$HOME/Library/MobileDevice/Provisioning Profiles/034e9187-22e8-4c95-9677-5da2f5be907b.mobileprovision"
[2022-06-13T20:43:38Z DEBUG dinghy_lib::ios::xcode] considering profile "$HOME/Library/MobileDevice/Provisioning Profiles/5b3f5cb9-37e6-4157-a037-34acce372470.mobileprovision"
[2022-06-13T20:43:38Z DEBUG dinghy_lib::ios::xcode]   app in profile does not match (iOS Team Provisioning Profile: dk.marquart.mobile-test)
[2022-06-13T20:43:38Z DEBUG dinghy_lib::device] Removing previous bundle "$PROJECT/target/armv7-apple-ios/debug/dinghy/ios-panic-unwind/Dinghy.app"
[2022-06-13T20:43:38Z DEBUG dinghy_lib::device] Making bundle "$PROJECT/target/armv7-apple-ios/debug/dinghy/ios-panic-unwind/Dinghy.app"
[2022-06-13T20:43:38Z DEBUG dinghy_lib::device] Copying exe "$PROJECT/target/armv7-apple-ios/debug/ios-panic-unwind" to bundle "$PROJECT/target/armv7-apple-ios/debug/dinghy/ios-panic-unwind/Dinghy.app/_dinghy_ios-panic-unwind"
[2022-06-13T20:43:38Z DEBUG dinghy_lib::device] Copying dynamic libs to bundle
[2022-06-13T20:43:38Z DEBUG dinghy_lib::device] Copying src . to bundle $PROJECT/target/armv7-apple-ios/debug/dinghy/ios-panic-unwind/Dinghy.app
[2022-06-13T20:43:38Z DEBUG dinghy_lib::project] Copying recursively from . to $PROJECT/target/armv7-apple-ios/debug/dinghy/ios-panic-unwind/Dinghy.app excluding ["./target"]
[2022-06-13T20:43:38Z DEBUG dinghy_lib::device] Copying test_data to bundle $PROJECT/target/armv7-apple-ios/debug/dinghy/ios-panic-unwind/Dinghy.app
[2022-06-13T20:43:38Z DEBUG dinghy_lib::project] Copying recursively from $PROJECT/target/armv7-apple-ios/debug/ios-panic-unwind to $PROJECT/target/armv7-apple-ios/debug/dinghy/ios-panic-unwind/Dinghy.app/Dinghy excluding []
[2022-06-13T20:43:38Z DEBUG dinghy_lib::ios::xcode] Will sign "$PROJECT/target/armv7-apple-ios/debug/dinghy/ios-panic-unwind/Dinghy.app" with team: 9K7QZYTTLY using key: Apple Development: [email protected] ([redacted]) and profile: $HOME/Library/MobileDevice/Provisioning Profiles/034e9187-22e8-4c95-9677-5da2f5be907b.mobileprovision
[2022-06-13T20:43:38Z DEBUG dinghy_lib::ios::xcode] entitlements file: $PROJECT/target/armv7-apple-ios/debug/dinghy/entitlements.xcent
[2022-06-13T20:43:42Z DEBUG dinghy_lib::ios::device] mount developer image
[2022-06-13T20:43:43Z DEBUG dinghy_lib::ios::device] Looking for device support directory in "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport" for iOS version "9.3.6"
[2022-06-13T20:43:43Z DEBUG dinghy_lib::ios::device] Picked "9.3"
[2022-06-13T20:43:43Z DEBUG dinghy_lib::ios::device] Developer image path: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/9.3/DeveloperDiskImage.dmg"
[2022-06-13T20:43:43Z DEBUG dinghy_lib::ios::device] AMDeviceMountImage returns: 0
[2022-06-13T20:43:43Z DEBUG dinghy_lib::ios::device] start debugserver on phone
[2022-06-13T20:43:43Z DEBUG dinghy_lib::ios::device] debug server running
[2022-06-13T20:43:43Z DEBUG dinghy_lib::ios::device] start local lldb proxy
[2022-06-13T20:43:43Z DEBUG dinghy_lib::ios::device] started lldb proxy localhost:56093
[2022-06-13T20:43:44Z DEBUG dinghy_lib::ios::device] Looking for device support directory in "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport" for iOS version "9.3.6"
[2022-06-13T20:43:44Z DEBUG dinghy_lib::ios::device] Picked "9.3"
(lldb) command source -s 1 '/var/folders/pj/fqvl2zvs1bv7zf_l2l_tgj5c0000gn/T/mobiledevice-rs-lldb.mOgniAZesVqd/lldb-script'
thread 'main' panicked at 'test', main.rs:3:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'attempt to subtract with overflow', $HOME/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/panic_unwind/src/gcc.rs:309:51
stack backtrace:
thread panicked while panicking. aborting.
process left in lldb state: stopped
thread #1: tid = 0xde9f, 0x23a82c5c libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  frame #0: 0x23a82c5c libsystem_kernel.dylib`__pthread_kill + 8
  frame #1: 0x23b2c732 libsystem_pthread.dylib`pthread_kill + 62
  frame #2: 0x23a170ac libsystem_c.dylib`abort + 108
  frame #3: 0x00167d94 Dinghy`std::sys::unix::abort_internal::h2ed838f0f9540198 at mod.rs:290:14
  frame #4: 0x0011abc8 Dinghy`std::panicking::rust_panic_with_hook::h367df0f40dd58875(payload=&mut dyn core::panic::BoxMeUp @ 0x0057eb74, message=Option<&core::fmt::Arguments> @ 0x0057eb7c, location=0x0025c170, can_unwind=true) at panicking.rs:713:9
  frame #5: 0x0011a648 Dinghy`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h340976b0ddda462a at panicking.rs:586:13
  frame #6: 0x000e7928 Dinghy`std::sys_common::backtrace::__rust_end_short_backtrace::hc61979b07926d413(f=<unavailable>) at backtrace.rs:138:18
  frame #7: 0x00119eac Dinghy`rust_begin_unwind(info=0x0057ee24) at panicking.rs:584:5
  frame #8: 0x00247dcc Dinghy`core::panicking::panic_fmt::h42253fa52d701b69(fmt=<unavailable>) at panicking.rs:142:14
  frame #9: 0x00247b98 Dinghy`core::panicking::panic::h2d595c1dac7a76e4(expr=(data_ptr = "attempt to subtract with overflow", length = 33)) at panicking.rs:48:5
  frame #10: 0x001d5f10 Dinghy`panic_unwind::real_imp::find_eh_action::h2208c04352ae5ba3(context=0x0057f32c) at gcc.rs:309:51
  frame #11: 0x001d6098 Dinghy`panic_unwind::real_imp::rust_eh_personality_impl::hb9cfcdd77b55d3ff(version=1, actions=_UA_SEARCH_PHASE, _exception_class=5570770221508416340, exception_object=0x15d796c0, context=0x0057f32c) at gcc.rs:238:35
  frame #12: 0x001d62ac Dinghy`rust_eh_personality(version=1, actions=_UA_SEARCH_PHASE, exception_class=5570770221508416340, exception_object=0x15d796c0, context=0x0057f32c) at gcc.rs:291:21
  frame #13: 0x23b42b28 libunwind.dylib`_Unwind_SjLj_RaiseException + 60
  frame #14: 0x001d5bec Dinghy`panic_unwind::real_imp::panic::he35599c6903e9c02(data=alloc::boxed::Box<(dyn core::any::Any + core::marker::Send), alloc::alloc::Global> @ 0x0057f03c) at gcc.rs:62:12
  frame #15: 0x001d3ccc Dinghy`__rust_start_panic(payload=0x0057f198) at lib.rs:109:5
  frame #16: 0x0011ac6c Dinghy`rust_panic(msg=&mut dyn core::panic::BoxMeUp @ 0x0057f198) at panicking.rs:746:9
  frame #17: 0x0011ab58 Dinghy`std::panicking::rust_panic_with_hook::h367df0f40dd58875(payload=&mut dyn core::panic::BoxMeUp @ 0x0057f304, message=Option<&core::fmt::Arguments> @ 0x0057f30c, location=0x002581d4, can_unwind=true) at panicking.rs:716:5
  frame #18: 0x0011a648 Dinghy`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h340976b0ddda462a at panicking.rs:586:13
  frame #19: 0x000e7928 Dinghy`std::sys_common::backtrace::__rust_end_short_backtrace::hc61979b07926d413(f=<unavailable>) at backtrace.rs:138:18
  frame #20: 0x00119eac Dinghy`rust_begin_unwind(info=0x0057f5ac) at panicking.rs:584:5
  frame #21: 0x00247dcc Dinghy`core::panicking::panic_fmt::h42253fa52d701b69(fmt=<unavailable>) at panicking.rs:142:14
  frame #22: 0x000d7930 Dinghy`ios_panic_unwind::main::_$u7b$$u7b$closure$u7d$$u7d$::hb341b0be0b951d4c((null)={closure_env#0} @ 0x0057f5e8) at main.rs:3:9
Traceback (most recent call last):
  File "/var/folders/pj/fqvl2zvs1bv7zf_l2l_tgj5c0000gn/T/mobiledevice-rs-lldb.mOgniAZesVqd/helpers.py", line 30, in start
    print("  %s"%(frame))
  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python3/lldb/__init__.py", line 6002, in __str__
    return _lldb.SBFrame___str__(self)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd7 in position 88: invalid continuation byte

madsmtm avatar Jun 13 '22 20:06 madsmtm

This is indeed a rustc error, will be fixed by https://github.com/rust-lang/rust/pull/99932

madsmtm avatar Jul 30 '22 03:07 madsmtm