From: Robert Klemme Date: 2005-11-03T21:47:08+09:00 Subject: Re: Trapping errors. Hugh Sasse wrote: > On Thu, 3 Nov 2005, Robert Klemme wrote: > >> Hugh Sasse wrote: >>> On Thu, 3 Nov 2005, Robert Klemme wrote: >>> >>>> This sounds really strange. Here's what I'd do: use set_trace_func >>>> to write out all method invocations, returns and thread ids and try >>>> to see where it goes. HTH >>> >>> Good job I tried to add docs to profiler.rb in stdlib yesterday. >>> I'll have a go at that. I've not played with set_trace_func before, >>> so it should be interesting. >> >> This should get you started: >> >> set_trace_func lambda {|event, file, line, id, binding, classname| >> $stderr.printf "th %10d: %-10s %s: %d\n", Thread.current.object_id, >> event, file, line if >> /call|return/ =~ event >> } >> >> Good luck! > > thanks. It did the trick. I was hoisted by my own petard. Although the meaning is obvious I had to look up "petard". Did you know your proverb originates from Shaky? http://dictionary.reference.com/search?q=petard > begin > copy_entry s, d, options[:preserve], > options[:dereference_root] rescue Exception, SystemCallError => > e stop = true > if block_given? > stop = yield s,d,e > end > raise if stop > end > > Yes, I forgot to return nil from the *flaming* block! So it re-raised > because stop was true. :-)) Silly us - this happens to me once in a while, too. > I didn't realize set_trace_func could be so useful. I'd previously > considered it obscure. Thank you for helping me out with this. You're welcome! I'm glad you finally managed to kill the beast. :-) Kind regards robert