I’m a one-day-old Ruby programmer, with 30 years of Perl programming. I have a MSCS (from FAU go Owls!) and I’ve been a computer professional since my US ARMY COBOL days in the mid 70s.
I need a bootstrap load for Ruby debugging please! At this point I’m stumbling about trying to run debugger on a code base which is largely foreign to me. The code I can figure out- the debugger not so much…
We have Ruby 1.8.6 on linux (we can’t upgrade the version due to SOX and other inhibitors)
Some quandries:
-
invoking the debugger. Most references tell me to use shell> rdbg , which on our system is an unknown command. I also looked at pry and other options but apparently we need ruby >2.0 for most. I DID get ruby -rdebug to work, which I’m hoping is the functional equivalent of rdgb? Maybe I need an alias? But at least I’m in SOME debugger of some variety? Do I need a require debugger in my source?
-
I’ve read many debugging guides, most of which look like expanded versions of what “h” provides. But many things don’t seem to work as described or are indeterminant, for example:
i[nfo] if supposed to show variables but instead seems tells me undefined variable “i”
v , same thing, undefined var or method
th same thing (and what is a thread? I know what one is in a “CS” context, but they’re so rarely used, it seems odd they’re so prominent as a debugger term)
Most other help items only result in “undefined var or method” . Luckily, n,s,c,l and b all seem to work almost like Perl dbg so I can at least do basic debugging.
When code execution stops, it eventually tells me a .rb file name and line number it stopped at. But only after a huge list like:
/home/user/me/code …/code/ …/code/ …/code/ …/code/ …/code./ (repeat about 25 more times) …/code/myfile.rb: 55: . I don’t know what that list is even telling me (maybe how many times I descended into a call or loop?) and I certainly don’t want it displayed at every break. Is that in the config (my config command doesnt work) where maybe I can turn it off?
Also, I don’t find in the references some things I need to do:
in perl dbg, R restarts the program from the beginning. I don’t see an equivalent. I tried R and r; R errors, but lowercase r locked up my PUTTY Session so badly, the only escape was to X out of the window! Not a very useful command, that! it’s a bit amazing that no references mention this essential command to restart. Maybe it’s hidden in the frames stuff?
How do I perform a statement, like i++ or something like that? is that “eval” ?
Can I view the stack?
How do I pop out of the current method to the caller?
Finally, I see references to something called “frames”. I don’t know what those are. Maybe scope contexts? I googled “ruby frames” and saw nothing related to coding, but I did see some nice picture frames on etsy! But seriously, if you’re writing a beginners guide, using undecipherable terms like “frame” confounds a reader, particularly when its not a concise CS term, nor can it be referenced on google searches.
If you can spare a few moments to help a Ruby Nuby, it’s greatly appreciated. I’ve made some progress and can navigate through the code a bit, but I’m quite confused about many commands and concepts., particulaly when help says what they do , and they clearly do not do that. It seems like whatever h[elp] says should, as a minimum, do what it says it does?
The CODE side I’m OK, It’s pretty intuitive and the OO syntax is refreshing after Perl.