I want to add support for using “Ctrl-C” to pause a running program to my vex v5 GDB port.
My initial idea was to send data over usb serial, then add an ISR that periodically uses the “read char” serial function to check for the 0x03 byte the GDB frontend sends per Interrupts (Debugging with GDB) , and pause the program if I receive that. But as far as I know you need to run the V5’s task scheduler to fetch the latest USB serial data, so I’m worried you wouldn’t be able to pause a program that gets stuck in a tight loop.
I suppose I could also just run the scheduler from the interrupt handler, but I think that would have side effects on the program and make it behave differently when being debugged (I also don’t know if it’s even safe to run the scheduler in the cpu’s IRQ mode).
Is there a way to get input from a computer connected over USB without ticking the scheduler? If not, would my idea of running the scheduler periodically from an interrupt handler work?
It seems like the answers to half my problems for this project are to just use the generic serial api, but I’m still hoping to avoid asking users to use more uncommon hardware - I was able to solve my earlier post here of “how to communicate with the host at all” by intercepting calls to the serial API to a function that adds extra framing, which helped me distinguish between user prints and gdbserver prints.