eclipse-gemoc / eclipse-gemoc/gemoc-studio-modeldebugging

Clarify the use of @Step and @Main on the main entry point method

Open
#93 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Apparently having only @Main on the main entry point method does not behave the same if we also add the @Step on it.

This has impact in:
* the tracemanager, if there is no @Step on the main method, we do not get a big step in the trace for it,
* the stack in the debug view

If I take the Logo example (from https://github.com/dvojtise/mde-crashcourse-logo)
```xtend
@Aspect(className=LogoProgram)
class LogoProgramAspect {
@Step
@InitializeModel
def void initializeModel(EList args){
val context = VmFactory.eINSTANCE.createInterpreterRuntimeContext
context.turtle = VmFactory.eINSTANCE.createTurtle
val point = VmFactory.eINSTANCE.createPoint
point.x = 0
point.y = 0
context.turtle.reachedPoints.add(point)
context.turtle.position = point
_self.runtimeContext = context
}

@Main
def void run(){
val context = _self.runtimeContext as InterpreterRuntimeContext
_self.instructions.forEach[i | i.run(_self.runtimeContext as InterpreterRuntimeContext)]
}
}
```
we get this stack:

![runtime-fix_modeldebugging_83 - gemoc studio _102](https://user-images.githubusercontent.com/661468/53162743-fd40e580-35cc-11e9-9a5b-6147a63761bb.png)

and if we add the @Step too, we get
![runtime-fix_modeldebugging_83 - gemoc studio _101](https://user-images.githubusercontent.com/661468/53162779-0fbb1f00-35cd-11e9-8e6b-861f686c6919.png)

This second version (with both @Step and @Main) is more regular in the way we can deal with the stack. (and have a cleaner representation for its content). Additionnaly this make sure to store a value in the trace for it.
The notion of "global context" frame is more a trick that was useful in the context of the concurrent engine but does not really make sense in the context of a sequential engine. (It can represent the engine stack frame that will run the initialize method then run the main method even if it has no stored step in the trace?)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.