implement debug mode switching for v2

[finishes #45168613]