Challenging things to do: SIGSEGV catcher and backtrace extractor

2002-04-11 Thread Stas Bekman

A few moons ago we have discussed on the dev list a tool for automatic 
segfault detection (including multiple segfaults during 'make test') and 
core backtrace generation. I'm quite frankly tired of explaining again 
and again that we need a core file backtrace, how to get the core file 
dumped and generating trace (no offense, just facts). I'm sure there is 
a better way to do. If we can automate this process, like many other 
apps do (e.g. gnome/kde apps) this will save us a lot of traffic on the 
list and frustration on users' behalf and make us all happier.

I've planned on working on this idea for a long time, but other things 
seem to get on my way. (like helping getting the core dumped :)

Any takers?

If you are interested, here is some more info:

There are two situations when we want this.

1. during 'make test'. which is sort of very easy, because the new test 
suite already scans for core files. And there is a perl module on CPAN 
that automatically extracts the backtrace from a given core file (which 
almost works). The catch is that there can be more than one core dumped 
and they all be overwritten by the last core dumped. Therefore it's 
better to install a SIGSEGV to do the work. You will probably need to do 
it in XS (could write a prototype with Inline). I think I've tried in 
Perl and it didn't work (since SIGSEGV is caught on the C level by 
httpd). If this works, you will be able to generate as many backtraces 
as the number of segfaults

2. during normal use. Those users who get segfaults will load something 
like Apache::SEGV2BT and it'll write a backtrace every time segfault 
happens.

Therefore it's most likely case 2 which can be used as case 1.

For generating segfaults for testing, see my Bad::Segv module, updated 
by Kevin A. McGrail at http://www.peregrinehw.com/downloads/apache/mod_perl
and discussed here:
http://perl.apache.org/preview/modperl-docs/dst_html/docs/2.0/devel/debug_c/debug_c.html#Getting_the_core_File_Dumped

p.s. I'm talking about mod_perl 2.0 mainly, but it probably should be 
easy to make it work for 1.x as well once it works for 2.0.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Challenging things to do: SIGSEGV catcher and backtrace extractor

2002-04-11 Thread Doug MacEachern

On Fri, 12 Apr 2002, Stas Bekman wrote:
 
 If you read the rest of the post I mention it (without telling the name 
 :). The problem with this module is that it's useful only after you have 
 the core file. which is not good, because (as I've already explained):

it's important to mention Devel::CoreStack, as it is a good starting 
point.
 
 1. Many users have problems getting the core file dumped

then there'd be no way to automate generating a stacktrace anyhow.

 2. There can be multiply segfaults with different causes which will 
 overwrite each other, so we want to catch SEGVs as they happen.

that's ok, we'll deal with one at time.

 Not talking about the fact that this module is not slick, e.g. you need 
 manual interaction to help it get to the trace. (it shows the gdb's 
 *more* pager for long output of loading symbols).

don't have to use the module as-is, but there is plenty of logic in there 
that can be borrowed, rather than figuring out everything from scratch.





Re: Challenging things to do: SIGSEGV catcher and backtrace extractor

2002-04-11 Thread Stas Bekman

Doug MacEachern wrote:
 On Fri, 12 Apr 2002, Stas Bekman wrote:
  
 
If you read the rest of the post I mention it (without telling the name 
:). The problem with this module is that it's useful only after you have 
the core file. which is not good, because (as I've already explained):
 
 
 it's important to mention Devel::CoreStack, as it is a good starting 
 point.

true, as it has the config for a few known debuggers, but otherwise it 
just invokes the debugger and pipes the 'bt' or equivalent command to it 
and grabs the output.

1. Many users have problems getting the core file dumped
 
 
 then there'd be no way to automate generating a stacktrace anyhow.

You can get a backtrace if you run the process under debugger without 
dumping a core file. No special setup required. I was thinking to attach 
the debugger on SIGSEGV event. Is it too late? I see certain gnome apps 
failing and they ask you if you want to get the stack, without me doing 
anything at all. That's what I want for modperl. You say it's not possible?

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Challenging things to do: SIGSEGV catcher and backtrace extractor

2002-04-11 Thread Doug MacEachern

On Fri, 12 Apr 2002, Stas Bekman wrote:
 
 You can get a backtrace if you run the process under debugger without 
 dumping a core file. No special setup required. I was thinking to attach 
 the debugger on SIGSEGV event. Is it too late? I see certain gnome apps 
 failing and they ask you if you want to get the stack, without me doing 
 anything at all. That's what I want for modperl. You say it's not possible?

anything is possible of course.  but then you have to run the tests with 
httpd running under gdb, not something that should be done by default.
maybe you don't need gdb either, i dunno, if gnome has a trick up its 
sleeve, might be worth looking at.




Challenging things to do: SIGSEGV catcher and backtrace extractor

2002-04-11 Thread Kevin A. McGrail

 Date: Fri, 12 Apr 2002 00:24:11 +0800
 To: [EMAIL PROTECTED]
 From: Stas Bekman [EMAIL PROTECTED]
 Subject: Challenging things to do: SIGSEGV catcher and backtrace extractor
 Message-ID: [EMAIL PROTECTED]

 A few moons ago we have discussed on the dev list a tool for automatic
 segfault detection (including multiple segfaults during 'make test') and
 core backtrace generation. I'm quite frankly tired of explaining again
 and again that we need a core file backtrace, how to get the core file
 dumped and generating trace (no offense, just facts). I'm sure there is
 a better way to do. If we can automate this process, like many other
 apps do (e.g. gnome/kde apps) this will save us a lot of traffic on the
 list and frustration on users' behalf and make us all happier.

While I can't step up to the plate to help on development because I am still working 
on GETTING a
core file, I can second the motion.  The frustration in getting a good working core 
file to trace
has been enormous and I am neither a newbie nor someone who gives up easily.

Regards,
KAM





Re: Challenging things to do: SIGSEGV catcher and backtrace extractor

2002-04-11 Thread Daniel Jacobowitz

On Fri, Apr 12, 2002 at 02:09:44AM +0800, Stas Bekman wrote:
 Doug MacEachern wrote:
 On Fri, 12 Apr 2002, Stas Bekman wrote:
  
 
 If you read the rest of the post I mention it (without telling the name 
 :). The problem with this module is that it's useful only after you have 
 the core file. which is not good, because (as I've already explained):
 
 
 it's important to mention Devel::CoreStack, as it is a good starting 
 point.
 
 true, as it has the config for a few known debuggers, but otherwise it 
 just invokes the debugger and pipes the 'bt' or equivalent command to it 
 and grabs the output.
 
 1. Many users have problems getting the core file dumped
 
 
 then there'd be no way to automate generating a stacktrace anyhow.
 
 You can get a backtrace if you run the process under debugger without 
 dumping a core file. No special setup required. I was thinking to attach 
 the debugger on SIGSEGV event. Is it too late? I see certain gnome apps 
 failing and they ask you if you want to get the stack, without me doing 
 anything at all. That's what I want for modperl. You say it's not possible?

Sure, that's possible from the SEGV handler.

-- 
Daniel Jacobowitz   Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer