我必须使用external build script为iOS编译FFmpeg,但是当我调试时,如果我深入研究libavformat库函数,我会看到汇编程序:
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这个源代码的位置,以便于调试。
这甚至可能吗?
修改:我在No symbols/source for external library in Xcode 4
找到了相关问题因此,当我运行xcrun dwarfdump libavformat.a | grep "\.c"
时,我会得到一堆结果:
AT_decl_file( "libavformat/movenc.c" )
所以我尝试将相关的源文件放在相对于.a文件和我的.xcodeproj文件的文件夹中,但这两种方法都不起作用。完整源代码可在此处获取:https://github.com/openwatch/livestreamer-ios
edit2 :我发现了另一个关于如何为lldb设置源映射的问题,但我不确定该做什么... 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
我需要的每个文件?
答案 0 :(得分:4)
所以看来问题是我正在将我的FFmpegWrapper项目(libFFmpegWrapper.a)中的libavcodec.a,libavformat.a等编译成一个静态库,然后我将其作为静态库包含在其中项目名为LiveStreamer。移动.a文件并将源文件(未添加到构建目标)添加到LiveStreamer项目修复了该问题。
如果将来有人遇到这种情况,请随时给我打电话,因为我几天都在苦苦挣扎。