Virink's Blog logo

Virink's Blog

Let life be beautiful like summer flowers, and death like autume leaves.

 Configure GDB on OSX 10.14 (Mojave)

GBD

GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.

Install

brew update && brew install gdb

Create a Certificate

  • Open Keychain Access
  • In the menu, open Keychain Access > Certificate Assistant > Create a certificate

Certificate Assistan

  • Give it a name
    • Identity type: Self Signed Root
    • Certificate type: Code Signing
    • Check: let me override defaults

Give it a name

  • Continue until it prompts you for: “Specify a location for…”
  • Set Keychain location to System
  • Create a certificate and close assistant.

Specify a location for...

  • Find the certificate in System keychains, right click it > get info (or just double click it)
  • Expand Trust, set Code signing to always trust

Trust

  • Restart taskgated in terminal: killall taskgated
  • Enable root account:
    • Open System Preferences
    • Go to User & Groups > Unlock
    • Login Options > “Join” (next to Network Account Server)
    • Click “Open Directory Utility”
    • Go up to Edit > Enable Root User

Sign and entitle the gdb binary

Create a gdb-entitlement.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.debugger</key>
    <true/>
</dict>
</plist>
</pre>

codesign --entitlements gdb-entitlement.xml -fs gdb-cert $(which gdb)

Refresh the system’s certificates and code-signing data

Run sudo killall taskgated

Maybe you can reboot your computer!

Troubleshooting / further diagnosis

On 10.12 (Sierra) or later with SIP, you need to run this:

echo "set startup-with-shell off" >> ~/.gdbinit

Other commands

chmod 755 gdb
chgrp admin gdb

Finish

PermissionsDarwin

本文标题 : Configure GDB on OSX 10.14 (Mojave)
文章作者 : Virink
发布时间 :  
最后更新 :  
本文链接 : https://www.virzz.com/2019/05/20/configure_gdb_on_osx_mojave.html
转载声明 : 转载请保留原文链接及作者。
转载说明 : 本卡片有模板生成,本人转载来的文章请忽略~~