On Xcode13.0,my Metal-app successfully run on independent or in Xcode-Instrument, but crash on debugging,why?

I have an App,use Metal-api, it worked well at Xcode12, but when I upgrade Xcode13.0,things changed, it always crash at newFunctionWithName.

How do I get my metal library:

  • My app is multiple-render-backend, so my shader is .glsl, use glslangValidator turn it to .metal
  • get metallib,refrence : Building a Library with Metal's Command-Line Tools,
  • use dispatch_data_create to load metallib, and call newLibraryWithData to get MTLLibrary, then call newFunctionWithNameto get MTLFunction , crash here.

Because it's my company's code,so SORRY, I can't share the code or screenshot.

The same code, worked on Xcode11 and Xcode12,but crash at Xcode13.0 when use Xcode to debug.

Xcode13.0: crash at debug, but successfully run on independent or in Xcode-Instrument.

I have no clue, what should I do to solve this problem on Xcode13.0, or it's the bug on Xcode13.0? @Apple

ps: (that problem above occurred on x86_64-mac,macOS 11.5)

Answered by in 694495022

Hi BenjaminLee,

When launching your application via Xcode, a the app is subject to a few environment changes that Xcode does in order to help you test your application. The debugger is connected to the program, the Metal Debug and Validation layers may be enabled, there might even be instrumentation that halts the app if a memory problem is detected.

If you can share what the platform error message you are obtaining is, we might be able to help you narrow down the cause. If this is not possible, I would recommend to start disabling debugging capabilities in the Xcode scheme to make your app's environment more closely resemble a standalone launch. That way you can narrow down which component is triggering the crash.

Hello Benjamin,

the workaround I found is to disable GPU Frame Capture.

Menu Product | Scheme | Edit Scheme. under the Options tab, set GPU Frame Capture to disabled

Regards

David

Accepted Answer

Hi BenjaminLee,

When launching your application via Xcode, a the app is subject to a few environment changes that Xcode does in order to help you test your application. The debugger is connected to the program, the Metal Debug and Validation layers may be enabled, there might even be instrumentation that halts the app if a memory problem is detected.

If you can share what the platform error message you are obtaining is, we might be able to help you narrow down the cause. If this is not possible, I would recommend to start disabling debugging capabilities in the Xcode scheme to make your app's environment more closely resemble a standalone launch. That way you can narrow down which component is triggering the crash.

How did you finally solve the crash after enabling GPU Frame Capture. I'm currently having the same problem

have any solution?@Graphics and Games Engineer

On Xcode13.0,my Metal-app successfully run on independent or in Xcode-Instrument, but crash on debugging,why?
 
 
Q