0

I have a multiprocess application and I trace it in Pin using the follow_execv switch. To put it simply, there exists a fork in the program. Before the fork occurs, I create a set and make some insertions. Right after fork, because of the follow_execv switch, an extra copy of my pintool is created and executed. Both the parent and child pintools contain the same contents. But after the FOLLOW_CHILD_PROCESS_CALLBACK is called, the set in the child becomes empty. Why is this happening?

P.S.: The program is gimp. It is both multiprocess and multithreaded. Are there any limitations for these kinds of programs in Pin?

TheAhmad
  • 810
  • 1
  • 9
  • 21
  • 1
    Just some ideas... Is Intel's Pin library fork safe? If it is, then it could be the Pin library has an `at_fork` handler that clears the state of the child on fork. – jww Oct 26 '19 at 11:04
  • In fact, only part of the state is cleared. I have a counter variable in the parent the value of which remains intact in the child! – TheAhmad Oct 26 '19 at 13:58
  • @jww, it was a good hint. I mmaped a shared page to avoid possible Pin initialization mess. – TheAhmad Oct 26 '19 at 15:18
  • Well, I think that I should give up on `shared memory`. They are also removed by `Pin`, after each `fork`. It seems that using `files` to share data between parent and child `pintools` is the last solution. – TheAhmad Oct 27 '19 at 22:20

0 Answers0