### Setup FlowStorm nREPL Middleware Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html To use all features of the Outputs tool, ensure you are using nREPL and start it with the `flow-storm.nrepl.middleware/wrap-flow-storm` middleware. This example shows how to add it to Cider's nREPL middlewares. ```clojure (require '[flow-storm.nrepl.middleware :as fsm]) (defn wrap-my-middleware [handler] (fsm/wrap-flow-storm handler)) ``` -------------------------------- ### Vanilla FlowStorm CLI Setup (Linux/OSX) Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Start a REPL with the FlowStorm debugger dependency loaded using the Clojure CLI on Linux and macOS. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' ``` -------------------------------- ### Conditional Server Start in Example Script Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html This code snippet shows how to modify an example script to allow the server to run when executed from Clojure, by adjusting the condition that normally restricts it to Babashka execution. ```clojure (when true #_(= *file* (System/getProperty "babashka.file")) ...) ``` -------------------------------- ### Start REPL with FlowStorm (Linux/OSX) Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Use this command to start a REPL with FlowStorm and ClojureStorm for automatic instrumentation on Linux and macOS. ```bash clj -Sforce -Sdeps '{:deps {} :aliases {:dev {:classpath-overrides {org.clojure/clojure nil} :extra-deps {com.github.flow-storm/clojure {:mvn/version "1.12.5"} com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}}}' -A:dev ``` -------------------------------- ### Start FlowStorm Debugger UI Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Starts the FlowStorm debugger UI with specified options. Use `:pre-require` to load custom namespaces before the UI starts. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 :repl-type :shadow :build-id :my-app :pre-require visualizers ``` -------------------------------- ### Start shadow-cljs Watch and Connect Debugger Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Start your shadow-cljs build and then launch the FlowStorm debugger, specifying the nREPL port, repl-type, and build-id. This command is for Linux and macOS. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 :repl-type :shadow :build-id :my-build-id ``` -------------------------------- ### Start FlowStorm with cljs.main Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Use this command to start a ClojureScript REPL with cljs.main, preloading FlowStorm and instrumenting specified namespaces. This command also opens a browser connected to the REPL. ```bash clj -Sforce -J-Dcljs.storm.instrumentOnlyPrefixes=cljs.user -Sdeps '{:deps {com.github.flow-storm/clojurescript {:mvn/version "1.12.134-3"} com.github.flow-storm/flow-storm-inst {:mvn/version "4.5.9"}}}' -M -m cljs.main -co '{:preloads [flow-storm.storm-preload]}' --repl ``` -------------------------------- ### Start FlowStorm Debugger Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/dev_notes.md The main entry point for starting the FlowStorm debugger GUI. This function initializes and launches the debugger interface. ```clojure flow-storm.debugger.main/start-debugger ``` -------------------------------- ### Conditional Server Start in Babashka Script Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc This code snippet shows how to conditionally start a server, typically used to allow running a script from Clojure directly by commenting out the Babashka-specific condition. ```clojure (when true #_(= *file* (System/getProperty "babashka.file")) ...) ``` -------------------------------- ### Install Thread Breakpoint Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Installs a thread breakpoint at a specified function. The thread will pause execution when the function is called. ```clojure (flow-storm.api/break-at 'my-proj.core/some-fn) ``` -------------------------------- ### Coordinate Examples for Map and Set Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/dev_notes.md Illustrates specific coordinate examples for accessing elements within nested maps and sets in Clojure data structures. ```clojure [3 1 "K-240379483"] => (+ 42 43) ``` ```clojure [3 2 "K1305480196" 3] => (* 2 2) ``` -------------------------------- ### Start FlowStorm UI for Out-of-Process Debugging Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Starts the FlowStorm UI process using the pre-defined `:ui-storm` alias. This command should be run in a separate terminal from the application process. ```bash clj -X:ui-storm ``` -------------------------------- ### Install WebSocket Library for Node.js/React Native Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc For Node.js and React Native environments, install the 'websocket' library using npm. This is required for the debugger to establish a connection. ```bash npm install websocket --save ``` -------------------------------- ### Start FlowStorm Debugger Instance Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Run this command in a terminal to start the FlowStorm debugger. Ensure you have the correct version of FlowStorm debugger specified. This command configures the debugger to listen on port 9000, use shadow-cljs for REPL integration, identify your build with ':my-app', and use WebSocket port 7722. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 :repl-type :shadow :build-id :my-app :ws-port 7722 ``` -------------------------------- ### Start FlowStorm Debugger Instance Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Use this command to start a FlowStorm debugger instance on a second terminal. Ensure you have the correct version of the debugger library. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 :repl-type :shadow :build-id :your-app-build-id :debugger-host '"YOUR_DEV_MACHINE_IP"' ``` -------------------------------- ### Plugin CSS Styling Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Example of CSS for a plugin, demonstrating how to scope styles using the plugin key as a class. ```css .my-plugin .table-view { -fx-font-family: 'monospaced'; } ``` -------------------------------- ### Start FlowStorm Debugger with Custom Ports and Hosts Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Use this command to start the FlowStorm debugger when connecting to a remote process or when needing to configure specific ports for the NREPL and WebSocket server. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port NREPL-PORT :runtime-host '"YOUR-APP-BOX-IP-ADDRESS"' :debugger-host '"YOUR-BOX-IP-ADDRESS"' :ws-port WS-SERVER-PORT ``` -------------------------------- ### Start FlowStorm Debugger for Web Workers Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Use this command to start the FlowStorm debugger instance for a web worker. Ensure the ports match your build configuration. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 :repl-type :shadow :build-id :my-web-worker :ws-port 7733 ``` -------------------------------- ### Start FlowStorm Debugger for Clojure Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Use this command to start the FlowStorm debugger when working with a standard Clojure project. Ensure the FlowStorm debugger dependency is added to your project. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger ``` -------------------------------- ### Leiningen Project Setup for FlowStorm Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Configure your project.clj with this profile to add FlowStorm dependencies. This profile excludes the official Clojure dependency to avoid conflicts. Remember to activate the profile when starting your REPL. ```clojure (defproject my.project "1.0.0" :profiles {:1.12-storm {:dependencies [[com.github.flow-storm/clojure "1.12.5"] [com.github.flow-storm/flow-storm-dbg "4.5.9"]] :exclusions [org.clojure/clojure]}} ...) ``` -------------------------------- ### Install Local FlowStorm Artifacts Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/dev_notes.md Build and install local versions of the inst and dbg artifacts for FlowStorm. Ensure you have the correct version number set. ```bash $VERSION=3.8.4-SNAPSHOT make install-inst # for building and installing the inst artifact ``` ```bash $VERSION=3.8.4-SNAPSHOT make install-dbg # for building and installing the dbg artifact ``` -------------------------------- ### Start FlowStorm Debugger for React Native Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Use this command to start the FlowStorm debugger and connect to a ClojureScript React Native application. Ensure you have shadow-cljs set up and the flow-storm-inst dependency added. Replace YOUR_DEV_MACHINE_IP with your machine's IP address and :your-app-build-id with your actual build ID. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 :repl-type :shadow :build-id :your-app-build-id :debugger-host "YOUR_DEV_MACHINE_IP" ``` -------------------------------- ### Start shadow-cljs Watch and Connect Debugger (Windows) Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Launch the FlowStorm debugger on Windows, specifying the nREPL port, repl-type, and build-id. Note the different quoting for the version string. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version """4.5.9"""}}}' -X flow-storm.debugger.main/start-debugger :port 9000 :repl-type :shadow :build-id :my-build-id ``` -------------------------------- ### Configure JUL Logging Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Example of a logging.properties file to disable FlowStorm and Clojure Storm logging by setting their levels to SEVERE. ```text handlers = java.util.logging.ConsoleHandler flow_storm.level = SEVERE clojure.storm.level = SEVERE ``` -------------------------------- ### Require FlowStorm API and Connect Locally Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html After setting up FlowStorm, require the API namespace and then call `local-connect` to start the debugger GUI and prepare for debugging. ```clojure user> (require '[flow-storm.api :as fs-api]) ;; the only namespace you need to require user> (fs-api/local-connect) ;; will run the debugger GUI and get everything ready ``` -------------------------------- ### Connect to Debugger for React Native Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Bash command to start a FlowStorm debugger and connect to a shadow-cljs nREPL server for debugging React Native applications. ```bash ``` -------------------------------- ### Global Leiningen Profiles for FlowStorm Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Configure your global ~/.lein/profiles.clj to include FlowStorm and optional plugins. Use the +1.12-storm profile to start your REPL. ```clojure {:1.12-storm {:dependencies [[com.github.flow-storm/clojure "1.12.5"] [com.github.flow-storm/flow-storm-dbg "4.5.9"]] :exclusions [org.clojure/clojure]} ;; Optional plugins you find yourself using regularly :fs-web-plugin {:dependencies [[com.github.flow-storm/flow-storm-web-plugin "1.0.0-beta"]] :jvm-opts ["-Dclojure.storm.instrumentOnlyPrefixes.webPlugin=org.httpkit.server,ring.adapter.jetty,next.jdbc.result-set" "-Dflowstorm.plugins.namespaces.webPlugin=flow-storm.plugins.web.all"] ...} ``` -------------------------------- ### Global Leiningen Profile for FlowStorm Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Configure your global ~/.lein/profiles.clj to easily start REPLs with FlowStorm and ClojureStorm. ```clojure {:1.12-storm {:dependencies [[com.github.flow-storm/clojure "1.12.5"] [com.github.flow-storm/flow-storm-dbg "4.5.9"]] :exclusions [org.clojure/clojure]} ;; Optional plugins you find yourself using regularly :fs-web-plugin {:dependencies [[com.github.flow-storm/flow-storm-web-plugin "1.0.0-beta"]] :jvm-opts ["-Dclojure.storm.instrumentOnlyPrefixes.webPlugin=org.httpkit.server,ring.adapter.jetty,next.jdbc.result-set" "-Dflowstorm.plugins.namespaces.webPlugin=flow-storm.plugins.web.all"] ...}} ``` -------------------------------- ### Launch FlowStorm Debugger UI with Shadow-cljs Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Run this command in a terminal to start the FlowStorm debugger UI, specifying the nrepl port, repl type, and build ID. Reload your application page to connect. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 :repl-type :shadow :build-id :my-app ``` -------------------------------- ### FlowStorm Debugging Example Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/Readme.md This code demonstrates a function that processes a range of numbers. It's useful for comparing debugging approaches between expression-oriented (FlowStorm) and line-oriented debuggers. ```clojure (defn foo [n] (->> (range n) (filter odd?) (partition-all 2) (map second) (drop 10) (reduce +))) (foo 70) ``` -------------------------------- ### Starting FlowStorm Debugger UI Locally Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Launch the FlowStorm debugger UI on your local machine, connecting to a remote nREPL server through an established SSH tunnel. Ensure the specified port matches the tunnel configuration. ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 ``` -------------------------------- ### Connect Runtime to Debugger WebSocket Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/dev_notes.md Initiate a connection from the runtime process to the debugger's websocket server. This is essential for remote debugging setups where the debugger and runtime are in separate processes. ```clojure flow-storm.runtime.debuggers-api/remote-connect ``` -------------------------------- ### FlowStorm Stepping Example Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/Readme.md This code snippet is designed to test stepping capabilities in debuggers. It includes a literal set within a map, which may present challenges for some line-stepping debuggers. ```clojure (defn bla [] {(+ 1 2) (first #{3}) 2 (+ 1 1) 4 (+ 2 2) 6 (+ 3 3) 8 (+ 4 4) 10 (+ 5 5) 12 (+ 6 6) 14 (+ 7 7) 16 (+ 8 8)}) (bla) ``` -------------------------------- ### Global deps.edn Aliases for FlowStorm Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Configure your global ~/.clojure/deps.edn to include FlowStorm and optional plugins. Use the :1.12-storm alias to start your REPL. ```clojure {... :aliases {:1.12-storm {:classpath-overrides {org.clojure/clojure nil} :extra-deps {com.github.flow-storm/clojure {:mvn/version "1.12.5"} com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}} ;; Optional plugins you find yourself using regularly :fs-web-plugin {:extra-deps {com.github.flow-storm/flow-storm-web-plugin {:mvn/version "1.0.0-beta"}} :jvm-opts ["-Dclojure.storm.instrumentOnlyPrefixes.webPlugin=org.httpkit.server,ring.adapter.jetty,next.jdbc.result-set" "-Dflowstorm.plugins.namespaces.webPlugin=flow-storm.plugins.web.all"] ...}} ``` -------------------------------- ### Record Parallel Execution with pmap Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Example of recording parallel execution using `pmap` for debugging multi-thread interleaving. Ensure multi-thread timeline recording is enabled. ```clojure (defn run-parallel [] (->> (range 4) (pmap (fn [i] (factorial i))) (reduce +))) ``` -------------------------------- ### Development Utilities Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/dev_notes.md A set of utility functions for local development, including starting and stopping the system, refreshing namespaces, and enabling spec checking for the debugger state. These are accessed via the `dev` namespace. ```clojure start-local ``` ```clojure start-remote ``` ```clojure stop ``` ```clojure refresh ``` -------------------------------- ### Configure shadow-cljs.edn for FlowStorm Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Modify your shadow-cljs.edn to include the FlowStorm preload and configure the nrepl port. Ensure `flow-storm.storm-preload` is the first preload if others exist. ```clojure {:deps {:aliases [:1.12-cljs-storm]} :nrepl {:port 9000} ... :builds {:my-app {... :devtools {:preloads [flow-storm.storm-preload] :http-port 8021}}}} ``` -------------------------------- ### Clojure Function Definition Example Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/dev_notes.md An example of a Clojure function definition used to illustrate the coordinate system for tracing expressions. ```clojure (defn foo [a b] (+ a b)) ``` -------------------------------- ### Explore Thread Timeline Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Demonstrates basic exploration of a thread timeline, including counting entries, taking initial elements, and retrieving a specific entry by index. ```clojure user> (count timeline) 798 user> (take 3 timeline) ; (#flow-storm/fn-call-trace [Idx: 0 org.my-app/run-server] ; #flow-storm/fn-call-trace [Idx: 1 org.my-app/read-config] ; #flow-storm/fn-call-trace [Idx: 2 org.my-app/check-config]) user> (get timeline 0) ; #flow-storm/fn-call-trace [Idx: 0 org.my-app/run-server] ``` -------------------------------- ### Shadow-cljs Configuration for Multiple Builds Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Configure your shadow-cljs.edn to use different preloads for your application and web worker builds, specifying their respective init functions and preloads. ```clojure {... :builds {:app {:target :browser ... :modules {:my-app {:init-fn my.app/init :preloads [my-app.main-storm-preload]} :my-webworker {:init-fn my.app.worker/init :preloads [my-app.webworker-storm-preload] :web-worker true}}}}} ``` -------------------------------- ### Configure FlowStorm Plugins Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html To use FlowStorm plugins, add their dependency and set the `flowstorm.plugins.namespaces` JVM property to specify the main namespaces of the plugins to be loaded at startup. ```bash "-Dflowstorm.plugins.namespaces=flow-storm.plugins.my-plugin.all" ``` -------------------------------- ### Clojure Function with Map and Set Example Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/dev_notes.md A more complex Clojure function demonstrating nested data structures like maps and sets, used to illustrate advanced coordinate system examples. ```clojure (defn foo [a b] (assoc {1 10 (+ 42 43) 100} :x #{(+ 1 2) (+ 3 4) (+ 4 5) (+ 1 1 (* 2 2))})) ``` -------------------------------- ### deps.edn Project Setup for FlowStorm Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Add this alias to your project's deps.edn file to include FlowStorm dependencies. Ensure you use the correct versions for clojure and flow-storm-dbg. This setup disables the official Clojure compiler. ```clojure {... :aliases {:1.12-storm {;; for disabling the official compiler :classpath-overrides {org.clojure/clojure nil} :extra-deps {com.github.flow-storm/clojure {:mvn/version "1.12.5"} com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}}} ``` -------------------------------- ### Start FlowStorm Debugger with SSH Tunnel Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Starts the FlowStorm debugger UI, connecting to a remote process via an established SSH tunnel. Assumes the remote process has an nREPL server running on port 9000 and the debugger websocket server is on the default port. ```bash ssh -L 9000:localhost:9000 -R 7722:localhost:7722 my-debuggee-box.com ``` ```bash clj -Sforce -Sdeps '{:deps {com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}}' -X flow-storm.debugger.main/start-debugger :port 9000 ``` -------------------------------- ### Set Trace Limits via JVM Prop Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Configure thread trace limits at startup using JVM options. `flowstorm.throwOnLimit` can be set to `true` to throw an exception when the limit is reached. ```jvm -Dflowstorm.threadTraceLimit=1000 ``` ```jvm -Dflowstorm.throwOnLimit=true ``` -------------------------------- ### Global deps.edn Alias for FlowStorm Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Configure your global ~/.clojure/deps.edn to easily start REPLs with FlowStorm and ClojureStorm. ```clojure {... :aliases {:1.12-storm {:classpath-overrides {org.clojure/clojure nil} :extra-deps {com.github.flow-storm/clojure {:mvn/version "1.12.5"} com.github.flow-storm/flow-storm-dbg {:mvn/version "4.5.9"}}} ;; Optional plugins you find yourself using regularly :fs-web-plugin {:extra-deps {com.github.flow-storm/flow-storm-web-plugin {:mvn/version "1.0.0-beta"}} :jvm-opts ["-Dclojure.storm.instrumentOnlyPrefixes.webPlugin=org.httpkit.server,ring.adapter.jetty,next.jdbc.result-set" "-Dflowstorm.plugins.namespaces.webPlugin=flow-storm.plugins.web.all"] } ...}} ``` -------------------------------- ### Get Thread Timeline Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Retrieves the timeline of a specific thread using its ID. This timeline can then be explored programmatically. ```clojure (def timeline (ia/get-timeline 32)) ``` -------------------------------- ### Clear All Breakpoints in FlowStorm Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Remove all installed breakpoints by calling `flow-storm.api/clear-breaks`. This is a convenient way to reset all breakpoint configurations. ```clojure flow-storm.api/clear-breaks ``` -------------------------------- ### Get Timeline for a Thread Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/llm-prompt.txt Retrieves the timeline for a specific thread within a given flow. Timelines are sequences of execution steps. ```clojure (flow-storm.runtime.indexes.api/get-referenced-maps-timeline flow-id thread-id) ``` -------------------------------- ### Add a Printer with Message Format Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Use this to add a print point with a custom message format. The `%s` placeholder will be replaced by the printed value. ```clojure (fs/add-printer "My value: %s" my-value) ``` -------------------------------- ### Retrieve Form at Coordinate Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/llm-prompt.txt Retrieves the Clojure form associated with a specific form-id and coordinate. Use a nil coordinate to get the outer form. ```clojure (flow-storm.runtime.indexes.api/get-form-at-coord form-id coord) ``` -------------------------------- ### Configure IntelliJ IDEA for FlowStorm File Opening Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Configure IntelliJ IDEA to open project files with FlowStorm. This command uses the 'idea' CLI to open the file at the specified line. ```clojure "-Dflowstorm.fileEditorCommand=idea --line <> <>" ``` -------------------------------- ### Configure Emacs for FlowStorm Jar Opening (Cross-OS) Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc This configuration for Emacs works on all operating systems (requires FlowStorm >= 3.17.3) to open files inside JARs. It uses Cider's functionality to find and open files. ```clojure "-Dflowstorm.jarEditorCommand=emacsclient --eval '(let ((b (cider-find-file "jar:file:<>!/<>"))) (with-current-buffer b (switch-to-buffer b) (goto-char (point-min)) (forward-line (1- <>))))'" ``` -------------------------------- ### Exploring Multi-thread Timeline Entries Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Process and inspect entries from a multi-thread timeline. This example shows taking the first few entries and converting them to immutable maps. ```clojure user> (->> mt-timeline (take 3) (map ia/as-immutable)) ({:thread-id 32, :type :fn-call, :fn-call-idx 0, :fn-ns "org.my-app", :fn-name "run", :fn-args [], :ret-idx 797, :parent-idx nil, :form-id -798068730, :idx 0} ... ...) ``` -------------------------------- ### Configure Main ClojureScript Storm Preload Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc This preload configuration is for your main ClojureScript application build. It specifies the debugger host and WebSocket port for runtime connection. ```clojure (ns my-app.main-storm-preload (:require [cljs.storm.tracer] [flow-storm.tracer :as tracer] [flow-storm.runtime.debuggers-api :as dbg-api])) (dbg-api/start-runtime) (tracer/hook-clojurescript-storm) (dbg-api/remote-connect {:debugger-host "localhost" :debugger-ws-port 7722}) ``` -------------------------------- ### Retrieve and Inspect an Expression Entry Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.html Get a specific timeline entry by its index and convert it to an immutable map to view its details, such as type, coordinate, and result. ```clojure user> (def expr (-> timeline (get 3) ia/as-immutable)) user> expr {:type :expr, :coord [2 2 1], :result 4, :fn-call-idx 2, :idx 3} ``` -------------------------------- ### Set Heap Limit via JVM Property Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Configure a heap limit at startup using a JVM option to automatically stop recording traces when a specified amount of heap space is consumed, preventing memory issues. ```jvm "-Dflowstorm.heapLimit=1000" ``` -------------------------------- ### Get Current Value in Data Window Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/docs/user_guide.adoc Retrieve the current value being displayed in a specific data window. This is useful for inspecting the data available to your visualizers. ```clojure (viz/data-window-current-val :chess-board-dw) ``` -------------------------------- ### Get All Recorded Flows Source: https://github.com/flow-storm/flow-storm-debugger/blob/master/llm-prompt.txt Retrieves a map of all recorded flows, with flow-ids as keys and vectors of thread-ids as values. Use this to discover available flows and their threads. ```clojure (flow-storm.runtime.indexes.api/all-flows) ```