Developer info

General principles

The main principle of the trace instrumentation is the use of one or more model-to-model transformations that modify the temporary model in a suitable way to obtain the instrumentation. The code instrumentation plugins are separated into a generic plugin and another that is specific to barectf. This will simplify the development of trace instrumentation mechanisms for other technologies.

Plugins

The plugins for the tracing support are separated into plugins supporting the HMI for setting trace points (based on Eclipse markers) and those evaluating the trace point information and instrumenting the code accordingly. The following three plugins are responsible for the former and are part of the MOKA Papyrus extension.
  1. org.eclipse.papyrus.moka.tracepoint.service
  2. This plugin aggregates several functions around the tracepoint definition. The first is the definition of an Eclipse markers for tracepoints based on the extension point org.eclipse.core.resources.markers (see plugin.xml). It also defines the trace-point decoration of model elements in the diagram and model explorer. The third is a dialog and preferences for selecting a specific trace action.
  3. org.eclipse.papyrus.moka.ui
  4. This plugin has several purposes in the context of MOKA. In the context of tracepoints, its primary purpose is to provide the context menu (in model explorer and diagram) for manipulating tracepoints and tracepoint actions.
  5. org.eclipse.papyrus.moka.ui.tracepoint.view
  6. The plugin implementing the tracepoint view. This plugin has a content provider for trace points and shows all tracepoints in a workspace in a tabular view. It reacts to change events, i.e. reacts to removal or creation of trace points. It supports the import and exports of trace-points to a file.

The following three plugins are part of Papyrus SW designer and are responsible for doing the instrumentation.

  1. org.eclipse.papyrus.designer.transformation.tracing.library
  2. This plugin provides some functionality for instrumentation that is independent of a particular instrumentation technology such as BareCTF. The plugin contains the documentation (notably about specifying tracepoints) that is technology independent and this small developer information.

    The plugin offers a couple of functions that are useful for specific trace implementations: This includes the definition of a name/instance configurator that is responsible for adding a name attribute and intializes it with the name of the corresponding instance specification in the deployment plan. This is useful to identify a particular instance in the moment that a trace event is produced. In addition, there are some utility functions and code that associate an event name with a tracepoint on a UML element. Even if introduced in the context of BareCTF, it is likely useful for other technologies as well. The utility function class TraceUtils enables the user to check whether a trace point is active on a specific element. This includes not only the trace points that are directly on the element, but also implicit tracepoints (indirectly calculated by the separate class ImplicitTrace). The latter correspond for instance to operations that do not have a trace point, but are part of class that has a tracepoint with the option "AllOperations".

  3. org.eclipse.papyrus.designer.transformation.tracing.barcetf.library
  4. The plugin contains the BareCTF specific instrumentation code, including the creation of a configuration file and suitable initialization code. The instrumentation is based on the modification of the opaque behaviors associated with an operation. The use of the class BehaviorUtil (in the standard designer transformation library) facilitates the addition of code at the beginning or end of a method. The instrumentation transformation is executed before the state-machine transformation. This implies that the tracing of state-machine related operations can be done by modifying (or creating) the entry/exit actions for states and effects in case of transitions.

    The creation of the config.yaml file for BareCTF is based on xtend text templates. The creation of C code from this configuration file is done by an invocation of the barectf command line tool which must be installed (and accessible via the "PATH" variable) on the system of the user.

  5. org.eclipse.papyrus.designer.transformation.tracing.barectf.tests
  6. The plugin contains tests for tracepoint instrumentation based on barectf. The plugin contains a component-based test model with some state-machines and expected code for different trace configurations (read from a .tpoint file). The way, the plugin is done, it is easily extensible for additional tracepoint configurations.