Re: backtrace in exception handler




On Feb 25, 2009, at 6:38 PM, Kevin Ryde wrote:

I've got a Glib->install_exception_handler to catch main loop errors and
I'd like to get a backtrace for them too.

By the time the exception handler runs it's of course too late, the
stack has been unwound. I was thinking of a global SIG{__DIE__} handler
which saves away a Devel::StackTrace to be shown if the exception
handler is reached, or not if it's an "expected" error trapped by an
eval lower down (one of the GErrors throws say).

You ought to be able to do this quite readily in your own perl code. I'm not sure we want this on in all cases.


Making a Devel::StackTrace on every die could be a bit of a slowdown if
die is being abused for flow control.  I suppose it would be only an
option (a runtime selectable one).  Is there a better way?

Well, nobody should be doing that.  ;-)

Then again, trapped exceptions are not uncommon, especially when dealing with lots of files.


--
Leia/Lois:  Aren't you a little fat for a stormtrooper?
Luke/Chris: Well, stay here and rot, you stuck-up bitch.
  -- Family Guy, "Blue Harvest" (A "Star Wars" parody)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]