Can I debug protected code?

Only to some extent. The final released application will not be debuggable.

Of course the application should be debugged as early as possible. It is possible to apply a partial protection, which comes much closer to the released application than the unprotected application. That way the protection process (as user specified) can be debugged in a normal way. Different behavior to the finished applications will be limited to timing differences, and to code layout differences. Very few bugs originate in those layers. It is possible to have user errors in the actual protection script, but that becomes hard to find out only in rather complex high level scripts.