Running app with gdb on a Mac

I have an OF app that is segfaulting, and I’d like to be able to diagnose when this is happening.
Unfortunately, I’m unable to run it using gdb. I’m running this directly from the terminal on a Mac, and I use vim for editing my code.

I compile it with make Debug and I can see in bin/ both myApp.app and myApp_debug.app subfolders.
If I run make RunDebug (or if I call it directly with bin/myApp_debug.app/Contents/MacOs/myApp_debug), it runs the app properly and I get the window with the graphics I’m generating.
However, when it crashes it just exits.

I’d like to run it with gdb so that I can inspect the stack trace and variables at the point when it crashes. However, when I do the following:

$ sudo gdb bin/myApp_debug.app/Contents/MacOs/myApp_debug
(gdb) run

It says:

Starting program: /Users/...myApp_debug"
[New Thread 0xe03 of process ....]

but I don’t see the display window come up. I’ve added some debug print statements in the update() function, but it never gets printed, which suggests that the program is not actually running.

Am I doing something wrong, or am I missing a step?

Thanks!

turns out on mac we should be using lldb, thanks to Connor Bell for this tip!