|
From: Nicholas N. <n.n...@gm...> - 2009-05-08 03:42:42
|
On Fri, May 8, 2009 at 1:21 PM, sahannum <sah...@gm...> wrote: > > My short-term goal here is to mimic the functionality of strace and list the > system calls that a target process makes during run-time. For my first step > I used VG_(needs_syscall_wrapper) and wrote the post_syscall function to > simply print something each time it's called (just a "hello" and a counter, > basically). What I found was that strace run on date reports me 51 system > calls, and my little valgrind tool reports 141 system calls...which implies > that valgrind is calling my function both for date's system calls and its > own system calls (or at least its own system calls, perhaps at the exclusion > of date?)...I'm not sure. post_syscall should only be called for the client program's system calls. I don't know why you're getting the 51 vs 141. > My questions for you all: > - How can I get a pointer to the system call that has triggered the wrapper > functions? Ideally, how might I get the name of that system call? Every syscall has a number. The number is one of the parameters to the syscall, you have to know, for the platform you're on, which syscall number maps to which syscall. > - How can I tell whether the system call was in relation to Valgrind or the > target process? As above, they should just belong to the target process. If you run "strace -f valgrind date" you'll get many more than 141 syscalls. You should also look at the implementation of the --trace-syscalls option and coregrind/m_syswrap/syswrap-*, which has all the core's syscalls wrappers. Nick |