Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple RM Debugger #19

Open
HimeWorks opened this issue Nov 6, 2013 · 4 comments
Open

Simple RM Debugger #19

HimeWorks opened this issue Nov 6, 2013 · 4 comments
Labels

Comments

@HimeWorks
Copy link
Member

@HimeWorks HimeWorks commented Nov 6, 2013

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.

system("cls")

Breakpoints will be simulated using a simple method call that you will manually insert into your scripts. For example

def your_method
   @a = 1
   breakpoint
   @a += 2
end

The breakpoint itself will simply be defined like

while !Input.trigger?(:C)
   Graphics.update
   Input.update
   Debugger.update
   ....
end

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_variables method 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

@Roguedeus
Copy link

@Roguedeus Roguedeus commented Nov 6, 2013

That would be slick.

@HimeWorks
Copy link
Member Author

@HimeWorks HimeWorks commented Nov 10, 2013

I've gotten bored of the idea.

@Roguedeus
Copy link

@Roguedeus Roguedeus commented Nov 10, 2013

I was thinking about the effort/result ratio earlier... Very few scripts are complex enough to warrant the level of debug this would allow. :)

@HimeWorks
Copy link
Member Author

@HimeWorks HimeWorks commented Nov 10, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.