# Ruby-debug

**URL:** <https://www.ruby-forum.com/t/ruby-debug/179726>\
**Category:** Ruby\
**Created:** [December 2, 2009, 6:53pm UTC](https://www.ruby-forum.com/t/ruby-debug/179726 "2009-12-02T18:53:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubynewbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rubynewbie](https://www.ruby-forum.com/u/rubynewbie)\
**Post date:** [December 2, 2009, 6:53pm UTC](https://www.ruby-forum.com/t/ruby-debug/179726/1 "2009-12-02T18:53:30Z")

</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:** ![rubynewbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rubynewbie](https://www.ruby-forum.com/u/rubynewbie)\
**Post date:** [December 2, 2009, 7:47pm UTC](https://www.ruby-forum.com/t/ruby-debug/179726/2 "2009-12-02T19:47:39Z")

</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)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![rubynewbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rubynewbie](https://www.ruby-forum.com/u/rubynewbie)\
**Post date:** [December 2, 2009, 8:11pm UTC](https://www.ruby-forum.com/t/ruby-debug/179726/3 "2009-12-02T20:11:35Z")

</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
