Setting a breakpoint in another file does not affect

The ruby โ€‹โ€‹debugger does not stop at checkpoints that I set in files other than the one on which the execution is being performed. For example, consider these two files, foo.rb:

# foo.rb class Foo def bar puts "baz" end end 

and main.rb:

 # main.rb require './foo' Foo.new.bar 

I start debugging with ruby -r debug .\main.rb Now, when I try to set a breakpoint on a specific line in another file using b ./foo.rb:4 , I get the message Set breakpoint 1 on foo.rb: 4, but when I cont , the program runs to the end and the debugger never doesn't stop. However, if I break the line in main.rb, for example. b ./main.rb:3 or method, for example. b Foo.bar , the debugger stops as expected.

Why doesn't the debugger stop at breakpoints in files other than the main file?

Update: I tried this with Ruby 1.9.3 on Windows 7, as well as OS X 10.8; It does not work in any environment.

I also realized that the debugger exits after the script finishes: I start debugging main.rb, use cont , then baz prints to the console, and I go back to the shell. Is this expected behavior, or can the debugger crash?

+6
source share
1 answer

Wow, this is weird. Not sure if this will help, but maybe you could do it. Step over the requirement with the following so that Foo is loaded, then

 b Foo:bar 

which should at least break into a bar

+1
source

Source: https://habr.com/ru/post/924543/


All Articles