How to match precompiled static library's debugging symbols to source code with Xcode 5?

给你一囗甜甜゛ 提交于 2019-12-18 16:58:40

问题


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

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.

Is this even possible?

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

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

AT_decl_file( "libavformat/movenc.c" )

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: 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?

It seems like I might need to do

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

for every file I need?


回答1:


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.



来源:https://stackoverflow.com/questions/18903782/how-to-match-precompiled-static-librarys-debugging-symbols-to-source-code-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!