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)

2
  • Since you've tagged this with gdb, have you actually tried entering /usr/bin/gdb or the like into the "Debugger Command" field? Commented Feb 19, 2016 at 4:53
  • @KenY-N I did, but nothing changed. I still can't press ok, and the /usr/bin/gdb was highlighted in red! Commented Feb 19, 2016 at 5:00

5 Answers 5

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!
Sign up to request clarification or add additional context in comments.

Comments

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

Comments

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

Comments

0

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

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.