如何检查Mac平台Mach-O可执行文件是否包含调试信息?
确认Mac可执行文件是否包含调试信息的疑问
我想确认自己的Mac可执行文件是否包含调试信息,但Linux下的常规方法在这里无效:
$ file ./my_lovely_program ./my_lovely_program: Mach-O 64-bit executable arm64 # 到底有没有调试信息?
补充说明(来自@haggbart的回答)
看起来我的可执行文件似乎没有调试信息?
$ dwarfdump --debug-info ./compi ./compi: file format Mach-O arm64 .debug_info contents: # <--- 这里是空的,对吧?
换另一种方式检测,我没法确定结果:
$ otool -hv ./compi ./compi: Mach header magic cputype cpusubtype caps filetype ncmds sizeofcmds flags MH_MAGIC_64 ARM64 ALL 0x00 EXECUTE 19 1816 NOUNDEFS DYLDLINK TWOLEVEL WEAK_DEFINES BINDS_TO_WEAK PIE
但这很奇怪,因为我完全可以用lldb调试这个程序:
(lldb) b main Breakpoint 1: where = compi`main + 24 at main.cpp:50:9, address = 0x0000000100018650 (lldb) run Process 6067 launched: '/Users/oren/Downloads/compi' (arm64) Process 6067 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x0000000100018650 compi`main(argc=3, argv=0x000000016fdff7b8) at main.cpp:50:9 47 /*****************/ 48 int main(int argc, char **argv) 49 { -> 50 if (argc == 3) 51 { 52 const char *input = argv[1]; 53 const char *output = argv[2]; Target 0: (compi) stopped.
内容的提问来源于stack exchange,提问作者OrenIshShalom
相关产品推荐
相关产品推荐

