mac 10.9 上的 gdb 失败并显示“不是可执行格式:文件格式无法识别"适用于 32+64 拱门 [英] gdb on mac 10.9 fails with "not in executable format: File format not recognized" for 32+64 arch

查看:37
本文介绍了mac 10.9 上的 gdb 失败并显示“不是可执行格式:文件格式无法识别"适用于 32+64 拱门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ file app
app: Mach-O universal binary with 2 architectures
app (for architecture i386):    Mach-O executable i386
app (for architecture x86_64):  Mach-O 64-bit executable x86_64

$ gdb app
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin13.0.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
"app": not in executable format: File format not recognized


$ file test
test: Mach-O 64-bit executable x86_64

$ gdb test
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin13.0.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/dmulder/test...Reading symbols from /Users/dmulder/test.dSYM/Contents/Resources/DWARF/test...done.
done.

为什么64位二进制会成功,而64+32二进制会失败?

Why would the 64bit binary succeed, but the 64+32 binary fail?

推荐答案

不幸的是,非 Apple 版本的 GNU gdb 目前无法调试通用(或胖")二进制文件(包含 32 位和 64-bit 可执行文件).

Unfortunately, the non-Apple version of GNU gdb is currently unable to debug universal (or 'fat') binaries (ones that contain both 32-bit and 64-bit executables).

一种选择是使用 lipo 提取单个架构并在其上运行 gdb:

One option is to use lipo to extract a single architecture and run gdb on that:

lipo -thin x86_64 -output app-x86_64 ./app

lipo -thin i386 -output app-i386 ./app

如果您希望调试组合的可执行文件,可以尝试使用 LLDB苹果版gdb.

If you'd prefer to debug the combined executable, you could try using LLDB, or an Apple version of gdb.

这篇关于mac 10.9 上的 gdb 失败并显示“不是可执行格式:文件格式无法识别"适用于 32+64 拱门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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