From: Jano Svitok Date: 2007-07-12T23:26:34+09:00 Subject: Re: getting gdb backtrace from ruby exception On 7/12/07, Alex Fenton wrote: > Hi > > I'm working on a C extension and somewhere in itsomething is raising a > NoMethodError. The exception is reported with the line of ruby code that > triggered the bad call in the C extension. > > As the C code is large and complex (it's a big SWIG project), I'm having > trouble finding the problem in the C code. I would use gdb or > Microsoft's debugger to look at the stack if it was a C error - but when > a Ruby exception is raised, the process exits and there's no stack to > inspect. > > Ruby's debugger isn't helpful because it only knows about ruby written > in ruby. > > Is there any way I can get at the C stack at the point of ruby 'raise' > from a C extension? > > Thanks > alex There was a way how to run ruby under gdb with the ability to debug at "ruby level" while still having the "C view" at hand. http://eigenclass.org/hiki.rb?ruby+live+process+introspection http://weblog.jamisbuck.org/2006/9/25/gdb-wrapper-for-ruby http://redhanded.hobix.com/inspect/theRubyGdbArmsRaceNowAtAStandoff.html J.