Fix PR16143: Insert DEBUG_VALUE before terminator.