|
From: Josef W. <Jos...@gm...> - 2006-09-20 22:56:30
|
On Thursday 21 September 2006 00:16, Julian Seward wrote: > On Wednesday 20 September 2006 23:00, Nicholas Nethercote wrote: > > On Wed, 20 Sep 2006, Josef Weidendorfer wrote: > > > There is a thread creation hook, but that is useless in this case. Or is > > > there a possibility to hook into a system call? > > > > Yes. See VG_(needs_syscall_wrapper) in include/pub_tool_tooliface.h. > > You should be able to compare the syscall_num against __NR_fork. If future > > OSes have fork() calls with different names, I'm not sure how best to > > handle it. Nick, thanks. __NR_fork is defined somewhere in coregrind/, but I can not include it from there. Using "#include <sys/syscall.h>" works however. I hope this is fine from a VG tool. > > In particular, doesn't Linux sometimes use clone with certain parameters > as fork() ? I suppose so, too. > I'm sure the PRE(sys_clone) functions have some magic stuff > to handle this. Not sure what to do here. I can check for __NR_clone, but how to get the clone flags parameter in the wrapper? > Josef - can you think of a way to make a regression test case for this > bug (134316)? It would be nice to have one. In verbose mode, I can print a message when callgrind zeroes the cost when detecting to be in the child after fork. This output can be checked in the regression together with a code which does a fork, or? > This is the kind of fix it > is easy to break later and not notice for a long time :-( Yes. Josef > > J > > |