A browser-based debugger

What are you developing?
Post Reply
devan
Posts: 49
Joined: Sat May 14, 2016 1:45 am

A browser-based debugger

Post by devan » Thu Oct 12, 2017 2:32 am

Hi everyone,
I thought I would share my latest project, a toy debugger that works with ST-Links and runs entirely from within your browser (assuming your browser is Chrome, version 61 or newer).



It has some basic functionality that you would expect from a debugger:
  • Reading CPU registers
  • Reading from memory
  • Run/halt/single-step
  • Write/erase flash memory (only tested on STM32F103)
  • Displaying redirected printf() output
It is, however, missing a lot of features that you might expect from a debugger:
  • Setting break points
  • Seeing what line of code you're on
  • Viewing disassembly for the current code being executed
As such, it's not really usable as a replacement for gdb or Visual Studio or your favorite debugger, but it does show the potential for building true debugger capabilities into online IDEs like mbed or Arduino Create. For me, it's mostly been an exercise to learn more about how embedded debuggers work.

If anyone wants to try it out, I have a live demo online which I hope is fairly self-explanatory:
https://devanlai.github.io/webstlink/demo/

I've tested it successfully on Windows, Linux, and Android with both an ST-Link/v2 clone + bluepill and with an STM32F103RB Nucleo board.
I'm hopeful that nobody will need to use Zadig to replace the ST-Link drivers, but my Windows desktop has such a mess of drivers that I can no longer tell which drivers are the original ones.

Note: it may get stuck if you connect to an ST-Link/v2 with no target microcontroller connected.

stevestrong
Posts: 1605
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: A browser-based debugger

Post by stevestrong » Thu Oct 12, 2017 8:16 am

Devan,

thanks for sharing, it is very nice and promising project, which I would use if your latest missing features would be included.

Maybe it would make sense to combine this with the other project currently developed based on Java by Vassilis (http://stm32duino.com/viewtopic.php?f=35&t=2615). He managed to get source code display.

Next step would be to combine this with a nice browser based code editor (like this: https://icecoder.net/), and Arduino build facility.

User avatar
Vassilis
Posts: 313
Joined: Thu May 21, 2015 6:42 am
Location: Thessaloniki, Greece
Contact:

Re: A browser-based debugger

Post by Vassilis » Fri Oct 13, 2017 7:24 pm

Very nice but the above debugger looks like the ST's STM32 ST-LINK Utility. There is no source code display :(

devan
Posts: 49
Joined: Sat May 14, 2016 1:45 am

Re: A browser-based debugger

Post by devan » Fri Oct 13, 2017 8:32 pm

Yeah, unfortunately it's pretty hard to do source code display without having access to the local filesystem. Ideally, it would be integrated with some cloud IDE where it would have full access to the source. Otherwise the user would have to upload a copy of their entire source repo (and any libraries it depends upon).

For the time being, I think I'll focus on features that don't depend on having the full source code.
  • Adding a disassembly view using capstone.js
  • Parsing elf files to get basic addr2line functionality and local/global variable locations

Post Reply