Anyone know what are the right tools for both debugging and profiling audio plugins with xcode?
Well personally I just use the built in debugger (which I think is a front end to GDB) and Shark for profiling. Just do Run->Run with performance tool->Shark.
ok — I knew about GDB but wasn’t aware of shark.
XCode’s GDB wrapper is a pretty miserable debugger and I have a lot of issues with it. GDB is a pretty good debugger, it’s the wrapper part that’s bad - and XCode only has the most limited understanding of C++ structure.
Here are some hints that have been helpful.
Juce’s default for debug symbols is DWARF - I get better results if I change that to “DWARF with dSYM file” (in the Build Options section of the Info window for your XCode project - don’t forget to Clean and rebuild from scratch!)
By “better” I mean that I see fewer problems - for example, I otherwise frequently have the issue that XCode won’t stop on a breakpoint that it has definitely passed through, or conversely, that you can’t disable or turn off breakpoints once you’ve hit them the first time.
I still haven’t managed to get it to work with the separate Juce files - this is a bit of a pain because when I step through Juce code, there’s a 20 second delay on my fast machine with lots of RAM while it opens juce_amalgamated.cpp but I can deal. I suggest you experiment with that if you were expecting to do a lot of debugging on a slower machine, because I think it’d make debugging really painful.
I find most of the XCode variable display panels outside the main debugger window to be useless because they don’t seem to correctly resolve addresses nearly all the time and so you get nothing… but…
BEST PROTIP: you don’t have to use any of the XCode tools - because your “console” window is in fact a GDB terminal session that you can simply type into and press return. I do an awful lot of that when I’m looking at variables - but it’s much easier to set breakpoints and such using XCode.
JUCE PROTIP: If you want to see the value of a Juce String (call it foo), go to the console window and type: print foo.toCString()
QUESTION: I don’t understand these data formatters, they seem to be something you could install to directly view Juce structures (like Sting but looking at Arrays would be oh-so-useful. Does anyone know how to do this - or has done this and has formatters to share?
I changed it to DWARF recently for a really good reason… which I’ve completely forgotten! But the dSYM option was definitely causing some kind of obscure build problem that took me a long time to track down. Sorry I can’t remember exactly what it was now… but if you do enable dSYM and hit any weirdnesses, try turning it off.
Damned if you do, damned if you don’t!
I think this goes back to the “XCode is pretty buggy” theme again. Quel drag.