BUG-1704: rework state tracking

In order to understand when a list (or container) is necessary, the
state tracking machinery needs to be reworked. This patch does exactly
that, adding a single-linked stack tracking nodes and their respective
output.

Change-Id: Iaf6ec6b25c05e0505a1dec6faad5fde2ecb791a0
Signed-off-by: Robert Varga <rovarga@cisco.com>
Merge "BUG-1704: rework state tracking"