From: Paul Brannan Date: 2007-04-11T05:15:12+09:00 Subject: Re: Ruby C extension crash: how to create a stack trace? On Wed, Apr 11, 2007 at 04:25:11AM +0900, barabba wrote: > Yes it is fast the same. MSVC start and run ruby using my_script.rb as > argument. The problem is the "backtrace", it is only one line, because > ruby don't crash, just exit. Gdb stops when the application gets a signal, rather than waiting for the application to terminate. > It is still not clear why > trap("SEGV"){"my seg fault handler";exit} > doesn't work on my system. It seam that the exception is caught, but > the C code is recalled at the same place where the error is generated > causing an infinite loop (may be an EXCEPTION_CONTINUE_EXECUTION is > used in the trap handler?). If you segfault, you have already entered into the world of undefined behavior. Anything your application does after that point is unpredictable. (For that reason, in most applications it's better to let the application crash than to continue running in a bad state). Do you get a stack trace if you place a breakpoint in sighandler() (in signal.c)? Paul