Ruby Debugging - IsDebuggerAttached?

Is there a way from a ruby script to tell if SketchUp is running in debug mode? If I would be able to somehow get the command line arguments I could tell that way.

I’m currently launching SketchUp for debugging like this:

"C:\Program Files\SketchUp\SketchUp 2017\SketchUp17.exe" -rdebug "ide port=7000"

Now I paste in my code to add in a toolbar button that loads the rb files I’m working on. I would like for my extension to be able to determine if SU is running in debug mode at startup. If it is, show the ‘debug’ button.

Any ideas?

You could also pass in another argument that load a debug file setting a debug variable or constant. That’s what I do:

-RubyStartup "/path/to/ruby.rb"

Or you can use -RubyStartupArg, which will be accessible from ARGV:

# => ARGV
["DevelopmentBuild:Debug (2.2)"]

I think we tried to forward all SU arguments to the Ruby interpreter, but ran into issues - would not pick up. Maybe because we are embedding the interpreter… so we added the -RubyStartupArg argument.

3 Likes

Thanks I’ll try that.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.