You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何检查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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 07:45:26