• Stars
    star
    498
  • Rank 88,494 (Top 2 %)
  • Language
    Clojure
  • License
    The Unlicense
  • Created about 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A debugger for Clojure and ClojureScript with some unique features.

Flow-storm debugger

A tracing debugger for Clojure and ClojureScript

demo demo

The idea behind FlowStorm is pretty simple :

  • Instrument Clojure code
  • Run it
  • Record everything that happens during execution
  • Provide a GUI to explore your values and execution flow

There are two ways of using it for Clojure :

  • With ClojureStorm (recommended) : Swap your dev Clojure compiler by ClojureStorm and get everything instrumented automatically
  • Vanilla FlowStorm : Just add FlowStorm to your dev classpath and instrument by re-evaluating forms

ClojureStorm is a fork of the official Clojure compiler that adds automatic instrumentation so you don't need to think about it (you can still disable it when you don't need it).

You use it by swapping the official Clojure compiler by ClojureStorm at dev time, using dev aliases or profiles.

If you are looking for ClojureStorm sources here they are : https://github.com/jpmonettas/clojure

Artifacts

FlowStorm latest stable releases :

  • The complete debugger (includes flow-storm-inst)
    • [com.github.jpmonettas/flow-storm-dbg "3.6.10"]
  • A slimmer version with no GUI, to use it for Clojure or ClojureScript remote debugging
    • [com.github.jpmonettas/flow-storm-inst "3.6.10"]

ClojureStorm latest stable releases :

  • Clojure 1.12.0
    • [com.github.jpmonettas/clojure "1.12.0-alpha4_2"]
  • Clojure 1.11.1
    • [com.github.jpmonettas/clojure "1.11.1-8"]

Prerequisites

  • jdk11+
  • clojure 1.11.0+
  • clojure 1.10.* only supported if you use it from source, like {:git/url "https://github.com/jpmonettas/flow-storm-debugger" :git/sha "..."}

QuickStart and Documentation

If you want to use it with Clojure checkout the Clojure QuickStart guide or the ClojureScript QuickStart Guide if you are using ClojureScript.

Please refer to the user guide for a list of features and how to use them.

Features

Flow storm debugger is packed with a ton of features, here is a non-comprehensive list in no particular order :

  • Instrument any Clojure and ClojureScript form (single, namespace or entire codebases)
  • A time travel stepper allows you to jump around your execution
  • Execution call tree explorer
  • Functions calls explorer
  • Inspect any values with the value inspector
  • Define any value and take it to your repl
  • Multi-threaded execution support
  • Tap values to the inspector (via tap>, #tap, and #tap-stack-trace)
  • Loop debugging
  • Infinite loop fuse (via :thread-trace-limit)
  • Remote Clojure and ClojureScript debugging
  • A namespace browser
  • Mutable value debugging
  • Two instrumentation profiles (:light, :full)
  • Conditional tracing
  • Customizable mutable value snapshoting (via flow-storm.runtime.values/snapshot-value multi-method)

Clojure has the repl, does it need a debugger?

I gave a talk recently for the London Clojurians, the first slide goes about my answer to this : https://www.youtube.com/watch?v=A3AzlqNwUXc&t=934s

Some demo videos (newers at the top)

FAQ

Why did you build this?

In this talk I tried to argument that even as amazing as it is to have a repl to poke around when trying to understand a piece of code, there are some inconveniences, that I think can be greatly improved by a debugger.

  • Adding prints (or tap>) is inconvenient because you need to guess where the problem probably is first. Also need to type it (and then remove it), and exploring complex values is annoying in the console, that is why tools like portal, reveal, rebl, etc exist.
  • Defining function parameters and locals with def (for sub form execution) isn't easy for complex values
  • When functions contains loops, maps, filters, etc with anonymous functions is hard to capture every value for further inspection.
  • Being Clojure a dynamic lang, running the program in my head isn't easy if I'm not familiar with the code base

So I want to stop guessing and want a tool that allows me to see what is happening when a program runs (small expression or entire code bases), for when I'm hunting a bug or when I just want to understand how something works.

But also I think some Clojure constraints (immutability and being expression based) allows us to go beyond steppers. We can trace everything that happened when a program run and then inspect the execution using multiple tools, being a stepper one of them.

How does it compare to other Clojure debuggers?

FlowStorm uses the same technique for instrumenting code that Cider uses, they both instrument by code rewriting, and they don't need source maps, they use a custom coordinates system instead.

Cursive is different since uses JDI (Java Debugging Interface) which is more limited for Clojure since it is line, statement and place oriented instead of expression oriented like FlowStorm and Cider.

So how it compares with Cider debugger (which I used full time before FlowStorm) :

  • FlowStorm is a tracing debugger, while Cider is a blocking one
  • FlowStorm supports Clojure and ClojureScript, while Cider only Clojure
  • FlowStorm supports time travel, Cider just step forward
  • FlowStorm provide multiple tools to understand execution, Cider provides forward stepping and some tracing
  • FlowStorm is IDE independent, so if you switch editors/ide you can keep using it
  • Both have data inspection capabilities
  • Both are the same regarding macros, pretty good IMHO
  • Cider is more integrated into the editor oc, while you need a separate window for FlowStorm

What to do when things don't work?

Please create a issue if you think you found a bug.

If you are not sure you can ask in :

Acknowledgements

Big thanks to Roam Research for sponsoring this and other of my projects!

demo

Thanks to Cider debugger for inspiration and some clever ideas for code instrumentation.

More Repositories

1

clograms

Clojure[Script] source code diagrams
Clojure
179
star
2

clindex

A Clojure[Script] source code indexer
Clojure
114
star
3

inspectable

In the spec table
Clojure
71
star
4

old-flow-storm

Tracing companion library for the flow-storm-debugger
Clojure
62
star
5

magic-sheet

Create magic sheets to improve your Clojure[Script] repl experience.
Clojure
24
star
6

hansel

Instrument Clojure[Script] forms to trace it
Clojure
21
star
7

clj-tree-layout

A library for laying out tree nodes in 2D space for Clojure and ClojureScript.
Clojure
17
star
8

cider-storm

An emacs cider front-end for the FlowStorm debugger with support for Clojure and ClojureScript.
Emacs Lisp
16
star
9

pretty-spec

Pretty print clojure.spec forms
Clojure
15
star
10

reagent-flowgraph

A reagent component for laying out tree nodes in 2D space.
Clojure
11
star
11

smart-view

Visualize and explore your solidity smart contracts.
Clojure
10
star
12

shadow-flow-storm-basic

A basic template for using shadow-cljs with FlowStorm debugger
HTML
5
star
13

dotFiles

Personal dot files like .stumpwmrc, .emacs, etc.
Emacs Lisp
5
star
14

xray

Debugging tools for clojure
Clojure
5
star
15

web-extractor

Framework for parsing/extracting data from web pages into a more manageable format
Common Lisp
5
star
16

re-mount-module-browser

A re-frame applications browser
Clojure
3
star
17

nrepl-flowstorm-debug

A minimal repo to debug nrepl and cider middleware using FlowStorm
Clojure
3
star
18

elisp-utils

A collection of elisp utilities I use on my projects
Emacs Lisp
3
star
19

fs-data-window-demo

Demo FlowStorm data-windows features
Clojure
1
star
20

events-pipes

Clojure
1
star
21

flow-stom-dart-debugging

A small template with instructions on how to use flow-storm to debug the ClojureDart compiler
1
star
22

emuland

Microcontrollers emulators in the browser
Clojure
1
star
23

london-meetup

Slides for the FlowStorm presentation of Londom Clojurians meetup group
Clojure
1
star
24

vision

Open cv object recognition with clojure
Clojure
1
star
25

clj-avr

AVR micros related stuff
Clojure
1
star
26

ganache-test

For reporting a ganache bug
JavaScript
1
star
27

clj-scraper

Clojure DSL for scraping html pages
Clojure
1
star
28

docker-flow-storm-basic

A basic template for trying docker and remote debugging with FlowStorm
Clojure
1
star
29

stumpish-notify

Small python and lisp programs to listen to thunderbird and pidgin notifications via Dbus and call stumpwm lisp functions using stumpish to notify unread emails and conversations
Common Lisp
1
star