|
From: Nicholas N. <nj...@cs...> - 2006-06-04 22:11:13
|
On Sun, 4 Jun 2006, Dmitry Baryshkov wrote: >>> Tell me please, if I wish to get and examine syscall attributes from >>> the valgrind tool, how should I do that? >> >> What do you mean by "attributes" exactly? > > I'm sorry, I meant arguments. If you just want to see them, you can use the standard Unix 'strace' utility. Or if you run programs under Valgrind with the --trace-syscalls=yes you get a similar, but less pretty, result. If you want to do something more involved, you can wrap system calls from a Valgrind tool. You need to register pre-syscall and post-syscall handler functions with VG_(need_syscall_wrappers)(); see include/pub_tool_tooliface.h. However, those aren't great, because they only get passed the syscall number. You then have to extract the arguments manually from the registers or wherever, and the location of the arguments varies across platforms, and its not even consistent within platforms. This is possible but tedious; Valgrind does it internally for determing which registers and To see how to do it, look at the PRE() and POST() macros in coregrind/m_syswrap/syswrap-*.c. Actually, a tool can also use VG_(track_pre_reg_read)() and VG_(track_pre_mem_read)() to register handlers that get told when registers and memory are read (in some circumstances). When the "CorePart" argument to these handlers is equal to Vg_CoreSysCall, you'll know the register/memory is being read because it's a system call argument. This might be helpful, although it again doesn't tell you directly the arguments. Nick |