gdb fails with “Unable to find Mach task port for process-id” error

后端 未结 12 2094
青春惊慌失措
青春惊慌失措 2020-11-28 19:02

My app runs fine but gdb fails to debug it with the following error

(gdb) run
Starting program: /path/to/app 
Unable to find Mach task port for process-id 83         


        
12条回答
  •  天涯浪人
    2020-11-28 19:24

    Here is a really useful guide which solved my problem(OSX 10.13.6).

    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. Run codesign -fs gdbc /usr/local/bin/gdb in terminal: this asks for the root password

提交回复
热议问题