Next: , Previous: , Up: STARTER Debugger   [Contents]


5 Example Session

This walkthrough uses the starter-core sample peers time-example (ST:TimeExample) and beep-example (ST:Beep) from the core package examples/ tree. Together with a tiny rules file they form the same “alarm clock” setup described in the starter-core manual.

5.1 Plant under test

time:hour
time:minute
time:second

Inputs published by time-example (system clock).

time:local

Output on the time peer: 1 uses local time, 0 uses UTC.

beep:status

Output on the beep peer: 1 makes the host terminal bell.

Put this in your Core rules file (for example /tmp/beep-time.conf):

beep:status {
    SET TRUE WHEN time:hour == 7 && time:minute == 0;
    SET FALSE WHEN TRUE;
}

In three terminals (from a built starter-core tree):

$ starter-core -R /tmp/beep-time.conf
$ ./examples/time-example
$ ./examples/beep-example

Confirm the debug port is listening (default 127.0.0.1:17373), then attach:

$ starter-debugger --core=127.0.0.1:17373

5.2 Monitoring

Live D-Bus signals from the Core debug interface can be printed as they arrive. Shadow tables used by info io / info vars always update; monitor only controls what is printed.

monitor on
monitor all

Print every channel.

monitor off

Silence live printing (shadows keep updating).

monitor CHANNEL
monitor CHANNEL on|off

Toggle one channel. Names: inputs, outputs, io (both), stats, vars, peers, stopped, rules, triggers, engine (rules+triggers).

Useful combinations for this plant:

Example: watch the clock without drowning in other traffic:

(starter) monitor off
(starter) monitor inputs
(starter) monitor stopped

Lines look like:

[monitor 12:00:01.042] InputChanged time:second = 1
[monitor 12:00:02.041] InputChanged time:second = 2

5.3 Breakpoint, watchpoint, and poke

A breakpoint pauses Core before rule apply for an identifier. A watchpoint pauses when that identifier’s value changes. After Stopped, use continue to resume.

Simulated session (clock already running; peers visible):

(starter) status
(starter) info peers
(starter) info io time
(starter) info io beep

(starter) monitor stopped
(starter) monitor rules
(starter) monitor outputs

(starter) watch time:second
Watchpoint 1 on time:second
(starter) break beep:status
Breakpoint 2 on beep:status
(starter) info watch
(starter) info break

When the second ticks, Core stops and the debugger prints something like:

[monitor ...] Stopped reason=watchpoint id=time:second \
  value=17 handle=1
(starter) continue
Continuing.

Force the beep from the debugger (bypasses waiting for 07:00). With the breakpoint on beep:status, the poke pauses before apply:

(starter) set output beep:status = 1
SetOutput beep:status = 1
[monitor ...] Stopped reason=breakpoint id=beep:status \
  value=1 handle=2
(starter) info io beep
(starter) continue
Continuing.
[monitor ...] OutputChanged beep:status = 1
[monitor ...] RuleTriggered on beep:status => ...

The terminal running beep-example should start beeping. Turn it off again:

(starter) set output beep:status = 0
(starter) continue

Optional: switch the time peer to local wall-clock:

(starter) set output time:local = 1
(starter) continue

Clean up when finished:

(starter) delete watch 1
(starter) delete break 2
(starter) monitor off
(starter) quit

5.4 Script form

The same flow is sketched in examples/session.stdbg. Run it non-interactively once the plant is up:

$ starter-debugger --core=127.0.0.1:17373 \
    examples/session.stdbg

Or source examples/session.stdbg from the REPL. Uncomment or edit lines to match how long you want to sit on each Stopped event; interactive use is usually clearer for continue.


Next: GNU Free Documentation License, Previous: Debug Protocol Notes, Up: STARTER Debugger   [Contents]