It is a problem that appeared when I first updated to macOS Sierra yesterday.
GDB itself is running OK. However, somehow, it cannot run my program. When I type \'run
I've been having multiple issues with Sierra.
For starters my code that had worked on previous OSX versions has stopped working on this version. Nor would it compile.In addition GDB from brew is a complete mess. To add on that other 3rd party libraries got broken (e.g. libevent).
("Good job" Apple).
After "upgrading" to Sierra I suggest the following steps to get GDB working:
Install a newer gcc (Should take about 60 minutes - depending on your CPU etc...)
brew install gcc
Download the source code of GDB
Since gcc and g++ are aliased to the old gcc and g++ make sure to link it to the newer gcc and g++ e.g.:
export CC=`which gcc-6`
export CXX=`which gxx-6`
Configure & Compile gdb:
./configure
make CFLAGS=-Wno-error=deprecated-declarations CXXFLAGS=-Wno-error=deprecated-declarations
sudo make install
I got the same error after updating to macOS Sierra. Temporarily I changed debugger to LLDB using the library lldbmi2:
1. git clone https://github.com/freedib/lldbmi2.git lldbmi2
2. cd lldbmi2
3. mkdir build
4. cd build
5. cmake ../
6. make
7. sudo make install
Once lldbmi2 is installed, you can debug your application by creating a new C/C++ Application in Debug Configurations... and change the GDB debugger (in Debugger tab) from gdb to lldbmi2. Options to lldbmi2 may be set there. Something like /usr/local/bin/lldbmi2 --log.
Everything seems to be working fine, and even better as GDB.