Debugging on S-functions can be done either in Simulink or using a third party software.
The documentation on how to debug an S-function can be found in the following link
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!