Setting up Xcode to debug C Extension

After a long time away from using Xcode to work with C extensions, I am trying to get the debugging environment to work so that I can set breakpoints in Xcode and step through the cpp code while a SketchUp extension is executing it.

Is there a tutorial or documentation somewhere that describes the setup for this? I have done it before a long time ago but can’t remember the steps for configuring everything.

ReadMe files:

Example XCode project file(s) …

Additional tidbits on the SDK intro page …

SketchUp C API: SketchUp C API

In you Scheme configuration you set the Application to launch (pick your SketchUp version)

You need to ensure that SketchUp loads your Ruby C Extension from the build dir so breakpoints work. This might clash with your “normal” logic to load the Ruby C Extension. For this I often use startup args to modify where the extension loads the binary.

I don’t have a ready screenshot for Xcode, but it’d be similar to this VSCode setup:

This kind of setup has let me quickly jump into debugging my Ruby C extensions in VS/VSCode/Xcode without having to manually copy any files or modify source once it’s all setup.

1 Like

A post was split to a new topic: Debugging on macOS