README.md in pry-moves-0.1.1 vs README.md in pry-moves-0.1.2
- old
+ new
@@ -9,17 +9,21 @@
## Commands:
* `n` - **next** line in current frame, including block lines (moving to next line goes as naturally expected)
* `s` - **step** into function execution
- * `s func_name` - steps into first method called by name `func_name`
-* `f` - **finish** execution of current frame and stop at next line on higher level
+ * `s func_name` - step into first method called by name `func_name`
+* `f` - **finish** execution of current frame (block or method) and stop at next line on higher level
* `c` - **continue**
-* `bt` - shows latest 5 lines from backtrace
+* `bt` - show latest 5 lines from backtrace
* `bt 10` - latest 10 lines
- * `bt all`- full backtrace
-* `up`/`down` - move over call stack
+ * `bt all` - full backtrace
+ * `bt >foo` - write backtrace to file `log/backtrace_foo.log`
+* `up`/`down`/`top`/`bottom` - move over call stack
+ * `up +` - move up, including vapid frames (block callers, hidden frames)
+ * `up pattern` - move up till first frame which method name or file position in format `folder/script.rb:12` matches regexp pattern
+* `debug some_method(param, param2)` - call `some_method(param, param2)` and interactively step into it
* `!` - exit
## Examples
@@ -36,39 +40,64 @@
<img src="https://user-images.githubusercontent.com/2452269/27320748-37afe7de-55a0-11e7-8b8f-ae05bcb02f37.jpg" width="377">
_Demo class source [here](https://github.com/garmoshka-mo/pry-moves/issues/1)_
+## Backtrace and call stack
+
+You can explicitly hide frames from backtrace and call stack by defining `hide_from_stack` variable:
+
+```ruby
+def insignificant_method
+ hide_from_stack = true
+ something_insignificant
+ yield
+end
+```
+
## Configuration
Here is default configuration, you can override it:
```ruby
-PryMoves::Backtrace::filter =
+PryMoves::Backtrace::lines_count = 5
+PryMoves::Backtrace::filter =
/(\/gems\/|\/rubygems\/|\/bin\/|\/lib\/ruby\/|\/pry-moves\/)/
-
-PryMoves::Backtrace::format do |line|
- defined?(Rails) : line.gsub( /^#{Rails.root.to_s}/, '') : line
- end
```
-## Technical info
+## Threads, helpers
-`pry-moves` is not yet thread-safe, so only use in single-threaded environments.
+`pry-moves` can't stop other threads on `binding.pry`, so they will continue to run.
+This makes `pry-moves` not always suitable for debugging of multi-thread projects.
+Though you can pause other threads with helper which will suspend execution on current line,
+until ongoing debug session will be finished with `continue`:
+
+```ruby
+PryMoves.synchronize_threads
+```
+
+_For example, you can put it into function which periodically reports status of thread (if you have such)_
+
+Other helpers:
+* `PryMoves.open?` - if pry input dialog active. Can be used to suppress output from ongoing parallel threads
+
+## pry-remote
+
Rudimentary support for [`pry-remote`][pry-remote] (>= 0.1.1) is also included.
Ensure `pry-remote` is loaded or required before `pry-moves`. For example, in a
`Gemfile`:
```ruby
gem 'pry'
gem 'pry-remote'
gem 'pry-moves'
```
+## Performance
+
Please note that debugging functionality is implemented through
-[`set_trace_func`][set_trace_func], which imposes a large performance
-penalty.
+[`set_trace_func`][set_trace_func], which imposes certain performance penalty.
## Contributors
* Gopal Patel ([@nixme](https://github.com/nixme))
* John Mair ([@banister](https://github.com/banister))