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
Here is a really useful guide which solved my problem(OSX 10.13.6).
codesign -fs gdbc /usr/local/bin/gdb in terminal: this asks for the root password