Detection of stack overflow in debug mode