[英]Debugging in Netbeans C++ doesn't start - OSX Yosemite -
我在為C ++ osx Yosemite進行調試時遇到了麻煩(我嘗試了不同的IDE,並且每個調試器都出了問題),我在Google install gdb上閱讀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的配置:
而且我也遵循以下步驟來安裝gdb:
http://ntraft.com/installing-gdb-on-os-x-mavericks/
謝謝
編輯
在netbeans上調試配置:
我有同樣的問題。 這就是我所做的修復(在優勝美地之下):
$ brew update
事實證明,這一步對我來說是決定性的,因為在更新之前, brew
未找到任何gdb
軟件包:
$ brew install gdb # Error: No available formula for gdb
在那之后:
$ brew update
$ brew search | grep gdb # cgdb gdb gdbm pgdbf
$ brew install gdb
創建證書
啟動鑰匙串訪問應用程序(
/Applications/Utilities/Keychain Access.app
)打開菜單
/Keychain Access/Certificate Assistant/Create a Certificate...
選擇一個名稱(在示例中為
gdb-cert
),將Identity Type
設置為Self Signed Root
,將Certificate Type
設置為Code Signing
然后選擇Let me override defaults
。 在“Continue
上單擊幾次,直到進入“Specify a Location For The Certificate
屏幕,然后將“Keychain
設置為“System
。如果您不能將證書存儲在
System
鑰匙串中,請在login
鑰匙串中創建它,然后將其導出。 然后,您可以將其導入到System
鑰匙串中。最后,使用證書的上下文菜單,選擇“
Get Info
,打開“Trust
項,並將Code Signing
設置為“Always Trust
。您必須退出“鑰匙串訪問”應用程序才能使用證書並通過終止當前正在運行的任務控制進程來重啟
taskgated
服務(注釋:例如,使用sudo pkill taskgated
或重新啟動)。
接着
授予gdb權限以控制其他進程
如果該證書稱為
gdb-cert
,則只需使用:$ codesign -s gdb-cert gdb
注釋:如果找不到
gdb
,則添加安裝路徑。 就我而言:$ codesign -s gdb-cert /usr/local/Cellar/gdb/7.10/bin/gdb
/Netbeans/Preferences/C/C++/Build Tools
字段Debugger Command field
使用gdb
或gdb的安裝路徑(例如/usr/local/Cellar/gdb/7.10/bin/gdb
)。 您是否厭倦了共同設計gdb可執行文件?
Darwin內核要求調試器具有特殊權限,然后才能控制其他進程。 通過對GDB可執行文件進行代碼簽名來授予這些權限。 沒有這些權限,調試器將報告錯誤消息,例如:
Starting program: /x/y/foo Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))
協同設計需要證書。 以下過程說明了如何創建一個:
- 啟動“鑰匙串訪問”應用程序(在/ Applications / Utilities / Keychain Access.app中)
- 選擇鑰匙串訪問->證書助手->創建證書...菜單
- 然后:
- 選擇新證書的名稱(此過程將使用“ gdb-cert”作為示例)
- 將“身份類型”設置為“自簽名根”
- 將“證書類型”設置為“代碼簽名”
- 激活“讓我覆蓋默認設置”選項
- 在“繼續”上單擊幾次,直到出現“為證書指定位置”屏幕,然后將“鑰匙串”設置為“系統”
- 單擊“繼續”,直到創建證書
- 最后,在視圖中,雙擊新證書,然后將“使用此證書時”設置為“始終信任”
- 退出“鑰匙串訪問”應用程序並重新啟動計算機(不幸的是,這是必需的)
創建證書后,可以對調試器進行如下代碼簽名。 在終端中,運行以下命令...
codesign -f -s "gdb-cert" <gnat_install_prefix>/bin/gdb
...其中“ gdb-cert”應替換為上面選擇的實際證書名稱,並應替換為安裝GNAT的位置。
資料來源: https : //gcc.gnu.org/onlinedocs/gcc-4.8.1/gnat_ugn_unw/Codesigning-the-Debugger.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.