State Machines

Debug state machine runtime behavior.

This examples shows GammaRay's capabilities in analyzing state machine behavior at runtime.

Problem

The example application shows a simple traffic light with an on/off switch that is driven by a declarative StateMachine.

We can observe that during its normal cycle it transitions from green directly to red, rather than going via yellow as one would expect.

Investigation

While the target application is running, open the State Machine Debugger view in GammaRay to observe the state machine layout, active configuration and configuration changes. It is easily visible that the green state is not transitioning to the greenToRed state as it is supposed to, but the red state directly.

In order to fix this, right click on the green state, and select "Go to creation", which will open your code editor at the right spot in the corresponding source file.

State {
    id: green

    TimeoutTransition {
        timeout: 5000
        targetState: red
    }
}

Files: