[Gas] Re: debugging question
Sigfried Gold
sigfried at onthejob.net
Thu Jun 7 06:29:56 CDT 2001
I put the following code in my main cgi script:
$::SIG{__DIE__} = \&stackTrace;
sub stackTrace {
use CGI;
if( defined CGI::param('debug') && CGI::param('debug') ) {
print "Content-type: text/html\n\n";
my $text .= "<FONT COLOR='red'><TABLE BORDER='1'><TR><TD>STACK TRACE</TD></TR>\n";
my $i = 0;
my $pk = __PACKAGE__;
package DB;
while( my @r = caller($i++) ) {
$text .= "<TR>\n";
$text .= join("",map { my $x = $_ || ' ';"<TD>$x</TD>\n" } @r, @DB::args);
$text .= "</TR>\n";
}
$text .= "</TABLE></FONT>\n";
print $text;
package main;
}
}
It worked to give me good line numbers for where DBI was dying. I doubt this
is the best solution because it's probably going to mean that Gas's normal
error handling doesn't happen correctly.
Any ideas on how to get the benefits of doing a stacktrace from a die handler
within Gas's normal error handling?
thanks,
sigfried
More information about the Gas
mailing list