如何使用GDB(在OSX上编译)调试Mach-O二进制文件?

时间:2019-03-28 13:32:42

标签: macos debugging gdb mach

在OSX上从源代码编译了gdb之后,我想调试Mach-O应用程序。但是,打开Mach-O二进制文件时,显示以下错误:

"/Users/nlykkei/Projects/test": not in executable format: file format not recognized

我知道port(MacPorts)可以下载Apple版本的GDB,但是它的版本太旧了。

如何配置gdb,以便它能够识别Mach-O二进制文件?

完整输出:

nicolass-mbp:gdb nlykkei$ ./gdb ~/Projects/test
Python Exception <type 'exceptions.ImportError'> No module named gdb: 
./gdb: warning: 
Could not load the Python gdb module from `/usr/local/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.

GNU gdb (GDB) 8.2
Copyright (C) 2018 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-darwin18.5.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
BFD: /Users/nlykkei/Projects/test: unknown load command 0x32
BFD: /Users/nlykkei/Projects/test: unknown load command 0x32
"/Users/nlykkei/Projects/test": not in executable format: file format not recognized

0 个答案:

没有答案
相关问题