How to install gdb (debugger) in Mac OSX El Capitan?

后端 未结 8 963
清酒与你
清酒与你 2020-12-04 11:19

How to install gdb (debugger) in Mac OSX El Capitan ? I have tried installing gdb but failed couple of time.

I was following this URL : http://ntraft.com/installing-

相关标签:
8条回答
  • 2020-12-04 11:49

    On my Mac OS X El Capitan, I use homebrew to install gdb:

    brew install gdb
    

    Then I follow the instruction here: https://sourceware.org/gdb/wiki/BuildingOnDarwin, in the section 2.1. Method for Mac OS X 10.5 (Leopard) and later.

    0 讨论(0)
  • 2020-12-04 11:53

    Once you get the macports version of gdb installed you will need to disable SIP in order to make the proper edits to /System/Library/LaunchDaemons/com.apple.taskgated.plist. To disable SIP, you need to restart in recovery mode and execute the following command:

    csrutil disable
    

    Then restart. Then you will need to edit the bottom part of com.apple.taskgated.plist like this:

    <array>
            <string>/usr/libexec/taskgated</string>
            <string>-sp</string>
    </array>
    

    Then you will have to restart to have the changes take effect. Then you should reenable SIP. The gdb command for the macports install is actually ggdb. You will need to code sign ggdb following the instructions here:

    https://gcc.gnu.org/onlinedocs/gcc-4.8.1/gnat_ugn_unw/Codesigning-the-Debugger.html

    The only way I have been able to get the code signing to work is by running ggdb with sudo. Good luck!

    0 讨论(0)
  • 2020-12-04 11:54

    It seems that MacPorts could be installed in El Capitan right now: https://www.macports.org/install.php Then you probably can install gdb by link you mentioned.

    0 讨论(0)
  • 2020-12-04 11:56

    Just spent a good few days trying to get this to work on High Sierra 10.13.1. The gdb 8.1 version from homebrew would not work no matter what I tried. Ended up installing gdb 8.0.1 via macports and this miraculously worked (after jumping through all of the other necessary hoops related to codesigning etc).

    One additional issue is that in Eclipse you will get extraneous single quotes around all of your program arguments which can be worked around by providing the arguments inside .gdbinit instead.

    0 讨论(0)
  • 2020-12-04 12:01

    Install Homebrew first :

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

    Then run this : brew install gdb

    0 讨论(0)
  • 2020-12-04 12:05

    Here's a blog post explains it very well:

    http://panks.me/posts/2013/11/install-gdb-on-os-x-mavericks-from-source/

    And the way I get it working:

    1. Create a coding signing certificate via KeyChain Access:

      1.1 From the Menu, select KeyChain Access > Certificate Assistant > Create a Certificate...

      1.2 Follow the wizard to create a certificate and let's name it gdb-cert, the Identity Type is Self Signed Root, and the Certificate Type is Code Signing and select the Let me override defaults.

      1.3 Click several times on Continue until you get to the Specify a Location For The Certificate screen, then set Keychain to System.

    2. Install gdb via Homebrew: brew install gdb

    3. Restart taskgated: sudo killall taskgated && exit

    4. Reopen a Terminal window and type sudo codesign -vfs gdb-cert /usr/local/bin/gdb

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