Search code examples
c++macosdebugginggdbmacos-sierra

gdb os x sierra 10.12.3 not working


the problem is already known, that gdb doesn't work with OS X Sierra anymore.

This is really annoying, since I researched already about the solution, and there were some solutions, but they apparently don't work anymore. I tried to use the .gdbinit file solution and the disable csrutil solution, both doesn't work.

Sooo my question is: Does anyone know how to fix it in 10.12.3 ?

Thank you very much!


Solution

  • So thanks to Basile Starynkevitch, who just gave me the idea to update gdb

    SOLUTION:

    You simply have to update gdb for the latest version (which is 7.12.1 currently). Assuming you have installed Homebrew:

    That's what I did:

    brew update 
    brew remove gdb
    brew install gdb
    

    It has now updated to the latest version.

    Now codesign gdb again with the cert that you used before.

    sudo killall taskgated
    codesign -fs gdb-certi /usr/local/bin/gdb 
    launchctl load /System/Library/LaunchDaemons/com.apple.taskgated.plist
    

    Last step is still to use the workaround to create the .gdbinit file:

    nano ~/.gdbinit 
    

    -> set startup-with-shell off

    Debugging works for me now :) (OS X Sierra 10.12.3 - gdb 7.12.1).

    UPDATE:

    Apparently it will fix certain problems, but not the whole problematic itself. It will still cause errors. Honestly, my solution: When you can: Switch to LLDB and another IDE (Netbeans does not support LLDB). Or use Linux. I currently use Ubuntu with a stick on my MacBook Pro.