You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With pending method breakpoints, track all method invocation to track
`method_added` and `singleton_method_added`.
Of course, this approach slows down the debuggee's performance.
This patch tracks all `method_added` and `singleton_method_added` methods
and further defined such methods for the classes/modules. This approach
doesn't have performance penalty any more.
This patch also fix the message at registering the pending method
breakpoint.
```ruby
binding.b do: 'b C#foo' unless ENV['NO_PENDING_BP']
def fib n
if n<2
n
else
fib(n-1)+fib(n-2)
end
end
require 'benchmark'
Benchmark.bm{|x|
x.report{ fib(35) }
}
```
Results:
```
Without pending breakpoints:
$ NO_PENDING_BP=1 exe/rdbg -n target.rb
user system total real
0.929580 0.000000 0.929580 ( 0.929682)
With pending breakpoints - Before this patch:
$ exe/rdbg -n target.rb
[1, 10] in target.rb
=> 1| binding.b do: <<~DBG
2| b C#foo
3| DBG
4|
5| def fib n
6| if n<2
7| n
8| else
9| fib(n-1)+fib(n-2)
10| end
=>#0 <main> at target.rb:1
(rdbg:binding.break) b C#foo
uninitialized constant C
C
^
user system total real
3.276217 0.000000 3.276217 ( 3.276299)
With pending breakpoints - After this patch:
[master]$ exe/rdbg -n target.rb
[1, 10] in target.rb
=> 1| binding.b do: <<~DBG
2| b C#foo
3| DBG
4|
5| def fib n
6| if n<2
7| n
8| else
9| fib(n-1)+fib(n-2)
10| end
=>#0 <main> at target.rb:1
(rdbg:binding.break) b C#foo
Unknown name `C` for `Object`
user system total real
0.933402 0.002353 0.935755 ( 0.935757)
```
0 commit comments