在 Rosetta 中运行垃圾收集应用程序时如何调试崩溃?

发布于 2024-08-27 21:13:45 字数 2357 浏览 6 评论 0原文

我有一个针对 10.5 并使用垃圾收集的通用应用程序。我正在为 ppc、i386 和 x86_64 构建。

我无法访问物理 PowerPC 计算机,因此我尝试使用 Rosetta 来确认应用程序的 PowerPC 部分是否正常工作。

然而,一旦应用程序在 Rosetta 中启动,它就会立即崩溃,并显示以下崩溃日志:

Process:         FooApp [91567]
Path:            /Users/rob/Development/src/FooApp/build/Release 64-bit/FooApp.app/Contents/MacOS/FooApp
Identifier:      com.companyX.FooApp
Version:         0.9 (build d540e05) (2)
Code Type:       PPC (Translated)
Parent Process:  launchd [708]

Date/Time:       2010-04-09 18:32:23.962 +1000
OS Version:      Mac OS X 10.6.3 (10D573)
Report Version:  6

Exception Type:  EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  5

...snip non-relevant threads...

Thread 5 Crashed:
0   libSystem.B.dylib               0x8023656a __pthread_kill + 10
1   libSystem.B.dylib               0x80235e17 pthread_kill + 95
2   com.companyX.FooApp         0xb80bfb30 0xb8000000 + 785200
3   com.companyX.FooApp         0xb80c0037 0xb8000000 + 786487
4   com.companyX.FooApp         0xb80dd8e8 0xb8000000 + 907496
5   com.companyX.FooApp         0xb8145397 spin_lock_wrapper + 1791
6   com.companyX.FooApp         0xb801ceb7 0xb8000000 + 118455

我已使用 Apple 文档来调试翻译的应用程序以及 此页面,用于在应用程序在 Rosetta 中运行时将 gdb 附加到应用程序。该应用程序在启动后立即进入调试器:

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to thread 15107]
0x9151fdd4 in auto_fatal ()
(gdb) bt
#0  0x9151fdd4 in auto_fatal ()
#1  0x91536d84 in Auto::Thread::get_register_state ()
#2  0x915372f8 in Auto::Thread::scan_other_thread ()
#3  0x91529be4 in Auto::Zone::scan_registered_threads ()
#4  0x91539114 in Auto::MemoryScanner::scan_thread_ranges ()
#5  0x9153b000 in Auto::MemoryScanner::scan ()
#6  0x9153049c in Auto::Zone::collect ()
#7  0x915198f4 in auto_collect_internal ()
#8  0x9151a094 in auto_collection_work ()
#9  0x96687434 in _dispatch_call_block_and_release ()
#10 0x9668912c in _dispatch_queue_drain ()
#11 0x96689350 in _dispatch_queue_invoke ()
#12 0x966895c0 in _dispatch_worker_thread2 ()
#13 0x966896fc in _dispatch_worker_thread ()
#14 0x965a97e8 in _pthread_body ()
(gdb) 

我不知道从哪里开始。看起来垃圾收集器的故障非常严重。 Rosetta 是否不支持垃圾收集的 PowerPC 应用程序?如果是这样,我在文档中看不到任何提及此限制的信息。

有人有什么想法吗?

I have a Universal app which is targeting 10.5 and which uses garbage collection. I am building for ppc, i386 and x86_64.

I don't have access to a physical PowerPC machine so I am trying to use Rosetta to confirm that the PowerPC portion of the app works correctly.

However, as soon as the app is launched in Rosetta it immediately crashes with the following crash log:

Process:         FooApp [91567]
Path:            /Users/rob/Development/src/FooApp/build/Release 64-bit/FooApp.app/Contents/MacOS/FooApp
Identifier:      com.companyX.FooApp
Version:         0.9 (build d540e05) (2)
Code Type:       PPC (Translated)
Parent Process:  launchd [708]

Date/Time:       2010-04-09 18:32:23.962 +1000
OS Version:      Mac OS X 10.6.3 (10D573)
Report Version:  6

Exception Type:  EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  5

...snip non-relevant threads...

Thread 5 Crashed:
0   libSystem.B.dylib               0x8023656a __pthread_kill + 10
1   libSystem.B.dylib               0x80235e17 pthread_kill + 95
2   com.companyX.FooApp         0xb80bfb30 0xb8000000 + 785200
3   com.companyX.FooApp         0xb80c0037 0xb8000000 + 786487
4   com.companyX.FooApp         0xb80dd8e8 0xb8000000 + 907496
5   com.companyX.FooApp         0xb8145397 spin_lock_wrapper + 1791
6   com.companyX.FooApp         0xb801ceb7 0xb8000000 + 118455

I have used the Apple docs on debugging translated apps and the information on this page to attach gdb to the app when it's running in Rosetta. The app immediately breaks into the debugger upon launch:

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to thread 15107]
0x9151fdd4 in auto_fatal ()
(gdb) bt
#0  0x9151fdd4 in auto_fatal ()
#1  0x91536d84 in Auto::Thread::get_register_state ()
#2  0x915372f8 in Auto::Thread::scan_other_thread ()
#3  0x91529be4 in Auto::Zone::scan_registered_threads ()
#4  0x91539114 in Auto::MemoryScanner::scan_thread_ranges ()
#5  0x9153b000 in Auto::MemoryScanner::scan ()
#6  0x9153049c in Auto::Zone::collect ()
#7  0x915198f4 in auto_collect_internal ()
#8  0x9151a094 in auto_collection_work ()
#9  0x96687434 in _dispatch_call_block_and_release ()
#10 0x9668912c in _dispatch_queue_drain ()
#11 0x96689350 in _dispatch_queue_invoke ()
#12 0x966895c0 in _dispatch_worker_thread2 ()
#13 0x966896fc in _dispatch_worker_thread ()
#14 0x965a97e8 in _pthread_body ()
(gdb) 

I have no idea where to start with this. It looks like the Garbage Collector is failing very badly. Are garbage-collected PowerPC apps not supported in Rosetta? I can't see any mention of this limitation in the docs if so.

Does anyone have any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

完美的未来在梦里 2024-09-03 21:13:45

我现在已经确定垃圾收集的 PowerPC 应用程序不能使用 Rosetta 运行。在 Google 中进行深入研究后,我在 Cocoa-Dev 邮件列表中发现了一些关于这一点的提及,尽管苹果没有任何“官方”内容。

我已经确认,如果使用垃圾收集为 ppc 进行编译,然后在 Rosetta 下启动,即使是默认的 Cocoa 应用程序模板应用程序也会立即崩溃。

我必须说,非常令人沮丧的是 通用二进制编程指南(讨论 Rosetta),垃圾收集编程指南或 Leopard AppKit 或 Foundation 发行说明。同样令人沮丧的是运行时没有生成某种有用的错误消息。

由于 Leopard/Rosetta/PowerPC 现在是“遗留技术”,我认为针对这一遗漏提交错误不会有多大好处,但希望这个答案能够帮助那些遇到同样问题的人。

I have now determined that garbage-collected PowerPC apps cannot be run using Rosetta. After digging around in Google I found a couple of mentions about this on the Cocoa-Dev mailing list, although nothing "official" from Apple.

I have confirmed that even the default Cocoa application template app will crash immediately if compiled for ppc with garbage collection and then launched under Rosetta.

I must say it's extremely frustrating that there is no mention of this limitation in either the Universal Binary Programming Guidelines (which discuss Rosetta), the Garbage Collection Programming Guide or the Leopard AppKit or Foundation release notes. It's also frustrating that the runtime doesn't generate some sort of useful error message.

As Leopard/Rosetta/PowerPC are now "legacy technologies" I don't imagine filing a bug against this omission will do much good, but hopefully this answer will help those who come up against the same issue.

撧情箌佬 2024-09-03 21:13:45

测试它的一种方法是在应用程序启动时禁用垃圾收集器。

[[NSGarbageCollector defaultCollector] disable];

你会疯狂地泄漏,但对于一个小测试来说,这可能工作正常。需要注意的是,您需要确保这是应用程序中首先发生的事情之一。在 main 中是一个好地方,但是如果您链接到在 +load 方法(或具有构造函数)中工作的框架,您可能需要在框架中执行此操作(或者插入一个库)。

One way you can test it is to disable the garbage collector when your application starts.

[[NSGarbageCollector defaultCollector] disable];

You'll leak like crazy, but for a minor test this could work okay. One caveat with this is that you need to make sure that it's one of the first things that happens in your app. In main would be a good place, but if you link to frameworks that do work in +load methods (or have constructors), you may need to do it in the framework (or interpose a library instead).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文