How to get gdb to work using macports under OSX 10.11 El Capitan?

后端 未结 2 586
小蘑菇
小蘑菇 2021-01-06 04:03

This arose from How to install gdb (debugger) in Mac OSX El Capitan?.

I have macports working under el capitan no problem and have installed the gdb port but I can\

相关标签:
2条回答
  • 2021-01-06 04:18

    I just settled this problem by using the following command.

    sudo dseditgroup -o edit -a yourusername -t user procmod

    Which adds you to group procmod.

    It's just because only users in procmod can use function task_for_pid, and you can find that the own group of /opt/local/bin/ggdb is procmod.

    0 讨论(0)
  • 2021-01-06 04:18

    I installed MacPorts gcc9 (gcc-9.2.0) on an older iMac (10.11.6 El Capitan), and recently needed to install the gdb port (gdb-9.1.0); predictably encountering the same code-signing / permission issue.

    There's a list of instructions on github that worked perfectly for me, simply replacing: /usr/local/bin/gdb with: /opt/local/bin/ggdb. Since such snippets on github may be ephemeral, so I'll paste it here:

    1. Open Keychain Access
    2. In the menu, open Keychain Access > Certificate Assistant > Create a certificate
    3. Give it a name (e.g. gdbc)
      • Identity type: Self Signed Root
      • Certificate type: Code Signing
      • Check: let me override defaults
    4. Continue until it prompts you for: "specify a location for..."
    5. Set Keychain location to System
    6. Create a certificate and close assistant.
    7. Find the certificate in System keychains, right click it > get info (or just double click it)
    8. Expand Trust, set Code signing to always trust
    9. Restart taskgated in terminal: killall taskgated
    10. Enable root account:
      1. Open System Preferences
      2. Go to User & Groups > Unlock
      3. Login Options > "Join" (next to Network Account Server)
      4. Click "Open Directory Utility"
      5. Go up to Edit > Enable Root User
    11. Run codesign -fs gdbc /usr/local/bin/gdb in terminal: this asks for the root password
    12. Disable root account (see #10)

    Done!

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