10

Whenever I try to debug any program (i.e. a welcome message), I get this prompt. Any ideas how to run the debugger for C++ program?

enter image description here I am using Macbook Pro OS X El Capitan (10.11.3)

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
Lieft1951
  • 139
  • 1
  • 6
  • Since you've tagged this with [tag:gdb], have you actually tried entering `/usr/bin/gdb` or the like into the "Debugger Command" field? – Ken Y-N Feb 19 '16 at 04:53
  • @KenY-N I did, but nothing changed. I still can't press ok, and the `/usr/bin/gdb` was highlighted in red! – Lieft1951 Feb 19 '16 at 05:00

5 Answers5

5

For Mac OSX 10.5 and above,

  1. Install Homebrew (if you don't have it already)

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. Install GDB

    brew install gdb
    
  3. Go to https://sourceware.org/gdb/wiki/BuildingOnDarwin and follow the instructions to code sign the gdb binary.

  4. If you're on Sierra, run the following command in your terminal

    echo "set startup-with-shell off" >> ~/.gdbinit
    
  5. Finally, run the following comamnd in your terminal

    which gdb
    
  6. Copy the output path from that command, (mine was /usr/local/bin/gdb) into the Debugger Command box in Netbeans and start debugging!
Adam Prax
  • 6,413
  • 3
  • 30
  • 31
2

On Linux systems derived from debian, you have to install gdb

sudo apt-get install gdb

Then in debbuger command type

/usr/bin/gdb

More information of gdb can be found in GDB: The GNU Project Debugger

freddycra
  • 21
  • 1
  • 4
1

Make sure gdb is installed in your machine. you can do this by following C:\cygwin64>setup-x86_64.exe -q -P gdb

after this, select gdb as a debugger in netbeans gdb location

Vibhor
  • 11
  • 1
0

Use Synaptic to install gdb. This debugger is required for Netbeans.

DragonLord
  • 6,395
  • 4
  • 36
  • 38
0

On a Mac, I installed HomeBrew first, then followed this exactly on the Sierra OS. Worked perfectly. After Homebrew is installed, you have to create then sign your gdb certificate. Then select it in your IDE debugger section.

The instructions show how to select gdb in Eclipse, but I got it working in NetBeans by pushing the debugger button and typing in the file path in the popup (as mentioned in this document).

https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html

Azurespot
  • 3,066
  • 3
  • 45
  • 73