如何使用 Xcode 调试 dylib?
我有一个 arith 库的 Xcode 项目。 我可以使用调试配置来构建它,并且我需要调试它。我怎样才能做到这一点?
理想的方法是设置测试代码以在项目文件中构建执行,然后在 arith 库的源代码中设置断点。
但是,Xcode arith 项目似乎不允许添加另一个使用 arith 库的 use_arith 项目。
人们使用什么方法在 Xcode 中调试动态库?
添加
我用谷歌搜索并找到了一些调试 dll 的方法。附加到正在运行的进程可以是调试动态库的一种方法。并且,对于iPhone/iPad编程不允许动态库,所以使用静态库。
附加到正在运行的进程 - http:// /gcc.gnu.org/onlinedocs/gnat_ugn_unw/Attaching-to-a-Running-Process.html
使用 Xcode 调试库 - 使用 Xcode 调试库
简单的模块化代码跨 iPhone 应用程序共享:静态库和跨项目引用 - http:// www.clintharris.net/2009/iphone-app-shared-libraries/
I have a Xcode project for library arith.
I could build it with debug configuration, and I need to debug it. How can I do that?
The ideal method would be to set up a test code to build an execution in a project file, and then set a breakpoint in a source code in arith library.
However, it seems that Xcode arith project doesn't allow to add another use_arith project that uses the arith library.
What method people use to debug a dynamic library in Xcode?
ADDED
I googled and found some ways to debug dll. Attaching to a running process can be one way of debugging dynamic library. And, for iPhone/iPad programming dynamic library is not allowed, so static library is used.
Attaching to a Running Process - http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Attaching-to-a-Running-Process.html
Debugging a library with Xcode - Debugging a library with Xcode
Easy, Modular Code Sharing Across iPhone Apps: Static Libraries and Cross-Project References - http://www.clintharris.net/2009/iphone-app-shared-libraries/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可以找到一种在 Xcode 中调试动态库的方法。
构建
Running
Now,您应该能够将执行二进制文件链接到库。
运行时需要将动态库复制到执行二进制文件所在目录。
调试
您需要在 arith/usearith 上设置断点。
您可以在 arith 中运行调试器并使用单步调试 arith 项目中的代码。
I could find a way to debug dynamic library in Xcode.
Build
Running
Now, you should be able to link the execution binary to the library.
For running, you need to copy the dynamic library to the directory where the execution binary is located.
Debugging
You need to set the breakpoints both arith/usearith.
You can run debugger in arith and use the step into to debug the code in a arith project.
我遇到了同样的问题,之前的答案都不适合我的情况,所以我分享我的解决方案(针对 Xcode):
如果您需要调试由外部(可执行)程序加载的 ac/c++ dylib:< /strong>
“参数”选项卡。
I faced the same problem and no one of the previous answer worked for my case so I share my solution (for Xcode):
If you need to debug a c/c++ dylib which is loaded by an external (executable) program:
"Arguments" tab.