You can define a function for the express purpose of pausing your program, and entering debug mode. Simply set a breakpoint inside the function! Then, wherever the function is called (e.g., as the result of some failed integrity test), the code will stop right there, and the entire call stack will be available for inspection.
Q: Why bother?
A1: This lets you see the breakpoint as part of your code. Ordinary breakpoints cannot be seen when you simply print or display your code.
A2: You might pass additional parameters, to extend the functionality. It might trigger logging, or provide context that is not available on the call stack.
It is safe to leave this in production code. A breakpoint can trigger only when the App runs in the IDE.