Ghc-debug-web - Web visualiser for ghc-debug

I was told to post this here, my apologies if not relevant. This was my summer project this year (I’m a 3rd year undergrad). I also wanted to include more pictures, but I got an error saying I can only have 1 because I’m a new user.

ghc-debug-web is like ghc-debug-brick but on the web, with graphic visualisations of the heap. Like ghc-debug-brick, you can instrument a debuggee with GHC.Debug.Stub, and then look at the memory layout.

The layout of the main page is similar to ghc-debug-brick. Instead of using keyboard commands to change modes, you can click on the bar up top, and instead of navigating the object trees with the keyboard, you can use the mouse.

Here is a demonstration of the visualisation. The debuggee is a simple tree balancing program, so that the shared memory structure can be seen in the visualisation. Note the shared children across nodes. The root node of the structure is rendered yellow.

Since GC Root objects can be very large, the graph is usually compressed, denoted by the green nodes. Clicking a green node will expand its children. A compressed root node appears in a lighter shade of green to show that it is both the root, and compressed.

The selection page also includes eventlog2html, so that if the debuggee is compiled with -prof and run with -l/-l-agu, the eventlog file can be uploaded and visualised in the browser.

To try it for yourself, the repo is here: GitHub - KC1423/ghc-debug-web . It’s not without it’s problems, so if I’ve missed out something or something needs explaining, just ask.

26 Likes

Edit: here are some more images -

Main page where you can select a debuggee or upload an eventlog

Main debugging page, where you can select closures, take snapshots, toggle modes up top, etc.

Here is a partial view of a visualisation with compressed children. Click a green node to show its children. The root node appears in a different shade of green to show it is root and compressed.

Here is the same visualisation again after having clicked on the root node.

3 Likes

Aha! Thanks for writing this down after our chat. This is excellent work and I’m excited to try it out once I’m back at work.

@mpickering @fendor and @wz1000 I know you will be interested in checking this out.

Once again, Great work!

3 Likes