gpt4 book ai didi

c++ - 在 Netbeans C++ 中调试无法启动 - OSX Yosemite -

转载 作者:搜寻专家 更新时间:2023-10-31 00:33:41 24 4
gpt4 key购买 nike

我在为 C++ osx Yosemite 进行调试时遇到了麻烦(我尝试了不同的 IDE,但每个都出现了问题),我在 google install gdb with brew 上阅读过……但什么也没有。使用 NetBeans,启动调试,在控制台输出中我得到了 shell gdb:

GNU gdb (GDB) 7.8.1
Copyright (C) 2014 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.
--- Type <return> to continue, or q <return> to quit ---
This GDB was configured as "x86_64-apple-darwin14.0.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/>.
--- Type <return> to continue, or q <return> to quit ---
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb)

我想使用 netbeans gui 调试驱动程序,单步执行,单步执行等....这是netbeans的配置:

Configuration Debug Netbeans

我还按照以下步骤安装了 gdb:

http://ntraft.com/installing-gdb-on-os-x-mavericks/

谢谢


编辑

在 netbeans 上调试配置:

enter image description here enter image description here enter image description here

最佳答案

我遇到了同样的问题。这就是我修复它的方法(在 Yosemite 下):

  1. 安装brew:http://brew.sh

  2. 更新 brew。如果您已经安装了 brew,请检查更新。在终端中:

$ brew update

这一步对我来说是决定性的,因为在更新之前,brew 没有找到任何 gdb 包:

$ brew install gdb # Error: No available formula for gdb

然后:

$ brew update
$ brew search | grep gdb # cgdb gdb gdbm pgdbf
  1. 安装 gdb:

$ brew install gdb
  1. 按照这些说明(类似于 James 指出的说明)对二进制文件进行代码设计:http://sourceware.org/gdb/wiki/BuildingOnDarwin为了完整起见,我将它们复制到这里并添加一些评论:

Creating a certificate

  • Start Keychain Access application (/Applications/Utilities/Keychain Access.app)

  • Open menu /Keychain Access/Certificate Assistant/Create a Certificate...

  • Choose a name (gdb-cert in the example), set Identity Type to Self Signed Root, set Certificate Type to Code Signing and select the Let me override defaults. Click several times on Continue until you get to the Specify a Location For The Certificate screen, then set Keychain to System.

  • If you can't store the certificate in the System keychain, create it in the login keychain, then exported it. You can then imported it into the System keychain.

  • Finally, using the contextual menu for the certificate, select Get Info, open the Trust item, and set Code Signing to Always Trust.

  • You must quit Keychain Access application in order to use the certificate and restart taskgated service by killing the current running taskgated process (comment: for example with sudo pkill taskgated or restarting).

然后

Giving gdb permission to control other processes

If the certificate is known as gdb-cert, just use:

$ codesign -s gdb-cert gdb

Comment: if gdb is not found, then add the path where it was installed. In my case:

$ codesign -s gdb-cert /usr/local/Cellar/gdb/7.10/bin/gdb
  1. 使用 gdb 或菜单中安装 gdb 的路径(例如,/usr/local/Cellar/gdb/7.10/bin/gdb)/Netbeans/Preferences/C/C++/Build Tools 字段 Debugger Command 字段.

关于c++ - 在 Netbeans C++ 中调试无法启动 - OSX Yosemite -,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28101621/

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