Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Doesn't stop at breakpoints #77

Open
dhruvasagar opened this Issue · 20 comments

2 participants

@dhruvasagar

Hey,

I am using gvim on ubuntu, I have also tested the same scenario of trying to debug a rails application from vim inside a terminal however it just does not stop at any breakpoints.

There is nothing in the logs to indicate anything having went wrong.

@astashov
Owner

There is not enough information which could help me :)
What version of Ruby? What version of Rails? Also, please show everything from the files inside vim-ruby-debugger/tmp dir, i.e. ruby_debugger_log, ruby_debugger_output, ruby_debugger.

@dhruvasagar

I was working with ruby 1.9.2-p180, rails v3.2. The logs inside tmp directory didn't have much, just some warnings that rails s generated. The rails server did get started like it should, but when going through the pages where I kept break points, the debugger didn't stop at them.

I am using ruby-debug-ide19.

@astashov
Owner

Please attach the logs anyway. :) Otherwise, I really can't do anything to help you.

@dhruvasagar

$ cat ruby_debugger

<breakpointAdded no="1" location="/home/dhruvasagar/Work/bounty/app/controllers/employer_home_controller.rb:4"/>

$ cat ruby_debugger_log

(empty)

$ cat ruby_debugger_output

Fast Debugger (ruby-debug-ide 0.4.9) listens on :39767
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: already initialized constant SMTPSession
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: already initialized constant POP
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: already initialized constant POPSession
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: already initialized constant POP3Session
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: already initialized constant APOPSession
=> Booting Thin
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.4.1 codename Chromeo)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop


Started GET "/" for 127.0.0.1 at 2013-01-16 14:40:02 +0530

(more rails logs stripped)
@astashov
Owner

Ah. Right. Add

let g:ruby_debugger_debug_mode = 1

to .vimrc file, and try again.

@astashov
Owner
<breakpointAdded no="1" location="/home/dhruvasagar/Work/bounty/app/controllers/employer_home_controller.rb:4"/>

This line means that server actually received the response from ruby-debug-ide, but by some reason, Vim didn't handle it. Let's see what will be in logs though, when you add that line to your .vimrc

@dhruvasagar

Cool, let me do that.

@dhruvasagar

==> ruby_debugger <==

<breakpointAdded no="1" location="/home/dhruvasagar/Work/bounty/app/controllers/employer_home_controller.rb:5"/>

==> ruby_debugger_log <==
Ruby_debugger.rb, 08:43:33 : Queue is not empty, we will pass queue to rdebug-ide
Ruby_debugger.rb, 08:43:33 : Putting message to rdebug-ide: start
Ruby_debugger.rb, 08:43:33 : Sending message to vim-ruby-debugger:
Ruby_debugger.rb, 08:43:33 : Put message to temp file
Ruby_debugger.rb, 08:43:33 : Executing command: gvim --servername GVIM -u NONE -U NONE --remote-send ":call RubyDebugger.receive_command()"
Vim plugin, 08:43:33: Received command:
Vim plugin, 08:43:33: Received the breakpoint message, will add PID and number of breakpoint to the Breakpoint object
Vim plugin, 08:43:33: Found the Breakpoint object for /home/dhruvasagar/Work/bounty/app/controllers/employer_home_controller.rb:5
Vim plugin, 08:43:33: Added id: 1, PID:22262 to Breakpoint
Vim plugin, 08:43:33: Breakpoint is set: /home/dhruvasagar/Work/bounty/app/controllers/employer_home_controller.rb:5

==> ruby_debugger_output <==
Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.11) listens on 127.0.0.1:39767
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: already initialized constant SMTPSession
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: already initialized constant POP
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: already initialized constant POPSession
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: already initialized constant POP3Session
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p180@bounty/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: already initialized constant APOPSession

@dhruvasagar

Yet it doesn't stop at the breakpoint. What I am noticing is that your plugin is using --servername GVIM, do I need to put this in my .gvimrc, for progname setting ?

@astashov
Owner

It's actually pretty weird it doesn't stop at the breakpoint, according to the logs, it successfully set the breakpoint.
Hmm, maybe Thin forks new processes for response handlers, could you please try to use e.g. webrick?

@astashov
Owner

I.e. :Rdebugger 'script/rails s webrick' or something like that.

@dhruvasagar

Didn't work with webrick either...

@dhruvasagar

Should g:ruby_debugger_progname be set to 'gvim' ?

@astashov
Owner

No, it shouldn't. It seems like everything works just fine, except one little thing - it doesn't stop at breakpoints :)
Maybe try to run some little script?

Create a.rb file in your current dir, which looks like:

a = 1
b = 2
c = a + b
c

Then open it in vim, set a breakpoint to e.g. c = a + b (\b), then run debugger with :Rdebugger a.rb. Then see what happens, and if it doesn't work - send logs again.

Thanks!

@dhruvasagar

I get this in ruby_debug_output

Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.11) listens on 127.0.0.1:39767
Exception in DebugThread loop: undefined method `is_binary_data?' for "1":String
Backtrace:
/home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/xml_printer.rb:124:in `print_variable'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/xml_printer.rb:73:in `block (2 levels) in print_variables'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/xml_printer.rb:72:in `each'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/xml_printer.rb:72:in `block in print_variables'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/xml_printer.rb:253:in `print_element'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/xml_printer.rb:69:in `print_variables'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/command.rb:85:in `method_missing'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/commands/variables.rb:130:in `execute'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/processor.rb:78:in `block (2 levels) in process_context_commands'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/processor.rb:71:in `each'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/processor.rb:71:in `block in process_context_commands'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/processor.rb:70:in `catch'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/processor.rb:70:in `process_context_commands'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/processor.rb:39:in `block in process_commands'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/processor.rb:35:in `catch'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug/processor.rb:35:in `process_commands'
  from: /home/dhruvasagar/.rvm/gems/ruby-1.9.2-p290@global/gems/ruby-debug-ide-0.4.16/lib/ruby-debug-ide.rb:140:in `block in start_control'
@dhruvasagar

Should I be using ruby-debug-ide or ruby-debug-ide19 ? I am using ruby 1.9.2-p290 this time.

@astashov
Owner

If Ruby 1.9.2, then ruby-debug-ide19.
Heh, weird. Well, String#is_binary_data? is defined in syck/lib/syck/rubytypes.rb, try to add require 'syck' to the example script. I.e.:

require 'syck'
a = 1
b = 2
c = a + b
c

Something like that.

@dhruvasagar

That worked perfectly.

I am using 'pry' with rails, could that be causing a problem ? I did try once to debug after having removed pry gem though, but it didn't work then. Also I am using RVM, so maybe that is also causing issues at times.

Besides this, going forward, from what I have read is that ruby-debug-ide(19) have been depracated in the sense that they are not being maintained, instead this 'debugger' gem is being recommended, I also saw your post mentioning that you are trying to push changes to it to add support for this, is there someway I could help out ?

@astashov
Owner

No, it should work perfectly with RVM, since gvim captures all environment variables after start, AFAIK.
Should not be related to 'pry' also, but not 100% sure, since I never used it with debugger.
Maybe stupid question, but are you absolutely sure you are going through the line where the breakpoint is set? Try to add logger's output or simple puts to check that.

Yeah, I actually completed work for adding XML support to 'debugger' (you can find it here - https://github.com/astashov/debugger/tree/xml-output), but now I need it to be merged into the original repo. There are 2 big parts - first one is totally new test suite for debugger, and the second one - adding XML support. Maintainer of debugger promised to review the new test suite pull request this weekend, when he merges that pull request, I'll create another one for adding XML support (can't do that simultaneously, since XML support depends on new test suite).

So, I even don't know how could you help here. :) Now we only have to wait when debugger's maintainer reviews all that stuff.

@dhruvasagar

Yea I am sure that it is going through the line where I set the break point, I have set it in the controller, I also tried setting in the view itself, but to no avail, it doesn't stop :/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.