Debug build for mingw/cygwin

I’m compiling juce in windows using mingw from cygwin.

To compile it, I just used the devcpp/ file, and added the -mno-cygwin keword. This works, as far as I can see, perfectly.

But how do I make a debug build? I tried adding -D_DEBUG, but then I get some mysterious crashes. Is there anything else I have to do?