|
From: Josef W. <Jos...@gm...> - 2005-11-02 09:04:15
|
On Wednesday 02 November 2005 06:50, Yao Qi wrote: > Hello,all, > > I am reading lackey/lk_main.c and I want to add some features to > lackey. One thing I want to do is to get the name of the specified > program in lackey, for example, > > ./coregrind/valgrind --tool=lackey hello > > How could lackey get the program name "hello"? I think stage1 and > stage2 could do that, but I am not sure how to do that in a valgrind > tool. Maybe someone of you could clarify for me. Thanks in advance. When writing a tool, you need to use functions/global variables defined in valgrinds tool API. For VG 3.x, the API is defined in the header files $prefix/include/valgrind/pub_tool_* For VG 2.x, it was $prefix/include/valgrind/vg_tool.h The concrete function (more exact: global variable) you ask for changed from VG 3.0.x to VG 3.1.x. For VG 3.0.x, it is VG_(client_argv)[0], defined in pub_tool_libcproc.h. For VG 3.1.x, it is VG_(args_the_exename), defined in pub_tool_clientstate.h. Josef |