繁体   English   中英

如何在 macOS 上使用 GDB 调试器?

[英]How to use GDB Debugger on a macOS?

我目前正在使用运行 macOS Mojave 版本 10.14.5 的 2012 年中期 macbook Pro。 我正在尝试使用 GDB 调试器来调试 C 语言代码。 我已经使用 Homebrew 在我的电脑上安装了 gdb,但它似乎不起作用。 这是我从 VSCode 中的终端获得的输出:

steelwinds-MacBook-Pro:Chapter05 steelwind$ gdb ex2_dbg.out
GNU gdb (GDB) 9.1
Copyright (C) 2020 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.7.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 <RET> for more, q to quit, c to continue without paging--<RET>
Type "apropos word" to search for commands related to "word"...
Reading symbols from ex2_dbg.out...
Reading symbols from 
/Users/steelwind/HardWay/CandC++/CandC++/Chapter05/ex2_dbg.out.dSYM/Contents/Resources/
DWARF/ex2_dbg.out...
(gdb) run
Starting program: /Users/steelwind/HardWay/CandC++/CandC++/Chapter05/ex2_dbg.out 
Unable to find Mach task port for process-id 7502: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
(gdb) q
steelwinds-MacBook-Pro:Chapter05 steelwind$ 

我不确定我是否遗漏了一步,或者我是否应该做一些事情而不是使用 Homebrew,但任何建议都是有帮助的。

提示是这一行: please check gdb is codesigned - see taskgated(8)

由于 Apple 的一项安全功能,您需要对 GDB 进行协同设计。 以下是如何做到这一点: “请检查 gdb 是否已进行代码签名 - 请参阅 taskgated(8)” - 如何使用签名的自制代码安装 gdb?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM