Warm tip: This article is reproduced from serverfault.com, please click

How can I replay a multithreaded application?

发布于 2012-05-01 20:42:03

I want to record synchronization operations, such as locks, sempahores, barriers of a multithreaded application, so that I can replay the recorded application later on, for the purpose of debugging.

On way is to supply your own lock, sempaphore, condition variables etc.. functions that also do logging, but I think that is an overkill, because down under they must be using some common synchronization operations.

So my question is which synchronization operations I should log so that I require minimum modifications to my program. In other words, which are the functions or macros in glibc and system calls over which all these synchronization operations are built? So that I only modify those for logging and replaying.

Questioner
pythonic
Viewed
0
2017-05-23 19:55:16

The best I can think of is debugging with gdb in 'record' mode:

According to this page: GDB Process Record threading support is underway, but it might not be complete yet.


Less strictly answering your question, may I suggest

On other platforms, several other threading checkers exist, but I haven't got much experience with them.