# Ruby-debug

**URL:** <https://rubytalk.org/t/ruby-debug/56462>\
**Category:** ruby-talk\
**Created:** [2 December 2009 17:50 UTC](https://rubytalk.org/t/ruby-debug/56462 "2009-12-02T17:50:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RubyNewbie](https://avatars.discourse-cdn.com/v4/letter/r/58f4c7/32.png) [@RubyNewbie](https://rubytalk.org/u/RubyNewbie)\
**Post date:** [2 December 2009 17:50 UTC](https://rubytalk.org/t/ruby-debug/56462/1 "2009-12-02T17:50:06Z")

</div>

Question:  
I was wondering if there was a way to instruct the ruby debug  
framework to stop/break/freeze on any error so I can investigate the  
call stack to diagnose the problem?

Background:  
I am using 'ruby-debug' and know that I can insert breakpoints with  
the debugger() method call in my code. I have run into errors within  
unexpected callbacks and often have no idea why the code traversed  
that path. Because I don't understand the code path it's hard to know  
where to put the breakpoint to troubleshoot the problem.

- Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Marnen\_Laibow-Koser](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Marnen\_Laibow-Koser](https://rubytalk.org/u/Marnen_Laibow-Koser)\
**Post date:** [2 December 2009 18:47 UTC](https://rubytalk.org/t/ruby-debug/56462/2 "2009-12-02T18:47:41Z")

</div>

RubyNewbie wrote:

> Question:  
> I was wondering if there was a way to instruct the ruby debug  
> framework to stop/break/freeze on any error so I can investigate the  
> call stack to diagnose the problem?
> 
> Background:  
> I am using 'ruby-debug' and know that I can insert breakpoints with  
> the debugger() method call in my code. I have run into errors within  
> unexpected callbacks and often have no idea why the code traversed  
> that path. Because I don't understand the code path it's hard to know  
> where to put the breakpoint to troubleshoot the problem.

Then what you need is not a debugger; you need to understand the code  
better (more tests?). Or put the breakpoint before the branch and watch  
what happens to \*make\* the program choose it's path.

> - Thanks in advance.

Best,

> **···**
>
> --  
> Marnen Laibow-Koser  
> [http://www.marnen.org](http://www.marnen.org)  
> marnen@marnen.org  
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Roger\_Pack4](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@Roger\_Pack4](https://rubytalk.org/u/Roger_Pack4)\
**Post date:** [2 December 2009 19:11 UTC](https://rubytalk.org/t/ruby-debug/56462/3 "2009-12-02T19:11:57Z")

</div>

> Background:  
> I am using 'ruby-debug' and know that I can insert breakpoints with  
> the debugger() method call in my code. I have run into errors within  
> unexpected callbacks and often have no idea why the code traversed  
> that path. Because I don't understand the code path it's hard to know  
> where to put the breakpoint to troubleshoot the problem.

You could try

(rdb:) catch Exception

or running it like  
rdebug --trace # run it with a tracer.  
-r

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
