gpt4 book ai didi

macos - Mac 10.9上的gdb失败,并显示32 + 64位“无法以可执行格式:无法识别文件格式”

转载 作者:行者123 更新时间:2023-12-03 20:28:45 26 4
gpt4 key购买 nike

$ 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位二进制文​​件会失败?

最佳答案

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

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

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


要么

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


如果您想调试组合的可执行文件,可以尝试使用 LLDBApple version of gdb

关于macos - Mac 10.9上的gdb失败,并显示32 + 64位“无法以可执行格式:无法识别文件格式”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20553784/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com