Implements debug scoping.