[Israel.pm] catching segmentation faults and other crashes

Tal Kelrich tal at musicgenome.com
Mon Nov 12 02:05:40 PST 2007


On Mon, 12 Nov 2007 09:53:24 +0000
Mikhael Goikhman <migo at homemail.com> wrote:

> On 12 Nov 2007 09:51:04 +0200, Yona Shlomo wrote:
> > 
> > Can you recommend a way to catch the crash of the tool,
> > despite the fact that it still emits some (possibly good)
> > output?
> 
> Run these commands, one with and one without internal segfault:
> 
>   perl -e 'print qx(perl -e "\$| = 1; print qq(output\n); 1 &&
> dump()"); print "Core dumped\n" if $? & 128'
> 
>   perl -e 'print qx(perl -e "\$| = 1; print qq(output\n); 0 &&
> dump()"); print "Core dumped\n" if $? & 128'
> 
> You should remember to remove core files if any (named like core or
> perl.core or core.12345, depending on the OS).
> 
> Regards,
> Mikhael.
> 

You should really be using the POSIX::W* macros. there's really no
guarantee that $? bit twiddling will get you the right results.

Regards,
	Tal Kelrich

-- 
Tal Kelrich
PGP fingerprint: 3EDF FCC5 60BB 4729 AB2F  CAE6 FEC1 9AAC 12B9 AA69
Key Available at: http://www.hasturkun.com/pub.txt
----
You can't have your cake and let your neighbor eat it too.
		-- Ayn Rand
----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://perl.org.il/pipermail/perl/attachments/20071112/4a527df6/attachment.pgp 


More information about the Perl mailing list