在 Snow Leopard(基于 Lion 构建)上调试 OSX 程序

发布于 2024-12-11 11:38:19 字数 201 浏览 1 评论 0原文

我有一个使用自动引用计数和 Lion SDK 构建的程序。该程序在 Snow Leopard 中的行为不符合预期(一个视图不会被加载,并且打开文档会挂起程序。)所以我想在那里调试它。但因为我无法在 Snow Leopard 下编译它,所以我不知道该怎么做。

那么我如何将调试符号放入 gdb 中或者我可以在 Xcode 中调试这个东西 - 是否可能有远程方式或类似的方式?

I have a program which I build using automatic-ref-counting and the Lion SDK. This program doesn't behave as expected in Snow Leopard, (One view won't be loaded and opening a document hangs the program.) so I want to debug it there. But because I can't compile it under Snow Leopard I have no idea how to do so.

So how do I get the debugging symbols into gdb or can I debug this thing in Xcode - is there probably a remote way or something like that?

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

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

发布评论

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

评论(2

薄荷→糖丶微凉 2024-12-18 11:38:19

您可以通过 gdbserver 进行远程调试:

snow-leopard$ gdbserver :10000 /path/to/exe
lion$ gdb /path/to/exe
(gdb) target remote snow-leopard:10000

更简单的方法是将整个源代码和构建目录复制到 Snow-leopard 并在本地使用 GDB 进行调试。即使您没有在那里构建,GDB 仍然应该能够找到它需要的一切。

You can either debug remotely via gdbserver:

snow-leopard$ gdbserver :10000 /path/to/exe
lion$ gdb /path/to/exe
(gdb) target remote snow-leopard:10000

A simpler way is to copy your entire source and build directory to snow-leopard and debug with GDB locally. Even though you didn't build there, GDB should still be able to find everything it needs.

哆兒滾 2024-12-18 11:38:19

抱歉,我的研究表明 Snow Leopard 上的“g++”编译器不再在链接模块中放置对“gdb”有任何含义的符号。唯一找到的符号是为使所有符号独一无二而创建的虚构符号。这是一个简短的示例:

`_Z5DoSVCi', function, 0x151dd
`_Z7SEBTrapv', function, 0x1383c

Tiger 中的相同符号如下所示:

`_Z5DoSVCi'  `DoSVC(int)', FUNCTION, 0x1394c
`_Z7SEBTrapv'  `SEBTrap()', FUNCTION, 0xf994

“签名”是“gdb”需要解决的问题,例如:break emsvc.c:DoSVC
此外,您仍然必须拥有所有“对象甲板”,例如 emsvc.o,因为 Snow Leopard 的“g++”显然不再携带链接模块中的符号。

我将一个在 Tiger(基于 Intel)上链接的“g++”编译模块带到了 Snow Leopard,没有对象平台,并且“gdb”能够完美地处理它,包括设置断点。显然,“g++”或链接器没有为 Snow Leopard 上的“gdb”生成正确的模块。

Sorry to say, my research shows that the "g++" compiler on Snow Leopard no longer places symbols in the linked module that have any meaning to "gdb". The only symbols found are the made-up symbols created to make ALL symbols unique. Here is a brief sample:

`_Z5DoSVCi', function, 0x151dd
`_Z7SEBTrapv', function, 0x1383c

Those same symbols in Tiger were like this:

`_Z5DoSVCi'  `DoSVC(int)', FUNCTION, 0x1394c
`_Z7SEBTrapv'  `SEBTrap()', FUNCTION, 0xf994

The "signature" is what "gdb" needs to resolve things like: break emsvc.c:DoSVC
Furthermore, you must still have all the "object decks", like emsvc.o, because Snow Leopard's "g++" apparently does not carry the symbols in the linked module anymore.

I brought a "g++" compiled module linked on Tiger (Intel-based) over to Snow Leopard without object decks, and "gdb" was able to handle it perfectly, including setting breakpoints. Apparently, "g++" or the linker isn't producing proper modules for "gdb" on Snow Leopard.

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