How to debug a segfault.

David Brown haskell2 at davidb.org
Wed Feb 28 11:54:54 EST 2007


David Brown wrote:

> I discovered it isn't just x86, but appears to be this particular
> machine.  My other machines work fine.  There might be a library
> difference between the machines, or something like that.

   Program received signal SIGSEGV, Segmentation fault.
   [Switching to Thread -1212225872 (LWP 10128)]
   0x080b3618 in s2EI_info ()
   (gdb) pstk
   0xb79ff6b4:     0x805d0b8 <s6MR_info>
   0xb79ff6b0:     0x8159494
<zzlibzm0zi3_CodecziCompressionziZZlibziStream_a2_closure>
   0xb79ff6ac:     0x8159494
<zzlibzm0zi3_CodecziCompressionziZZlibziStream_a2_closure>
   0xb79ff6a8:     0x815c020
<base_DataziByteStringziBase_nullForeignPtr_closure>
   0xb79ff6a4:     0xb7a8768c
   0xb79ff6a0:     0xb7a87510
   0xb79ff69c:     0x81747a8

It looks like it might be in the zlib code.  The only place that this
code obviously does a peekCString is when it is about to throw an
error.  I'll check for a null pointer here, recompile and see if that
helps.

Hmm.  I recompiled 'zlib' with some extra tracing and now the problem
doesn't happen.  Even without the tracing it is fine.  Must have been
something wrong with the compiled library.  Scary.  But, everything is
working fine now.

Dave


More information about the Glasgow-haskell-users mailing list