|
From: Nicholas N. <nj...@cs...> - 2006-09-21 16:26:08
|
On Thu, 21 Sep 2006, Josef Weidendorfer wrote: > > I'm not sure that the scheme of having the tool inspect syscalls > > to detect fork() is going to work cleanly. This is because different > > platforms use different syscalls to do fork, eg Linux does sys_fork > > and sometimes sys_clone, but AIX only does sys_fork, and we don't > > want to force tools to have platform-specific handling like that. > > > > Maybe a better solution is to add to the core-tool interface a > > 'fork-is-happening-now' event which tools can ask to see. Then > > only the core needs to be able to detect fork-like syscalls. > > Yes. I would prefer such a "cleanup_tool_state_after_fork" hook. I agree. This is similar to knowing about memory allocated by mmap/brk/etc. Here's a possible interface for 'pre' and 'post' events: void VG_(track_pre_fork) ( void(*f)(void) ); void VG_(track_post_fork)( void(*f)(Bool isChild) ); So for 'pre_fork' the tool would be told it's about to happen, but no more information. For 'post_fork' the tool would be told it's just happened, and whether it's the parent or child. Is there any other info a tool needs to know when a fork/clone happens? > BTW, cachegrind/massif also should have this kind of "problem", or? I guess so. I'd never thought about it. Nick |