Control debugger from TextMate

Posted on August 27, 2006

Wouldn't it be great if I can set breakpoints right from within TextMate? I've been thinking about this myself for sometime.

And now I'd like to introduce a new Ruby Debug Bundle.

Note that in order to use it you must have the latest version (0.4.1 or higher) of ruby-debug installed.

How to use it?

Let's say you want to debug your Rails application.

  1. Start your application with the remote debugging enabled:

    $ rdebug -sn ./script/server webrick
    
  2. Connect to the debugger (in new terminal):

    $ rdebug -c
    Connected.
    
  3. In TextMate go to the line where you want to set a breakpoint and press ⇧⌘B and select Set Breakpoint at Current Line.

  4. Open your browser and start using your application until you reach the breakpoint.

That's it.

Currently, these commands are available:

  1. Set Breakpoint at Current Line
  2. Delete All Breakpoints.
  3. Show Breakpoints - show all breakpoints as a tooltip.
  4. Interrupt - interrupt the last debugged thread or, if there is no one, the main thread.
  5. Quit - quit application.
Comments
  1. PascalSeptember 15, 2006 @ 10:42 PM

    Kent,

    I’m finally getting to try it today. This is really cool and once again you do marvels!

    The one thing I can suggest to improve the bundle would be to change the default shortcut (I’m trying cmd-option-shift-B) as I’m quite fond of cmd-shit-B to select the characters enclosed withing (), {} or [].

  2. Luke MeliaJanuary 27, 2007 @ 02:41 AM

    The link to the textmate bundle seems to be broken.

    Great work on ruby-debug!

  3. KentJanuary 27, 2007 @ 02:55 AM

    Thanks, fixed.

  4. Andrew CarterDecember 12, 2007 @ 05:22 PM

    This a great bundle. Have you thought about getting it up on http://macromates.com/svn/Bundles/trunk/Bundles/? Many of us pull our bundles directly from there.

  5. AndyLMarch 03, 2008 @ 08:51 PM

    I can't get this to quite work with Rails 2.0.2. Setting breakpoints seems OK - but not showing or clearing them. Is this bundle supposed to be compatible with Rails 2.0.2??

  6. Eric PughApril 24, 2008 @ 04:40 PM

    I get the same results as AndyL.. Also, my startup script required me to run without the 'n' option: rdebug -s ./script/server

  7. Navin SamuelMay 22, 2008 @ 03:32 AM

    Same problem! Am able to do everything except getting the execution to stop at the breakpoint! Any ideas anyone?