GDB kind of doesn't work on macOS Sierra

前端 未结 8 728
梦毁少年i
梦毁少年i 2020-12-02 07:55

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

相关标签:
8条回答
  • 2020-12-02 08:16

    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:

    1. Install a newer gcc (Should take about 60 minutes - depending on your CPU etc...)

      brew install gcc

    2. Download the source code of GDB

    3. 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`

    4. Configure & Compile gdb:

      ./configure

      make CFLAGS=-Wno-error=deprecated-declarations CXXFLAGS=-Wno-error=deprecated-declarations

      sudo make install

    0 讨论(0)
  • 2020-12-02 08:28

    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.

    0 讨论(0)
提交回复
热议问题