|
From: Filipe C. <fi...@gm...> - 2009-05-08 07:46:56
|
Hi, Valgrind won't call tool functions for it's own system calls, only for the process client... Doesn't the --trace-syscalls=yes option make what you want? Or do you want to expand on it afterwards? Regards, Filipe sahannum wrote: > Thanks in advance for reading through this. > > I've read through the documentation (with particular focus on the "How to > build a tool" section), read through some of the papers, and spent a lot of > time fishing through the comments in the headers and Memcheck, as well as > the source code to Flayer. > (http://www.usenix.org/events/woot07/tech/full_papers/drewry/drewry_html/ ) > > 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. > > 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? > - How can I tell whether the system call was in relation to Valgrind or the > target process? > > If anyone can either point me to example source, a paper, or anything that > might get me looking in the right places, I would be very grateful. As it > stands I am trying to reverse engineer what I'm looking for digging through > Flayer and Memcheck; my answers may lie there, but I have yet to find them. > > Thanks again, in advance. |