Breakpointer

As indicated in the documentation on the wiki, setting a breakpoint in your application is really really simple… so why didn’t I get it working in 5 seconds (like it should take)?

I had it in my head that this command started your server in a debug mode.
ruby script/breakpointer

When (as the documentation really says) what it does is open a breakpoint-client. So, the simple thing that I was missing: Just do “ruby script/breakpointer” in terminal 1 and “ruby script/server” in terminal 2. It’s that easy to get things set up. Now just add “breakpoint” some place that you’re going to ‘run over’ and watch as the breakpointer window starts up an irb session for you to examine what’s really going on at that point in your code.

Although there is the initial shock of an error message that you are to just ignore:
breakpointer-startup.png

So, now that it’s all setup: how useful did I find it? Sadly, I have to say that it really wasn’t very useful at all for me. Without the ability to trace/step I was basically only using it to output the values of some variables at that point in the execution – something that I actually find a bit more convenient (for better or for worse) to just use logger.warn to accomplish. Maybe once I get the hang of the breakpointer a bit more, I’ll find it more valuable though (?) – I think so.

What I did find most useful was a hint found here.

Normally, if I wanted to find the values inside my account object. I would wait for my breakpoint to hit, then do:
normal-output.png

By executing these I could easily get a much more readable (yml) format. Not extremely useful in this simple example, but it would be heaven sent on a more complex model.
yaml-output.png

Advertisements

1 Comment

Filed under rails, Ruby

One response to “Breakpointer

  1. Pingback: Debuggin RoR.. the rails way « Geekvicious Journal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s