The right choice of a Ruby debugger for Sketchup API

Sorry Neil, but even though I install NetBeans 8.0 reinstalling all of the steps above, I can not install it properly. I only have access to the commands File / Open file …, I display the tools of the debugger Ruby, no effect. I can request the execution of the open .rb file but without any connection with sketchup. Any other order remains inoperative.
I get the following error message:
"Problem occurred during debugger start: Can not connect to the debugger process at port 7000 in 15s:
[Remote Process at localhost: 7000] "
The command: SketchUp.exe -rdebug “ide port = 7000” runs with no effect other than opening my sketchup. Maybe I should choose another port number, but which one?

Honestly it’s been a while since I’ve use NetBeans so I’m not sure what is going wrong for you. I posted the steps in case I ever need to go through the setup again. If I remember right it took me a while to figure it out.

On Windows you can Telnet to the SURubyDebugger server from a command prompt. The command is, for example: telnet localhost 7000

If the debug server is running and responding on port 7000 the telnet client will essentially do nothing sensible but flash a cursor. You type quit to close the telnet session and return to the command prompt.

If on the other hand if the debug server is not active you will receive the following message:
Connecting To localhost…Could not open connection to the host, on port 7000: Connect failed

With the results of that simple test we should be able to sort out where the problem is.

Edit: For completeness, I just looked at the source code for the debugger on github. If you can connect through telnet and then type break and hit enter you should get the text
<breakpoints></breakpoints> back from the server.

1 Like

The telnet telnet localhost 7000 command gives the same error message: "Unable to open a connection to the host, on port 7000: Connection failed

I kinda expected that would be the case. Now we need to find if Sketchup is loading the SURubyDebugger dll. A way to do this is to create a shortcut to sketchup.exe (wherever it is) and edit the command line to add the options -rdebug “ide port=7000”. Start sketchup from the shortcut and test this with telnet.

Sorry sWilliam, I had to leave. The command Sketchup.exe -rdebug “ide port = 7000” under telnet in the installation directory opens correctly sketchup and nothing else.

So much for me, Under Telnet I do not find the right syntax to launch Sketchup.
The command o Sketchup 7000 gives me “Unable to open a connection to the host on port 7000. Failed to connect”

I think we have things confused. Here are the steps (on windows 7) to make this test work.

Create a shortcut to the Sketchup exe file
Edit the Properties of the shortcut so the Target is the following line.
“C:\Program Files\SketchUp\SketchUp 2017\SketchUp.exe” -rdebug “ide port=7000”
Start sketchup by clicking on the shortcut

At a command prompt type Telnet to open the Microsoft telnet client.
In the Telnet window type open localhost 7000
480x380

This should connect to the Sketchup debug server but nothing will happen until you type break and hit enter.
You should then see <breakpoints></breakpoints> in the telnet client window.480x399

I just tried the command open localhost 7000. Telnet replies: "Can not open a connection to the host on port 7000: Failed to connect

Any chance you have not downloaded SURubyDebugger.dll from this site and placed that file into the same folder as your sketchup.exe file?

Yes I did it, and I saved it in the sketchup installation directory

Hmm, There are two ways to discover if Sketchup is loading SURubyDebugger.dll. The first way is to look in the resource monitor. If loaded SuRubyDebugger will be visible in the Associated Modules section. This is on Windows 7

Or we can start the Sketchup debugger with the built in console by editing the shortcut to read:
“C:\Program Files\SketchUp\SketchUp 2017\SketchUp.exe” -rdebug console

Clicking on this new shortcut should launch Sketchup with an interactive debugger window. Skecthup will hang when it loads the Sketchup Ruby Debugger window and you’ll have to type c and hit enter to complete loading Sketchup.

674x407

Hello SWilliam,

Thank you for your tenacious intervention. I have just done all the tests proposed above, successfully. I have now opened sketchup with an additional window ‘Skectchup Ruby Debugger’. What should I do now?
I completely reinstall NetBeans 8.0 and when loading the debugger plugin, the same error message appears:
'Problem occured during debugger start: Can not connect to the debugger process at port 7000 in 15s:
[Remote Process at localhost: 7000] ’

Well that is progress. It means Sketchup is loading the SURubyDebugger.dll file and it does execute. The problem you are having is with inter-process communication via sockets. I have to ask if you installed sketchup by right-clicking the installer file and choosing to Run as Administrator. You can do that now and choose Repair. It won’t have negative effects.

I’m not a Windows 10 guru but there might be either a firewall or security setting that needs a kick to allow Skecthup to open sockets of this sort.

Are there any bright ideas out there among the Windows 10 users? Anyone?

I just run sketchup loading with administrator rights but by launching the NetBeans debugger, I still have the same error message:
'Problem occured during debugger start: Can not connect to the debugger process at port 7000 in 15s:
[Remote Process at localhost: 7000] ’

Problem! While running the sketchup I can not find any trace of SURubyDebugger.dll in my resource monitor ??

And yet:

I canceled. by relaunching sketchup with the command -rdebug ide port = 7000 everything is fine. I found the SURubyDebugger.dll in my monitor. However, I still can not get NetBeans 8.2 to work properly with sketchup!

Alright, The next test. Can the SU debugger talk to itself?

  • Start sketchup with the -rdebug “ide port=7000”
  • Paste this code into the ruby console
require 'socket'
module MeMeMe 
  s = TCPSocket.new 'localhost', 7000

  s.puts('break')     # send a 'break command' to the SU debugger
  line = s.gets       # Read lines from socket
  puts line           # and print them

  s.close             # close socket when done
end

You should receive <breakpoints></breakpoints> back from the server. Or you might receive a useful diagnostic error message.

2 Likes

J receive <breakpoints></breakpoints>

“Nil result (no result returned or run failed)”

back from the server

Ah, you must be using Alex Schreyer’s Ruby Code Editor extension and not the sketchup ruby console?

Anyway, it looks like the debug server is communicating from one internal thread to another over a TSPsocket (i.e. it returned the <breakpoints></breakpoints> message) You need to disable windows firewall and any antivirus software running and then test by telnet-ing to localhost 7000 and get that working before moving back to NetBeans.

I am very bored, because the windows firewall is already disabled but I can not disable the MaCafee firewall, despite my rights as administrator!:frowning_face: