diff --git a/README.md b/README.md index aadd55fb2a..ce1cd0b785 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ # Sorbet NOTE: This code is in Sourcegraph's fork of Sorbet, modified to add support -for emitting SCIP indexes. See scip-ruby.md for details on running tests etc. -The original README follows below. +for emitting SCIP indexes. See [scip-ruby.md](./scip-ruby.md) for details +on running tests etc. The original README follows below. --- diff --git a/scip-ruby.md b/scip-ruby.md index 50e9a9bbbf..7c43866f9b 100644 --- a/scip-ruby.md +++ b/scip-ruby.md @@ -32,3 +32,28 @@ Updating snapshots ``` ./bazel test //test/scip:update --config=dbg ``` + +## Debugging + +So far, I've mostly been using print debugging +(along with minimized test cases) +since I find it more helpful to see a bunch of output +along with the control flow graph all at once. + +Typically, I'll copy over the minimized code +to the root and run: + +``` +./bazel build //main:scip-ruby --config=dbg && ./bazel-out/darwin-dbg/bin/main/scip-ruby tmp.rb -p cfg-text --index-file index.scip +``` + +Alternately, it may be useful to create a `tmp.rb` +file under the `test/scip/snapshots/` directory +(it will be gitignored) and run: + +``` +# Check +./bazel test //test/scip:tmp --config=dbg +# View output +./bazel test //test/scip:update_tmp --config=dbg && cat test/scip/snapshots/tmp.snapshot.rb +```