Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakpoints not working #41

Open
dgioga opened this issue Aug 30, 2013 · 1 comment
Open

Breakpoints not working #41

dgioga opened this issue Aug 30, 2013 · 1 comment

Comments

@dgioga
Copy link

dgioga commented Aug 30, 2013

I am using pry-remote to debug ruby scripts that get invoked by a control process. The flow looks something like this:

User->Control->BackendScripts that need debugging

All IO for the BackendScripts is handled by the control process, with various output being placed in logs. However the configured logging of the control process is not enough to understand what actually takes place inside the BackendScripts.

I have no control or access to the source code of the control process (big complicated stuff that I can't afford to break because it also controls some other things)

In order to debug I have setup pry-remote to run locally with bindings being placed in the BackendScripts that get invoked.

I can successfully connect to the local pry-remote server session that gets opened, however I cannot continue execution until next set breakpoint. Whenever I insert a breakpoint i get the following message:
Breakpoint 1: BackendScript_file.rb @ line xx (Enabled) :

Which would indicate that the breakpoint was set. However when i try to list all active breakpoints with "breaks" command the output is:

NoMethodError: private method printf' called for #<PryRemote::IOUndumpedProxy:0x87c010c>:PryRemote::IOUndumpedProxy from (server_variable) /usr/lib/ruby/1.9.1/drb/drb.rb:1467:incheck_insecure_method'

I'm thinking the above error is due to the fact that the IOUndumpedProxy object does not have a defined printf method (which should be used for printing out the location of the breakpoint but it should not actually influence the fact that it is set). I even implemented a rude printf function inside the object IOUndumpedProxy and it no longer threw the exception.

The problem is that issuing the continue command just exits pry-remote, not hitting any breaks. I'm thinking that pry-remote just exits when continue is seen as a command and the actual pry object hangs and actually hits the breakpoint (because as a whole my BackendScript) does not finish.

It might be that I'm using the debugger in an erroneous manner but any help would be appreciated.

Thanks!

@Mon-Ouie
Copy link
Owner

Hey,

I'm not very familiar with pry-debugger, but I believe I understand why the issue is happening (although I don't know how support for pry-remote was intended to work). When you run the continue command, the debugger ends up calling the exit-all command, which means the pry-remote session is exited.

You would normally be able to reconnect by running pry-remote again (however cumbersome that might be), except the program will crash as soon as a breakpoint is hit. The reason for that is, pry-debugger is keeping a reference to the Pry instance and using its output attribute to print information about the breakpoint when it is hit. Since the DRb connection has been closed, this results in a crash (or at least an exception from DRb).

In case I'm not running in the same issue as you are, here is the program I used to test this behaviour (placing a breakpoint on line 8):

require 'pry-debugger'
require 'pry-remote'

class Foo
  def initialize(x, y)
    binding.remote_pry
    @x = x
    @y = y
  end
end

Foo.new 3, 4

(Sorry if I take a long time to get back to you, I haven't been able to get an internet connection during the week lately.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants