|
From: Dmitry B. <dba...@gm...> - 2006-06-04 14:46:51
|
Hello, Tell me please, if I wish to get and examine syscall attributes from the valgrind tool, how should I do that? -- With best wishes Dmitry Baryshkov |
|
From: Tom H. <to...@co...> - 2006-06-04 14:50:15
|
In message <bc6...@ma...>
"Dmitry Baryshkov" <dba...@gm...> 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?
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: Dmitry B. <dba...@gm...> - 2006-06-04 15:21:50
|
Hello, 2006/6/4, Tom Hughes <to...@co...>: > In message <bc6...@ma...> > "Dmitry Baryshkov" <dba...@gm...> 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. -- With best wishes Dmitry Baryshkov |
|
From: Tom H. <to...@co...> - 2006-06-04 17:19:22
|
In message <bc6...@ma...>
"Dmitry Baryshkov" <dba...@gm...> wrote:
> 2006/6/4, Tom Hughes <to...@co...>:
>
> > In message <bc6...@ma...>
> > "Dmitry Baryshkov" <dba...@gm...> 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.
So you're writing a tool and you want it to be able to spot system calls
and examine the arguments?
I don't think there is a simple way of doing that - there isn't any tool
function that is called by the core when a system call is taken as far
as I know.
I think you would have to instrument the code which probably also means
knowing which registers the system call arguments will be in for each
of the supported platforms.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
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 |