For assert macros in my iPhone project, I\'m looking for a way to programmatically break into the debugger. On Windows (MSVC++), I can use __debugbreak() for this purpose. I
A helpful person on Apple's developer forum gave me the tip to use asm("trap")
when running on the device and asm("int3")
when running on the simulator. This makes the program break into the debugger if you started your programm in debug mode (Option-Command-Y).
(__builtin_trap()
also breaks into the debugger, but you can't continue afterwards. assert(false)
terminates the program with a message, but doesn't break into the debugger.)