2

I'm currently working on native plugin for Unity Engine. So there's my custom c++/objective-c++ code running inside Unity Editor process. Breakpoints are working just fine, but when assertion failure happens Editor just crashes and Xcode says Finished running Unity instead of stopping debugger.

I have 2 cases when there may be assertion failure:

  1. Assertion in my own c++/objective-c++ code.
  2. Xcode validation (e.g. Metal API Validation)

In both cases Editor just crashes, Xcode says Finished running Unity, then Unity Crash Reporter appears, and finally macOS crash reported appears.

To start Unity Editor from Xcode I followed this guide: https://docs.unity3d.com/Manual/XcodeFrameDebuggerIntegration.html (Capturing a frame from Unity Editor with Xcode section)

How can I make Xcode/Unity Editor stop execution and show line/assertion info when assertion failure happens?

Devaniti
  • 66
  • 8

1 Answers1

1

This is a design "feature" in Xcode. I noticed such behavior in C++ and it is similar for Obj-C++.

You need to manually add an Exception Breakpoint. See here - How to add Exception Breakpoint in Xcode?

Enable the Exception Breakpoint. Exception - All. Break on - Throw.

I would also recommend enabling all the memory breakpoints. See here - https://developer.apple.com/library/archive/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html

moi
  • 467
  • 4
  • 19
  • That's not it, I tried enabling them before asking this question. For some reason it doesn't work. – Devaniti Sep 16 '21 at 19:08
  • Under Product -> Edit Scheme -> Info - have you set Debug ? – moi Sep 16 '21 at 20:00
  • Also check under Build Settings -> Generate Debug Symbols. Should be Yes for Debug. I'm sure you got this, but check just in case. – moi Sep 16 '21 at 20:02
  • Yeah, I build debug configuration and it have generate debug symbols enabled. Otherwise breakpoints wouldn't work. – Devaniti Sep 20 '21 at 08:16