Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Simple RM Debugger #19
Comments
|
That would be slick. |
|
I've gotten bored of the idea. |
|
I was thinking about the effort/result ratio earlier... Very few scripts are complex enough to warrant the level of debug this would allow. :) |
|
Yes, plus I rarely use debuggers. Maybe cause I've never actually worked on million-lines-of-code software, but I usually just throw print statements everywhere. Scanning the print statements is a lot faster than stepping through the code. |
Write a simple RM debugger.
It should provide variable-tracing functionality, the ability to insert "breakpoints", step-in, step-out, and step-over commands, and filling the console with "useful" information.
Some specifications will need to be designed.
Clearing the console can be done using a simple syscall. Console clearing will be crucial to providing a screen that LOOKS like it's being updated.
Breakpoints will be simulated using a simple method call that you will manually insert into your scripts. For example
The breakpoint itself will simply be defined like
Which will allow you to inspect variables at that point.
How to actually monitor the variables is a separate issue and will need to be refined.
Monitoring instance variables can be done by getting all instance variables using the
instance_variablesmethod and then printing them out. The debugger will contain a list of objects that should be monitored, and you tell the debugger what you want to "watch" or "stop watching"Stepping in, out, or over will be done at a method-level. All methods will be have some code injected into them to automatically pause and wait for user input.
Some information that may be useful to accomplish this: http://stackoverflow.com/questions/5513558/executing-code-for-every-method-call-in-a-ruby-module