1 Reply
      Latest reply: Sep 28, 2016 2:49 AM by eskimo RSS
      Alecazam Level 1 Level 1 (0 points)

        What call are you supposed to make for iOS breakpoints (f.e. assert).  But I don't want asserts default behavior where it kills the thread, I want to be able step over erroneous asserts.  In the past I've used sigtrap().  I've tried setsignal and the variants. I'm looking for the C or C++ equivalent of asm { int 3; } on Intel.  I saw the XCode 8 is removing Debugger and DebugStr, but there's never been an alternative suggested on iOS.

         

        Also how is it that Xcode is still unable to step into C++ 11 lambdas?  There's XCode regex setting to ignore all of the ^std:: functions, but I should be able to step into lambda just like I can step into blocks.  I can't see anyway to adjust the setting to let just lambda through.  If I turn that off, then I'm stepping 10 levels into STL functions before I finally get to the lambda.    This has to be provided by the debugger, not by developers.

        • Re: ios C++ programmatic breakpoints and stepping into C++ lambdas
          eskimo Apple Staff Apple Staff (6,975 points)

          What call are you supposed to make for iOS breakpoints (f.e. assert).

          For debugging I recommend sending the SIGTRAP signal to yourself.

          raise(SIGTRAP);
          

          You’ll have to then step out of the kill system call, but that’s easy.

          In production code, use __builtin_trap.

          The difference is important.  __builtin_trap has some key advantages in production:

          • It traps at the point of failure, meaning you’re more likely to have useful content in registers.

          • It is marked as ‘not returning’, which is more grist for the optimiser.

          OTOH, when debugging it’s actually good to have avoid a ‘not returning’ mechanism because you actually want to step past the failure.

          Also how is it that Xcode is still unable to step into C++ 11 lambdas?

          You should watch WWDC 2016 Session 417 Debugging Tips and Tricks, which discusses some of the challenges in this space.  Beyond that, for debugger specific issues I recommend you post over in Xcode > Debugger.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"