Xcode 4中没有外部库的符号/来源 [英] No symbols/source for external library in Xcode 4

查看:101
本文介绍了Xcode 4中没有外部库的符号/来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序没有看到图书馆的源代码:

My application is not seeing source code for a library:


  • 如果我在库方法上跳转到定义,XCode将我说.h文件,但是说没有.cpp对应的

  • 调试时,我看不到源代码,图书馆缺少大部分的调用堆栈:

  • 我已经确定调试时显示反汇编未经注册

我将库作为DEBUG构建,然后将头文件+ .a文件打包成SDK目录。所以我想我需要将调试文件复制到该SDK目录中,或者告诉我的应用程序在哪里看。我不知道如何做。

I built the library as DEBUG and then packaged up the headers+.a file into a SDK dir. So I guess I need to either copy the debug files into that SDK dir as well, or tell my application where to look. I'm not sure how to do either.

为了澄清,我的应用程序项目不保留对库项目的引用,只有.a文件和标题目录这是因为图书馆项目是由CMake创建的,我不想修改它。

To clarify, my application project doesn't maintain a reference to the library project, only to the .a files and the header dirs. This is because the library project is created by CMake and I don't want to modify it.

推荐答案

首先,你应该检查您的静态库的.debug_str部分,以验证它是否包含相应的调试信息。

First of all, you should check the .debug_str section of your static library to verify it contains the appropriate debug information.

尝试在终端上运行此命令:

Try running this command on the terminal:

xcrun dwarfdump /path/to/library.a | grep "\.m"

您应该会看到一堆源(.m)文件路径打印出来理论上,这是Xcode在调试器中停止时要看的地方,所以确保这里的路径是正确的。如果您没有看到任何路径,则在构建库时,需要将相应的调试标志(例如 -g )传递给编译器。

You should see a bunch of your source (.m) file paths printed out. Theoretically, this is where Xcode is going to look when you stop in the debugger, so make sure the paths here are correct. If you don't see any paths, you will need to pass an appropriate debug flag (e.g. -g to the compiler when building your library.

如果路径不正确,或者您想将它们指向其他位置,则可以将其修改为CMake中的构建过程的一部分,例如使其相对于您的尝试查看使gcc将相对文件名置于调试信息,它使用CMake调整这些调试路径。

If the paths are somehow incorrect, or you want to point them to some other location, you may be able to modify them as part of the build process in CMake, for example to make them relative to your project directory. Try looking at "Make gcc put relative filenames in debug information", which uses CMake to adjust these debug paths.

这篇关于Xcode 4中没有外部库的符号/来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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