Debugging release build on MacOS

Hi, it’s quite easy to debug release builds under Visual Studio - just set a flag and it’s possible to step through the app.

Anything similar for XCode that anyone knows of ? thx

App or plugin?
For a plugin, you need to select the host as the debug executable:

Are you looking for ways of setting and hitting breakpoints?

yes

EDIT: Sorry, totally missed the ‘release’ part of your question, which made my answer completely silly

Hi, yes, that’s how the debugger works normally. But when debugging a release build - i.e. Build Configuration is Release - it never stops at breakpoints.

It could be that the code you’re trying to break at just doesn’t exist in an optimised release build.
Try reducing the optimisation setting to -O0 or -O1 first and see if you can break on them?

Make sure ‘Generate Debug Symbols’ is set to YES.

1 Like

ah, lovely - will check that out tommorow - that could well be it

Oh yeah, I forget we have that in a PJ “Custom Xcode Flags” setting:

GCC_GENERATE_DEBUGGING_SYMBOLS=YES, DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
1 Like

CMake has a RelWithDebInfo build type FYI

1 Like

Thx but I don’t use CMake

Hi, been a while - I’ve been using Windows for debug release build recently but really need to get this working on Mac - I still can’t hit a breakpoint.

I’ve got generate debug symbols set to yes, optimiser turned off, GCC_GENERATE_DEBUGGING_SYMBOLS=YES, DEBUG_INFORMATION_FORMAT=dwarf-with-dsym and still nothing happens.

Any other ideas?

Use file logging to debug instead – and if you have a bug only in your Release build… step one: check all variables are initialized.

Rail

When all else ruled out: release changes the timing, so look for Timer::callAfterDelay() that the lambdas only capture Component::SafePointer<MyComponent> or WeakReference<MyStruct>, and at the beginning of the lambda check for nullptr.

juce::Timer::callAfterDelay (100, [ptr=juce::Component<MyComponent>]() mutable
{
    if (!ptr) return;
    ptr->doYourThing();
});

(Kudos to one of @dave96 's talks in Skillsmatter…)

Just had that case in a clients project that only crashed in release for that reason…

thx for the advice guys, but really just want to be able to step through the debugger in release build. this is easy in Windows, can’t believe it’s not possible through projucer/xcode.