Closed liuxuan30 closed 11 years ago
Also, when I was trying to remove the tag using
In VIM:
Error detected while processing function 15..84..94: line 2: E716: Key not present in Dictionary: debugger_id E15: Invalid expression: 'delete ' . self.debugger_id line 3: E121: Undefined variable: message E116: Invalid arguments for function 4
I also dont know what's the meaning of Open page with the breakpoint in the browser. Vim should automatically set current line to breakpoint.
How to open page with the breakpoint in the browser? What browser?
How to open page with the breakpoint in the browser? What browser?
That's if you debug Rails, i.e. - web app.
Well, first thing - you use old vim-ruby-debugger. :) Try to get the fresh one (here, from github) and try again.
Thanks!
Also, please note that for the new one, you have to use 'debugger-xml' gem, not 'ruby-debug-ide'.
Mine ruby is 1.8.7, which my company requires. So I follow your guidance using ruby-debug-ide
2013/5/8 Anton Astashov notifications@github.com
Also, please note that for the new one, you have to use 'debugger-xml' gem, not 'ruby-debug-ide'.
— Reply to this email directly or view it on GitHubhttps://github.com/astashov/vim-ruby-debugger/issues/85#issuecomment-17613074 .
Thanks, Xuan Liu
Ah, got it, then you are doing it right :)
Then do you know why it won't stop at the breakpoint? I can't tell from the log, seems nothing new after
Vim plugin, 18:06:54: Sending a message to ruby_debugger.rb: 'break /auto/home2/liux14/test.rb:4++vim-ruby-debugger separator++start' Vim plugin, 18:06:54: Using Vim built-in Ruby to send message
nothing in variable window too
Thank you for help! This is important to me
Hmm, weird, according to the log, bin/ruby_debugger.rb doesn't accept any input... I.e. I see Vim sends a command, but bin/ruby_debugger.rb doesn't accept it by some reason.
Could you please try to kill bin/ruby_debugger.rb and run it in the console manually, with the command from the log file, i.e.:
ruby /auto/home2/liux14/.vim/bin/ruby_debugger.rb 127.0.0.1 39767 39768 vim "/auto/home2/liux14/.vim/tmp/ruby_debugger" posix 1 /auto/home2/liux14/.vim/tmp/ruby_debugger_log
And see, maybe it fails by some reason. Then try to set a breakpoint again.
What is the correct output in the log? I think they are working and nothing abnormal:
Vim plugin, 18:06:53: Servers are killed, trying to start new servers Vim plugin, 18:06:53: Executing command: rdebug-ide -p 39767 -- '/auto/home2/liux14/test.rb' > /auto/home2/liux14/.vim/tmp/ruby_debugger_output 2>&1 & Vim plugin, 18:06:53: Executing command: ruby /auto/home2/liux14/.vim/bin/ruby_debugger.rb 127.0.0.1 39767 39768 vim "/auto/home2/liux14/.vim/tmp/ruby_debugger" posix 1 /auto/home2/liux14/.vim/tmp/ruby_debugger_log & Vim plugin, 18:06:53: Now we need to store PIDs of servers, retrieving them:
I could have a example so I could try it a few hours later.
Also, I may ask a stupid quesiton, but I need to confirm, is it enough to hit the breakpoint just entering :Rdebugger test.rb im vim after setting breakpoing in test.rb?
Also, I may ask a stupid quesiton, but I need to confirm, is it enough to hit the breakpoint just entering :Rdebugger test.rb im vim after setting breakpoing in test.rb?
Yup
What is the correct output in the log?
After these lines:
Vim plugin, 18:06:54: Sending a message to ruby_debugger.rb: 'break /auto/home2/liux14/test.rb:4++vim-ruby-debugger separator++start'
Vim plugin, 18:06:54: Using Vim built-in Ruby to send message
log should be continued, but by some reason it stops there. Which is weird.
After executing ruby /auto/home2/liux14/.vim/bin/ruby_debugger.rb 127.0.0.1 39767 39768 vim "/auto/home2/liux14/.vim/tmp/ruby_debugger" posix 1 /auto/home2/liux14/.vim/tmp/ruby_debugger_log
I got the result:
Vim plugin, 11:24:43: Found pid - 4861 Vim plugin, 11:24:43: PID - 4861, found by 0 repeats Vim plugin, 11:24:47: Trying to toggle a breakpoint in the file /auto/home2/liux14/test.rb:3 Vim plugin, 11:24:47: There is no already set breakpoint, so create new one Vim plugin, 11:24:47: Set breakpoint to: /auto/home2/liux14/test.rb:3 Vim plugin, 11:24:47: Added Breakpoint object to RubyDebugger.breakpoints array Vim plugin, 11:24:47: Trying to find PID of process on 39767 port, must_get_pid = 0 Vim plugin, 11:24:47: Trying to find listener of port 39767 Vim plugin, 11:24:47: Executing command: lsof -i tcp:39767 | grep LISTEN | awk '{print $2}' Vim plugin, 11:24:47: Found pid - 4858 Vim plugin, 11:24:47: PID - 4858, found by 0 repeats Vim plugin, 11:24:47: Trying to find PID of process on 39768 port, must_get_pid = 0 Vim plugin, 11:24:47: Trying to find listener of port 39768 Vim plugin, 11:24:47: Executing command: lsof -i tcp:39768 | grep LISTEN | awk '{print $2}' Vim plugin, 11:24:47: Found pid - 4861 Vim plugin, 11:24:47: PID - 4861, found by 0 repeats Vim plugin, 11:24:47: Server is running, so add command to Queue Vim plugin, 11:24:47: Adding 'break /auto/home2/liux14/test.rb:3' to queue Vim plugin, 11:24:47: Executing queue Vim plugin, 11:24:47: Sending a message to ruby_debugger.rb: 'break /auto/home2/liux14/test.rb:3'
But it won't hit the BP still. Any ideas?
I m thinking that is it the problem at "Vim plugin, 11:24:47: Using Vim built-in Ruby to send message" ? How to testify the debugger got the message and response?
Also, anything related to the Server/Client stuff?
Another thing need to notice is that in ruby-debugger-output file, the log is quite clean:
[console@temp]$ cat ruby_debugger_output Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.10.4) listens on 127.0.0.1:39767
Looks like the vim and ruby has problem?
spend some time checked your code,
216 if g:ruby_debugger_builtin_sender 217 call s:log("Using Vim built-in Ruby to send message") 218 ruby << RUBY
Looks like ruby<<RUBY has nothing to output. How to do a further investigation? Anything related to tags?
BTW, :echo has("ruby") returns 1 in Vim, right?
BTW, :echo has("ruby") returns 1 in Vim, right?
Yes, it is 1. I used to have compiled vim with ruby support
Im trying to use external ruby, but seems there is bug:
cat ruby-debugger-log Vim plugin, 12:51:46: Executing queue Vim plugin, 12:51:46: Sending a message to ruby_debugger.rb: 'break /auto/home2/liux14/test.rb:3++vim-ruby-debugger separator++start' Vim plugin, 12:51:46: Using system-wide Ruby to send message, the command is: ruby -e "require 'socket'; attempts = 0; a = nil; begin; a = TCPSocket.open'127.0.0.1', 39768); a.puts%q[break /auto/home2/liux14/test.rb:3++vim-ruby-debugger separator++start]);a.close; rescue Errno::ECONNREFUSED; attempts += 1; if attempts < 400; sleep 0.05; retry; else; puts'127.0.0.1:39768 can not be opened'); exit; end; ensure; a.close if a && !a.closed?; end; " Vim plugin, 12:51:46: Command has returned following output: [liux14@liux14 tmp]
If you look at the command, you will see some chars is missing: a = TCPSocket.open'127.0.0.1', 39768); missing ( a.puts%q[break /auto/home2/liux14/test.rb:3++vim-ruby-debugger separator++start]) also missing (
I manually create one ruby file and put thoses strings in it with correting some grammer errors, it runs without error and output
BTW, I'm using gem to manage my ruby, so my ruby path is:
[liux14@liux14 tmp]$ which ruby /usr/local/rvm/rubies/ruby-1.8.7-p371/bin/ruby [liux14@liux14 tmp]$
262 call s:log("Using system-wide Ruby to send message, the command is: " . script) 263 let output = system(script)
seems line #263 get empty output.
Hey, do you have IM? Write me to anton.astashov at gmail.com, it probably will be easier.
Also, try to set
let g:ruby_debugger_builtin_sender = 0
to your .vimrc, and let's see what happens.
And wait, nvm, you already tried this
yes, but it has new problem, missing '(' while reading from the log :(
sorry my company blocked google talk... only MS Office communicator allowed
Yeah, there are missing parentheses in the log files, but that's okay.
ok, but the #263 let output = system(script) got nothing, is this where the problem has?
So, the log output should be something like:
Vim plugin, 22:31:30: Sending a message to ruby_debugger.rb: 'break /Users/anton/projects/demo/a.rb:7++vim-ruby-debugger separator++start'
Vim plugin, 22:31:30: Using Vim built-in Ruby to send message
Ruby_debugger.rb, 22:31:30 : Received data from vim-ruby-debugger: break /Users/anton/projects/demo/a.rb:7++vim-ruby-debugger separator++start
Ruby_debugger.rb, 22:31:30 : Queue is not empty, we will pass queue to rdebug-ide
Ruby_debugger.rb, 22:31:30 : Putting message to rdebug-ide: break /Users/anton/projects/demo/a.rb:7
Ruby_debugger.rb, 22:31:30 : Received data from rdebug-ide: <breakpointAdded no="1" location="/Users/anton/projects/demo/a.rb:7"/>
Ruby_debugger.rb, 22:31:30 : Queue is not empty, we will pass queue to rdebug-ide
Ruby_debugger.rb, 22:31:30 : Putting message to rdebug-ide: start
Ruby_debugger.rb, 22:31:30 : Sending message to vim-ruby-debugger: <breakpointAdded no="1" location="/Users/anton/projects/demo/a.rb:7"/>
Ruby_debugger.rb, 22:31:30 : Put message to temp file
Ruby_debugger.rb, 22:31:30 : Executing command: mvim --servername VIM -u NONE -U NONE --remote-send "<C-\\><C-N>:call RubyDebugger.receive_command()<CR>"
Vim plugin, 22:31:30: Received command: <breakpointAdded no="1" location="/Users/anton/projects/demo/a.rb:7"/>
Vim plugin, 22:31:30: Received the breakpoint message, will add PID and number of breakpoint to the Breakpoint object
Vim plugin, 22:31:30: Found the Breakpoint object for /Users/anton/projects/demo/a.rb:7
Vim plugin, 22:31:30: Added id: 1, PID:19467 to Breakpoint
Vim plugin, 22:31:30: Breakpoint is set: /Users/anton/projects/demo/a.rb:7
So, by some reason, ruby_debugger.rb doesn't receive the command. So, let's debug it.
ok, sorry only we could talk via this, I will stay on this page
How to debug this?
Hmm. The weird thing in this line:
Vim plugin, 18:06:53: Executing command: ruby /auto/home2/liux14/.vim/bin/ruby_debugger.rb 127.0.0.1 39767 39768 vim "/auto/home2/liux14/.vim/tmp/ruby_debugger" posix 1 /auto/home2/liux14/.vim/tmp/ruby_debugger_log &
Look at this part: 39767 39768 vim
. It actually should be 39767 39768 vim VIM
.
I.e. it doesn't send the servername to ruby_debugger.rb
Try to do :echo v:servername, what will it show?
:echo v:servername returns 'recording'
What? :) Are you sure you didn't accidentally pressed "q" and record anything?
oops, after another try, it returns nothing
That's the problem.
well I start the vim with vim --servername VIM, what is the correct way?
But ":echo has("clientserver")" still returns 1?
That's the correct way. I've got no idea why it returns nothing
":echo has("clientserver")" returns 1, yes.
my command flow is:
vim --servername VIM
in VIM,
I type :edit test.rb
then
Found this thread:
https://groups.google.com/forum/?fromgroups=#!topic/vim_use/ZZqOUW69uv0
How do you connect to your VM, through SSH? If so, try to do ssh -X, maybe?
I am using VNC to get a GUI of my VM, the OS is centOS 2.6.18-348.3.1.el5
If so, can you try to use gvim?
I just tryied ssh -X , it works!!! OMG!!
Yay! :)
supermassive cool, thanks a lot!
You are welcome, glad I was able to help :)
Yep, hope this thread could also provide help to others, pretty a good way to teach how to debug such issues
Hi I'm new to this plugin and VIM, and I follow the guide, but it can't hit the break point. and the variable window is empty. I have checked the issues, but not work for me.
What I do is that first SSH to my Linux VM, then launch vim:
[ssh-bash]vim --servername VIM then type :edit test.rb then set the break point, and I could see 'xx' tag then launch variable windowv
then type :Rdebugger test.rb
but nothing happens in VIM
Here's the information
ENV: Linux VM Ubuntu 12.04 VIM 7.3 * LOCAL GEMS * bundler (1.3.4) columnize (0.3.6) linecache (0.46) log4r (1.1.10) net-scp (1.1.0) net-ssh (2.6.6) rake (10.0.4) rbx-require-relative (0.0.9) ruby-debug (0.10.4) ruby-debug-base (0.10.4) ruby-debug-ide (0.4.16) rubygems-bundler (1.1.1) rvm (1.11.3.6)
LOG
cat ruby_debugger_log
Vim plugin, 18:06:53: Executing :Rdebugger... Vim plugin, 18:06:53: Initializing Server object, with variables: hostname: 127.0.0.1, rdebug_port: 39767, debugger_port: 39768, runtime_dir: /auto/home2/liux14/.vim, tmp_file: /auto/home2/liux14/.vim/tmp/ruby_debugger, output_file: /auto/home2/liux14/.vim/tmp/ruby_debugger_output Vim plugin, 18:06:53: Starting Server, command: "'/auto/home2/liux14/test.rb' " Vim plugin, 18:06:53: Trying to kill all old servers first Vim plugin, 18:06:53: Trying to find PID of process on 39767 port, must_get_pid = 0 Vim plugin, 18:06:53: Trying to find listener of port 39767 Vim plugin, 18:06:53: Executing command: lsof -i tcp:39767 | grep LISTEN | awk '{print $2}' Vim plugin, 18:06:53: Found pid - 14396 Vim plugin, 18:06:53: PID - 14396, found by 0 repeats Vim plugin, 18:06:53: Killing server with pid 14396 Vim plugin, 18:06:53: Executing command: ruby -e 'Process.kill9,14396)' Vim plugin, 18:06:53: Sleeping 100m... Vim plugin, 18:06:53: Killed server with pid: 14396 Vim plugin, 18:06:53: Trying to find PID of process on 39768 port, must_get_pid = 0 Vim plugin, 18:06:53: Trying to find listener of port 39768 Vim plugin, 18:06:53: Executing command: lsof -i tcp:39768 | grep LISTEN | awk '{print $2}' Vim plugin, 18:06:53: Found pid - 14399 Vim plugin, 18:06:53: PID - 14399, found by 0 repeats Vim plugin, 18:06:53: Killing server with pid 14399 Vim plugin, 18:06:53: Executing command: ruby -e 'Process.kill9,14399)' Vim plugin, 18:06:53: Sleeping 100m... Vim plugin, 18:06:53: Killed server with pid: 14399 Vim plugin, 18:06:53: Servers are killed, trying to start new servers Vim plugin, 18:06:53: Executing command: rdebug-ide -p 39767 -- '/auto/home2/liux14/test.rb' > /auto/home2/liux14/.vim/tmp/ruby_debugger_output 2>&1 & Vim plugin, 18:06:53: Executing command: ruby /auto/home2/liux14/.vim/bin/ruby_debugger.rb 127.0.0.1 39767 39768 vim "/auto/home2/liux14/.vim/tmp/ruby_debugger" posix 1 /auto/home2/liux14/.vim/tmp/ruby_debugger_log & Vim plugin, 18:06:53: Now we need to store PIDs of servers, retrieving them: Vim plugin, 18:06:54: Trying to find PID of process on 39767 port, must_get_pid = 1 Vim plugin, 18:06:54: Trying to find listener of port 39767 Vim plugin, 18:06:54: Executing command: lsof -i tcp:39767 | grep LISTEN | awk '{print $2}' Vim plugin, 18:06:54: Found pid - Vim plugin, 18:06:54: Trying to find listener of port 39767 Vim plugin, 18:06:54: Executing command: lsof -i tcp:39767 | grep LISTEN | awk '{print $2}' Vim plugin, 18:06:54: Found pid - 14453 Vim plugin, 18:06:54: PID - 14453, found by 1 repeats Vim plugin, 18:06:54: Trying to find PID of process on 39768 port, must_get_pid = 1 Vim plugin, 18:06:54: Trying to find listener of port 39768 Vim plugin, 18:06:54: Executing command: lsof -i tcp:39768 | grep LISTEN | awk '{print $2}' Vim plugin, 18:06:54: Found pid - 14456 Vim plugin, 18:06:54: PID - 14456, found by 0 repeats Vim plugin, 18:06:54: Server PIDs are: rdebug-ide: 14453, ruby_debugger.rb: 14456 Vim plugin, 18:06:54: Debugger is successfully started Vim plugin, 18:06:54: Adding 'break /auto/home2/liux14/test.rb:4' to queue Vim plugin, 18:06:54: Adding 'start' to queue Vim plugin, 18:06:54: Executing queue Vim plugin, 18:06:54: Sending a message to ruby_debugger.rb: 'break /auto/home2/liux14/test.rb:4++vim-ruby-debugger separator++start' Vim plugin, 18:06:54: Using Vim built-in Ruby to send message
cat ruby_debugger_output
Fast Debugger (ruby-debug-ide 0.4.16, ruby-debug-base 0.10.4) listens on 127.0.0.1:39767
code:
test.rb
1 require "syck" 2 a=1 3 b=2 xx 4 c=a+b
5 c 6 puts "end of ruby script"