The only way I know how to debug an arduino is usen the SerialPort which is like using a odd tool after trying vsCode in my job. Could someone show me how is it the prefered way to acomplish it?
SerialPort is just too slow and if I want to know what is happening in a critical section is not the best way to do it.
Arduino doesn’t come with a custom debugging tool. I`m sorry to tell you that unlike most other IDEs, there is no official Arduino debugging feature inside the arduino IDE.
However, thanks to the community we have access to unofficial tools like using Arduino simulators and emulators or and external software debuggin tool. Personally I prefer simulator. Once you get use of it is simpler.
More about this here: https://www.circuito.io/blog/arduino-debugging/