Xiao sam21 keeps ejecting

You can buy or “create” a simple JTAG/SWD debug tool for some of the ARM based XIAO products, eg SAMD21, NRF52840, MG24, even the RP2040.

Since you already have a SAMD21 you could essentially create a CMSIS-DAP programmer/debugger using that. We discussed it in this post. You can also use an RPi Pico.

Debugging can be done from VSCode or if you have an official programmer from them, Segger’s Ozone (I use this option).

Alternatively purchase an “official” device from your local supplier… More expensive though. There are low cost JTAG/SWD “third party” devices but I don’t use those.

Regarding firmware debugging here. I agree you should be able to find the solution yourself. The offer was to give you another alternative.