From 58f8019cba1e492163ca6a1621d3e2a3603be4a0 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Wed, 13 Jul 2022 09:44:35 +0800 Subject: [PATCH] docs: Add debugging notes + link file from README. --- README.md | 4 ++-- scip-ruby.md | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) 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 +```