plasma-umass / DoubleTake

Evidence-based dynamic analysis: a fast checker for memory errors.
MIT License
21 stars 12 forks source link

Replaying of dining philosopher problem #2

Open tongping opened 11 years ago

tongping commented 11 years ago

We can't replaying the test case of dining philosopher problem: the program will be stucked there without any progress in the replaying phase.

The stucked behavior can be changed by changing the print out inside StopGap (we can close the debugging printing) and the number of philosophers. If no printing from StopGap inside, the stucked may happen less often. Also, the smaller number of philosophers, the less to be stucked.

tongping commented 11 years ago

This problem are traced back the fprintf inside the program. Actually, fprintf sometime is going to allocate more memory. StopGap tries to reproduce all memory usage that this additional (unexpected) fprintf cause the replay to be stucked.

The solution can be easy: we can intercept printf and fprintf function and make the program to use our internal heap.

But it is important to use a safe printf or fprintf function. Also, my debugging uses a lot of printing too.

However, it is not easy to do that. Any suggestion on this?