I’m trying to figure out an effective workflow for debugging plugins I create. Currently, per example, I have an issue where the GUI duplicates itself every time I close and reopen the plug-in window. My GUI is implemented with a singleton class that I made, that contains a vector of Slider pointers. My hunch is that duplicate Sliders are being added to the vector every time the window reopens, but the only way I can test that is by trial and error with changes to my code. Is there a way that I could run the plug-in and also see what values variables hold?
Thanks for any tips!
Yes, several ways. I’m using Windows/VS, but I’d imagine the process is much the same on OSX.
1 - Find and build the JUCE example Audio Plugin Host. This behaves like a tiny, featureless DAW. Configure your debugger to run this exe. In VS, it’s under project properties > Debugging > Command. Make sure Attach is set to “No”. Now when you start debugging in VS, it’ll open an instance of the plugin host. Use it to load your plugin. Now VS debugging works for your plugin just as it does normally for normal programs. Note that if you build and use a Debug version of the plugin host, your debugger will let you debug in both your plugin AND the host, which is sometimes useful.
2 - Use a real DAW, example Ableton: Same process, but point your Debugging > Command to the Ableton exe and set Attach to “YES”. Fire up Ableton and point it at your plugin’s DLL. Click debug in VS and let it get started. Load plugin into Ableton and your debugger will now work like the above. Note that if you use a DAW that quarantines plugins within their own sandboxed process (Bitwig), you’ll need to use THAT process under Command, not the main Bitwig exe.
Both ways let you set breakpoints/view values/etc like normal. Trying to debug your way has to be absolutely awful, so enjoy doing it this way instead!
Thanks! I’ll try to figure it out in Xcode (though if any Mac users can chime in, it’d be appreciated as well!)
In XCode edit your scheme and for the Executable add the JUCE Host app.
When you hit run in Xcode it’ll launch the JUCE Host and any breakpoints in your project will work.
And if you save the “project” in the plugin host after you added your debug plugin, it will reload the plugin without needing to drop it in the host and connect the wires each time.
Thanks all! This is very helpful.