Search code examples
clinuxgccx86-64glibc

How can I replay a multithreaded application?


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.


Solution

  • 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.