Add hooks for debugging dynamic scope