|
From: Wonjoon S. <kn...@gm...> - 2012-08-02 22:21:11
|
Hello All I am trying to build a new tool using valgrind. I'm also trying to use mmap system call to get huge memory block in my tool. When I use do_syscall in my tool I get an error message like this. I tried several other calls (getpid, etc) and every time I get this segmentation fault error. =================================================================================================== --24479-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting --24479-- si_code=1; Faulting address: 0x52; sp: 0x629a2dc0 valgrind: the 'impossible' happened: Killed by fatal signal ==24479== at 0x38059A25: vgPlain_do_syscall (m_syscall.c:72) ==24479== by 0x3808E5E1: handle_syscall (scheduler.c:1057) =================================================================================================== I tried to search for examples using system call in tools but it seems they(memcheck, massif, lackey) don't use it. My question is, is it allowed to use system call in a valgrind tool? Is it recommended not to use system call? If it is allowed to use system call in a tool, what should I do to make this thing work? I use valgrind-3.8.0.SVN, and 32 bit Ubuntu 12.04, which is a VM. Thank you, Wonjoon Song |
|
From: Philippe W. <phi...@sk...> - 2012-08-03 19:05:21
|
On Thu, 2012-08-02 at 18:21 -0400, Wonjoon Song wrote: ... > > valgrind: the 'impossible' happened: > Killed by fatal signal > ==24479== at 0x38059A25: vgPlain_do_syscall (m_syscall.c:72) > ==24479== by 0x3808E5E1: handle_syscall (scheduler.c:1057) ... > > I tried to search for examples using system call in tools but it seems > they(memcheck, massif, lackey) don't use it. Difficult to see what is going wrong without looking at (some of) the code. For sure, tools are e.g. calling VG_(getpid) without crashing :). For what concerns mmap, you should not use mmap syscall directly. Instead, you should use the interface of the Valgrind address space manager (i.e. pub_tool_aspacemgr.h). > > > My question is, is it allowed to use system call in a valgrind tool? > Is it recommended not to use system call? If it is allowed to use > system call in a tool, what should I do to make this thing work? You can use syscalls, but you must have the "interface" defined for it. See e.g. m_libcproc.c and similar to see how the "VG(xxxxxx)" are providing the equivalent of the xxxxxx syscall. Philippe |