如何将预编译的静态库的调试符号与Xcode 5的源代码进行匹配? [英] How to match precompiled static library's debugging symbols to source code with Xcode 5?

查看:498
本文介绍了如何将预编译的静态库的调试符号与Xcode 5的源代码进行匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用外部构建脚本为iOS编译FFmpeg,但是当我调试我看到汇编器,如果我深入到libavformat库函数:

I have to compile FFmpeg for iOS using an external build script, but when I am debugging I see assembler if I delve too deep into libavformat library functions:

0x109a73:  cmpl   $0, 1192(%ebp)
0x109a7a:  jns    0x109a86                  ; mov_write_header + 198 at movenc.c:3539
0x109a7c:  movl   $1, 1192(%ebp)
0x109a86:  movl   16(%ebp), %eax
0x109a89:  cmpl   $0, 84(%eax)
0x109a8d:  movl   %edx, %ecx
0x109a8f:  jne    0x109ad9                  ; mov_write_header + 281 at movenc.c:3548
0x109a91:  testb  $2, 48(%ecx)
0x109a95:  jne    0x109ac1                  ; mov_write_header + 257 at movenc.c:3541

有明确的调试符号留下,这将导致我相信应该有一些方法来告诉Xcode这个源代码的位置,以方便调试。

There are clear debugging symbols left behind which would lead me to believe that there should be some way to tell Xcode the location of this source code to allow easier debugging.

这是否可以实现?

编辑:我在这里找到了一个相关问题 Xcode 4中没有外部库的符号/来源

edit: I found a related question here No symbols/source for external library in Xcode 4

所以当我运行 xcrun dwarfdump libavformat。 a | grep\.c我得到了一堆这样的结果:

So when I run xcrun dwarfdump libavformat.a | grep "\.c" I get a bunch of results like this:

AT_decl_file( "libavformat/movenc.c" )

所以我试着把相关的源文件放在相对于.a文件和.xcodeproj文件,但这两种方法都不工作。完整的源代码可在这里获得: https://github.com/openwatch/livestreamer-ios

So I tried putting the relevant source files in folders relative to both the .a file and my .xcodeproj file, but neither of those methods worked. Full source code is available here: https://github.com/openwatch/livestreamer-ios

edit2 :我发现另一个问题,关于如何设置lldb的源映射,但我不太确定该怎么做... 相当于gdb目录的LLDB指定源搜索路径的命令?

edit2: I found another question about how to set the source mapping for lldb but I'm not quite sure what to do... LLDB equivalent of gdb "directory" command for specifying source search path?

似乎我可能需要做

(lldb) settings set target.source-map libavformat/movenc.c /path/to/libavformat/movenc.c 

对于我需要的每个文件,

for every file I need?

推荐答案

我正在将libavcodec.a,libavformat.a等编译到我的FFmpegWrapper项目(libFFmpegWrapper.a)中的一个静态库中,然后我将它作为静态库包含在名为LiveStreamer的包含项目中。移动.a文件并将源文件(未添加到构建目标)添加到LiveStreamer项目中来解决问题。

So it appears that the issue is that I was compiling libavcodec.a, libavformat.a, etc into a single static library in my FFmpegWrapper project (libFFmpegWrapper.a), which I was then including as a static library in the containing project called LiveStreamer. Moving the .a files and adding the source files (not added to the build target) to the LiveStreamer project fixed the issue.

如果将来有人遇到这种情况,随便我放一条线,因为我正在努力争取这个日子。

If anyone runs into this in the future, feel free to drop me a line because I was struggling with this for days.

这篇关于如何将预编译的静态库的调试符号与Xcode 5的源代码进行匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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