MDK-SE
MDK-SE copied to clipboard
debug code support
Support marking of some lines of code as debug-only. Some kind of simple preprocessor. For example like in C/C++:
#ifdef DEBUG
Echo("Debug Code here.");
#endif
or any other type of marking (for example; //@debug to mark the line as debug, and/or //@debug-begin //@debug-end to mark the debug code section inbetween).
The inclusion/exclusion during deployment of debug code should be selectable in MDK options.
If marked wrongly, this might cause some code being undeployable in debug or release configuration - however that's problem of use, nothing to take care of in MDK (only if it would be easy to implement warning).
Or more C#-friendly:
#region mdk debug
Echo("Debug Code Here.");
#endregion
Doesn't the #if DEBUG convention already work for this?
It should use the traditional #if DEBUG, yes, but I believe the request is about actually removing the debug code from deployment.
This is a common use case and is essentially an extension of the .debug.cs feature., so it might be considered, especially if it's to be an option. I cannot promise anything at this time though.
Maybe it should take the Debug/Release configuration into account, simply. That would be a normal workflow after all.
@malware-dev @kwilliams1987 Yes, sorry I didn't wrote it specifically - removal of debug code is the aim of this request :)
I'd prefer if it simply worked with the existing if DEBUG syntax
Seems that MDK does not use symbols defined in project, as a workaround - symbol could be defined in start of each file by code:
#define DEBUG
It would be great if any symbols defined in project properties would be used, this will allow to turn on/off debug code by just configuring proper symbols in project.
MDK is just a publisher. Any support like this has to be explicitly made to actively remove code within such sections, and that's more effort that I'm ready to put into this at this point. The actual interpretation of the published code is fully up to SE, not MDK.