MDK-SE icon indicating copy to clipboard operation
MDK-SE copied to clipboard

debug code support

Open modom opened this issue 7 years ago • 8 comments

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).

modom avatar Oct 10 '18 11:10 modom

Or more C#-friendly:

#region mdk debug
Echo("Debug Code Here.");
#endregion

modom avatar Oct 10 '18 11:10 modom

Doesn't the #if DEBUG convention already work for this?

kwilliams1987 avatar Oct 10 '18 11:10 kwilliams1987

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.

malware-dev avatar Oct 10 '18 11:10 malware-dev

Maybe it should take the Debug/Release configuration into account, simply. That would be a normal workflow after all.

malware-dev avatar Oct 10 '18 11:10 malware-dev

@malware-dev @kwilliams1987 Yes, sorry I didn't wrote it specifically - removal of debug code is the aim of this request :)

modom avatar Oct 10 '18 12:10 modom

I'd prefer if it simply worked with the existing if DEBUG syntax

hades200082 avatar Mar 22 '19 00:03 hades200082

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.

swarr avatar Mar 05 '21 09:03 swarr

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.

malware-dev avatar Mar 06 '21 16:03 malware-dev