Version française
Home     About     Download     Resources     Contact us    
Browse thread
Tips to find the cause of a seg fault
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Romain Beauxis <toots@r...>
Subject: Re: [Caml-list] Tips to find the cause of a seg fault
Le mercredi 1 décembre 2010 09:17:15, Philippe Veber a écrit :
> > The function that triggers the segfault may be confusing, in particular
> > in case of a memory corruption, which I suspect here.
> > The pattern matching can cause a crash because it is using a value that
> > is already corrupted and because the third case is one that, for some
> > random conditions, touches the part in memory that is corrupted.
> 
> How is this possible if it is never reached (no left click) ?

Well, I was giving a general reply which may or may not apply here..
The fact that the problem goes away when you uncomment the unused case could 
be unrelated, though. It could also be that the issue is not related to this 
exact function but that the compiled binary has a different execution flow when 
you uncomment the third case..

> > In this case, I would try to unroll the code and see where the value that
> > is
> > used in this function was instanciated.
> 
> What do you mean by "unrolling the code" ?

Looking backward where the value used in the function was instanciated.

> > Finally, the best approach could be to actually look closely to the
> > binding's
> > code and try to spot anything fishy there related to your issue. This
> > generaly
> > worked better for me than trying to get information from gdb and the
> > like..
> 
> Many thanks for the clarification. Maybe I could (partially) "unplug" the
> GC by setting space_overhead to 100 ? That could give an indication on the
> moment the problem occurs ?

I've never tried this. What you can try also for instance is to comment the 
code that finalizes a value that you suspect causes the segfault..

However, I do not think your issue is related to the Gc. The backtrace does 
not seem to indicate that it occurs in C code with global lock removed so 
maybe what I said was irrelevant.

I have tried your minimal example and it does not segfault here too. As for 
Olivier, maybe this means that this is also related to the driver you are 
using. However, the segfault definitely seem to occur in ocaml part of the code 
so it seems that the problem is entangled, at least.


Romain
Romain