Debugging and Logging

I was curious if there is some way to debug baseLanguage code. For example, I'm having trouble determining what exactly the variables in a referent constraint refer to. I can make some guesses, but being able to step through the code I've created there and to be able to inspect variables during the model transformation would be excellent. That probably isn't trivial. Alternately, is it possible to emit text to a console or to a log file? That might be enough to help me clarify what I'm not clear on. I should note that I turned on the "Save transient models on generation" in the Generation Settings and that in addition to being able to backtrace the transformation of individual nodes is incredibly useful. However, at this point in my understanding of MPS, more tools for debugging editors and their related functionality would be really helpful.

Thanks,

Kevin

3 comments
Comment actions Permalink

Hello, Kevin,

There's no currently debugging support but we have plans to implement it in MPS 2.0. You can debug generated code. Just add debug paramters to MPS' JVM and attach to it with a debugger. If you want to log stuff, you can use our logging language (jetbrains.mps.baseLanguage.logging) or use System.out prints. All the usual Java stuff is available in MPS

Regards,

Konstantin

0
Comment actions Permalink

Hi Konstantin,

Thanks for the response.

Regarding logging, I added some souts to my referent constraint code. I am seeing those in the syslog (I'm on Mac OS), but it's difficult to tell when entries will be written to the log. I assumed the first time a typed ctrl-space in an editor where the constraint applies would create log entries, but the results were inconsistent. I tried altering my constraint and then regenerating, but I didn't get consistent logging. Can you clarify at which point I should see System.outs in my referent constraint?

Also, as an aside, I saw I notice this in console: java.io.FileNotFoundException: ./log4j.dtd (No such file or directory). That's part of a large stack trace.

Thanks,

Kevin

0
Comment actions Permalink

Hello, Kevin,

If we simplify things, your constraints will be invoked on Ctrl+Space.

Regards,

Konstantin

0

Please sign in to leave a comment.