Today You can debug your microcontroller through jtag or some other special interface by using special device.
My idea is to debug microcontroller program through any interfaces that it has without jtag adapters.
You compile your program with repl project source code, then program your microcontroller and you can debug it.
Currently support usb and gsm interfaces(through sim800), stm32f103, stm32f303 and atmega328 microcontrollers. Also you can reprogram your microcontroller without programmer for gsm interface.
For usb interface I decided that it was not necessary because you need programmer to program your microcontroller at least one time.
So how it works. Repl project includes arm thumb and atmega328 instructions emulators.
Those emulators emulate only instructions that depended from instruction location, all other instructions are copied and execute from other place.
I use timer that stops your program execution currently for 1 ms at 1 second period.
Inside timer interrupt handler, my software change stack(repl use 2 stacks one for user program one for debug), and communicates with pc.
On pc side it communicates with my gdb server, that communicate with eclipse ide.
Currently you can pause and run your program, add software breakpoints, read and write ram, eeprom and flash memory, make single instruction step.
For software breakpoints I use branch instructions that emulate while(1); logic. So program stops on that instruction and wait for interrupt.
For single step command next instruction emulated by thumb or atmega instruction emulator.
If you want to use gsm, you need php hosting, with repl_php source code on it.
I also create virtual machine with all needed configuration, so you can download it(link in my repository description) and run.