• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

c++ - Boost.Coroutine 在 iPhone 上崩溃

[复制链接]
菜鸟教程小白 发表于 2022-12-12 16:07:47 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

有人尝试在 iOS 应用程序中使用 Boost.Coroutine 库吗? 如果是,是否有效?

我现在正在尝试这样做,但是当尝试展开堆栈应用程序的不完整协程以未捕获的异常forced_unwind() 终止时。

我已经在其他平台(i386(ios 模拟器)和 elf armv7(htc one x,one v))上运行了这个库,并且运行良好。但是 iOS .. :[

附加信息:

我正在尝试从 boost/coroutine/example 运行 unwind.cpp 示例: https://github.com/olk/boost-coroutine/blob/master/example/cpp03/unwind.cpp

堆栈是:

libc++abi.dylib: terminating with uncaught exception of type yboost::coroutines::detail::forced_unwind
(lldb) bt
* thread #1: tid = 0x258dd, 0x399eb1fc libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread, stop reason = signal SIGABRT
    frame #0: 0x399eb1fc libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x39a52a52 libsystem_pthread.dylib`pthread_kill + 58
    frame #2: 0x3999c02c libsystem_c.dylib`abort + 76
    frame #3: 0x38dea98e libc++abi.dylib`abort_message + 74
    frame #4: 0x38e036e6 libc++abi.dylib`default_terminate_handler() + 254
    frame #5: 0x3943b95c libobjc.A.dylib`_objc_terminate() + 228
    frame #6: 0x38e011b2 libc++abi.dylib`std::__terminate(void (*)()) + 78
    frame #7: 0x38e012b0 libc++abi.dylib`std::terminate() + 156
    frame #8: 0x000ab2fc CoroutinesTest`__clang_call_terminate + 16
    frame #9: 0x000aefaa CoroutinesTest`yboost::coroutines::detail::pull_coroutine_object<void, void (this=0x15645b90)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >::unwind_stack_() + 358 at pull_coroutine_object.hpp:804
    frame #10: 0x000aee02 CoroutinesTest`yboost::coroutines::detail::pull_coroutine_object<void, void (this=0x15645b90)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >::~pull_coroutine_object() + 62 at pull_coroutine_object.hpp:862
    frame #11: 0x000aed9e CoroutinesTest`yboost::coroutines::detail::pull_coroutine_object<void, void (this=0x15645b90)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >::~pull_coroutine_object() + 14 at pull_coroutine_object.hpp:860
    frame #12: 0x000aefea CoroutinesTest`yboost::coroutines::detail::pull_coroutine_object<void, void (&)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >::destroy_(std::__1::allocator<yboost::coroutines::detail::pull_coroutine_object<void, void (&)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> > >&, yboost::coroutines::detail::pull_coroutine_object<void, void (&)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >*) [inlined] std::__1::allocator<yboost::coroutines::detail::pull_coroutine_object<void, void (this=0x15645cbc, __p=0x15645b90)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> > >::destroy(yboost::coroutines::detail::pull_coroutine_object<void, void (&)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >*) + 34 at memory:1739
    frame #13: 0x000aefe0 CoroutinesTest`yboost::coroutines::detail::pull_coroutine_object<void, void (alloc=0x15645cbc, p=0x15645b90)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >::destroy_(std::__1::allocator<yboost::coroutines::detail::pull_coroutine_object<void, void (&)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> > >&, yboost::coroutines::detail::pull_coroutine_object<void, void (&)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >*) + 24 at pull_coroutine_object.hpp:783
    frame #14: 0x000aed8c CoroutinesTest`yboost::coroutines::detail::pull_coroutine_object<void, void (this=0x15645b90)(yboost::coroutines::push_coroutine<void>&), yboost::coroutines::detail::standard_stack_allocator, std::__1::allocator<yboost::coroutines::pull_coroutine<void> >, yboost::coroutines::push_coroutine<void> >::deallocate_object() + 24 at pull_coroutine_object.hpp:892
    frame #15: 0x000ad9a4 CoroutinesTest`yboost::coroutines::detail::intrusive_ptr_release(p=0x15645b90) + 116 at pull_coroutine_base.hpp:311
    frame #16: 0x000ad92a CoroutinesTest`yboost::intrusive_ptr<yboost::coroutines::detail::pull_coroutine_base<void> >::~intrusive_ptr(this=0x27d5d990) + 34 at intrusive_ptr.hpp:97
    frame #17: 0x000ad902 CoroutinesTest`yboost::intrusive_ptr<yboost::coroutines::detail::pull_coroutine_base<void> >::~intrusive_ptr(this=0x27d5d990) + 14 at intrusive_ptr.hpp:96
    frame #18: 0x000ad8e8 CoroutinesTest`yboost::coroutines::pull_coroutine<void>::~pull_coroutine(this=0x27d5d990) + 16 at coroutine.hpp:1784
    frame #19: 0x000ad8d2 CoroutinesTest`yboost::coroutines::pull_coroutine<void>::~pull_coroutine(this=0x27d5d990) + 14 at coroutine.hpp:1784
    frame #20: 0x000aa0a0 CoroutinesTest`(anonymous namespace)::runnable() + 260 at CoroRunner.cpp:38
    frame #21: 0x000a9f98 CoroutinesTest`CoroRunner::run(this=0x15641dd0) + 12 at CoroRunner.cpp:84
    frame #22: 0x000c723e CoroutinesTest`-[Runner run](self=0x1563f900, _cmd=0x31edde22) + 34 at Runner.mm:32
    frame #23: 0x000c65ba CoroutinesTest`-[TPCAppDelegate application:didFinishLaunchingWithOptions:](self=0x15539dc0, _cmd=0x31eae996, application=0x15532840, launchOptions=0x00000000) + 666 at TPCAppDelegate.m:21
    frame #24: 0x31937424 UIKit`-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 276
    frame #25: 0x31936e6a UIKit`-[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1390
    frame #26: 0x319314b8 UIKit`-[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 720
    frame #27: 0x318cbbe6 UIKit`-[UIApplication handleEvent:withNewEvent:] + 3142
    frame #28: 0x318caedc UIKit`-[UIApplication sendEvent:] + 72
    frame #29: 0x31930ca0 UIKit`_UIApplicationHandleEvent + 664
    frame #30: 0x33dac76c GraphicsServices`_PurpleEventCallback + 608
    frame #31: 0x33dac356 GraphicsServices`PurpleEventCallback + 34
    frame #32: 0x2f10b77e CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
    frame #33: 0x2f10b71a CoreFoundation`__CFRunLoopDoSource1 + 346
    frame #34: 0x2f109ee6 CoreFoundation`__CFRunLoopRun + 1406
    frame #35: 0x2f074540 CoreFoundation`CFRunLoopRunSpecific + 524
    frame #36: 0x2f074322 CoreFoundation`CFRunLoopRunInMode + 106
    frame #37: 0x3192ff42 UIKit`-[UIApplication _run] + 762
    frame #38: 0x3192b1e4 UIKit`UIApplicationMain + 1136
    frame #39: 0x000c67c4 CoroutinesTest`main(argc=1, argv=0x27d5fcf4) + 116 at main.m:16



Best Answer-推荐答案


ARM 上的 IOS 使用不同于 AAPCS(这是标准)的 ABI。 boost.coroutine 在内部使用 boost.context 进行上下文切换/跳转。 直到 boost-1.55,bost.context 不支持 IOS 的 ABI。

关于c++ - Boost.Coroutine 在 iPhone 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19726132/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap