Low-level Tracing

Event and parameter tracing

As part of the SocTrace project, we implemented an initial support of low-level (i.e. raw) tracing of the model events required for building the model-centric representation of the application.

In practice, this means that, for all the events (i.e. breakpoints) caught my mcGDB, we log the parameters we had to read to update our internal representation.

All these information are machine and environment-implementation dependent, hence the tracing is done from the capture modules, based on a simple convention:

class clCreateBufferBP(mcgdb.capture.FunctionBreakpoint):
    [...]

    def prepare_before (self):
       data = {}
       data["mode"] = my_archi.nth_arg(2, my_archi.INT)
       data["retcode_p"] = my_archi.nth_arg(5, my_archi.INT_P)
       [...]

       return (False, True, data)

   def prepare_after(self, data):
       data["ret"] =  my_archi.return_value(my_archi.VOID_P)
       [...]

in mcgdb.capture.FunctionBreakpoint.prepare_before(), the third parameter returned by the function, corresponding to the data transmitted to the prepare_after(), has to be a dict object. If this is the case, then the breakpoint classname and the content of this dictionary will be sent to the tracing module. Likewise, method prepare_after() can extend the content of the dictionary with new values, and the function finish event and parameters will be passed to the tracing module.

Tracing Implementation

The trace generation is implemented in mcGDB mcgdb.toolbox.paje module. This module exports two public methods, before() and after(), that are hooked into mcgdb.capture.FunctionBreakpoint.stop() and mcgdb.capture.FunctionFinishBreakpoint.stop(), respectively.

Module mcgdb.toolbox.paje, as the name suggests, generated traces in the Paje format, thanks to libpoti shared library.

See also

  • Paje format
  • libpoti library
  • mcgdb.toolbox.paje.LIBPOTI path configuration

Tracing Command-line Interface

In GDB, run paje_print [filename] to dump the current content of the tracer.

See also

Note

This support is still experimental. High-level tracing can also be interesting, for instance for graphical execution visualization. See for instance mcgdb.model.gpu.representation.Event and mcgdb.model.gpu.interaction.cmd_PrintFlow. (The trace reader, an Eclipse plugin, is still ST internal.)