I'm trying to implement custom asset macro (similar to what assert.h has), but I want to be able to continue execution after I get and assert.
For example, one such ASSERT
implementation could be:
#define ASSERT(expr) ((void)( (!!(expr)) || (__debugbreak(), 0)))
__debugbreak is an intrinsic function in Microsoft compilers that inserts software breakpoint, equivalent to _asm int 3
in x86. for iOS there are different ways to implement that __debugbreak:
__asm__("int $3");
for x86.__asm__("bkpt #0");
for regular arm.__asm__("brk #0");
for arm64- __builtin_trap()
raise(SIGTRAP)
but with all of them when my assert hits I cannot simply step over and continue the way I can do when working with visual studio; when something assert in my iOS builds it gets stuck at the assert and I have no choice but to terminate, I cannot even move instruction pointer manually and skip the assert.
Is it possible to implement asserts on iOS that would break into debugger and would still allow me to continue execution?
See Question&Answers more detail:os