XCode 6.3 立即在抛出的 Objective-C++ 异常上引发 SIGABRT [英] XCode 6.3 immediately raises SIGABRT on thrown Objective-C++ exceptions

查看:50
本文介绍了XCode 6.3 立即在抛出的 Objective-C++ 异常上引发 SIGABRT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下目标 C++ 代码

Consider the following objective-C++ code

- (BOOL)application:(UIApplication *)application
        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    try
    {
        throw std::logic_error("error message");
    }
    catch (const std::exception& ex)
    {
        NSLog(@"%s", ex.what());
    }
    return YES;
}

在 XCode 6.2 中,它按预期工作(记录了错误消息").但是,自从我们升级到 6.3 后,抛出行 (throw std::logic_error...) 引发了 SIGABRT(堆栈跟踪仅包含 _cxa_throw_pthread_kill 超出 applicationdidFinishLaunchingWithOptions) 并使应用程序崩溃.

In XCode 6.2 it is working as expected ("error message" is logged). However since we upgraded to 6.3, the throwing line (throw std::logic_error...) raises SIGABRT (the stack trace only contains _cxa_throw and _pthread_kill beyond applicationdidFinishLaunchingWithOptions) and crashes the application.

这只发生在我们的应用程序中 - 当我将完全相同的代码复制到一个新项目时,一切都运行良好,即使使用相同的编译器标志.

This only happens in our application - when I copy the exact same code to a new project everything works well, even with identical compiler flags.

我尝试指定 -fexceptions-fnon-call-exceptions 无济于事(相同的行为).

I've tried specifying -fexceptions and -fnon-call-exceptions to no avail (same behavior).

更新这似乎只发生在 32 位模拟器上(它适用于实际设备和 64 位模拟器).

Update It seems this only happens on 32-bit simulators (it works on actual devices and 64-bit simulators).

更新 2我们将范围缩小到 UserVoice iOS SDK.只需通过链接(确保您调用某个方法以便进行链接),就可以在新的 vanilla 项目中清楚地显示该行为.我们还没有调查该库中究竟是什么导致了它,我们还有一些内部库会引发相同的行为(但它们应该与 Microsoft 以外的任何人无关).

Update 2 We narrowed it down to the UserVoice iOS SDK. The behavior is clearly displayed in a new vanilla project simply by linking against it (make sure you call some method so that linkage takes place). We haven't investigated what exactly in that library causes it yet, and we also have some internal libraries that provoke the same behavior (but they should be irrelevant to anyone outside Microsoft).

推荐答案

显然这个问题是 XCode 错误(特别是链接器).据报道,它已在 XCode 6.4b3 中修复.我使用的是 6.4 (6E35b),确实似乎已经解决了.

Apparently this issue was an XCode bug (linker specifically). It was reportedly fixed in XCode 6.4b3. I'm using 6.4 (6E35b) and indeed it seems to have been resolved.

这篇关于XCode 6.3 立即在抛出的 Objective-C++ 异常上引发 SIGABRT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆