From: Vimal R. <vim...@ya...> - 2003-04-24 22:04:41
|
Hello list, I'm a newbie to valgrind and want to find out if I can use Valgrind in my project. I'm trying to get address traces for executables. Since valgrind anyway checks each read and write, I was thinking it should be possible to log the address referenced by the read/write. I'm pretty sure the cachegrind skin uses this (addresses) to simulate different cache hierarchies. Or am I getting this wrong? Please let me know if you think this is a feasible task, so I will then go ahead and do some hacking to get the traces. cheers, Vimal ===== Vimal Reddy Graduate Student, ECE North Carolina State University Raleigh, NC Ph: (919) 836-8254 Web: http://www4.ncsu.edu/~vkreddy __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com |
From: Julian S. <js...@ac...> - 2003-04-24 22:29:39
|
Writing a skin to do this should be very easy. I suggest you start with the lackey skin. Or maybe the cacheprof one. You can instrument the basic blocks in flexible ways as they are passed to your skin. One simple thing to do is to call function(s) of your choice when LOADs / STOREs, and their FPU equivalents, happen. All in all a brilliant piece of engineering from Nick N. J On Thursday 24 April 2003 11:04 pm, Vimal Reddy wrote: > Hello list, > I'm a newbie to valgrind and want to find out if I can use Valgrind in my > project. I'm trying to get address traces for executables. Since valgrind > anyway checks each read and write, I was thinking it should be possible to > log the address referenced by the read/write. > > I'm pretty sure the cachegrind skin uses this (addresses) to simulate > different cache hierarchies. Or am I getting this wrong? Please let me > know if you think this is a feasible task, so I will then go ahead and do > some hacking to get the traces. > > cheers, > Vimal > > ===== > Vimal Reddy > Graduate Student, ECE > North Carolina State University > Raleigh, NC > Ph: (919) 836-8254 Web: http://www4.ncsu.edu/~vkreddy > > __________________________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo > http://search.yahoo.com > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users |
From: Nicholas N. <nj...@ca...> - 2003-04-25 10:14:49
|
On Thu, 24 Apr 2003, Julian Seward wrote: > Writing a skin to do this should be very easy. I suggest you > start with the lackey skin. Or maybe the cacheprof one. > You can instrument the basic blocks in flexible ways as they > are passed to your skin. One simple thing to do is to call > function(s) of your choice when LOADs / STOREs, and their > FPU equivalents, happen. ( s/cacheprof/cachegrind ) Read the docs on how to write a skin; there should be a link to it from within the main docs, coregrind/docs/coregrind_skins.html if not. include/vg_skin.h contains all the declarations relevant for writing skins, it's worth reading to see what services Valgrind provides to make skin-writing easier. And yes, it should be about as easy as any skin to write. N |
From: Alex I. <ale...@in...> - 2003-05-27 21:00:05
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> Hi all, <p>I have an application that spawns quite a few children processes. These children cannot be run standalone, they have to spawned by that master process. What I would like to do is to spawn just one of the children with Valgrind. I can tell the master application which child to spawn with Valgrind via a command-line switch, but the actual spawning is where I am at a loss. The master app is doing an execl() call, so I would need to explicitly list all Valgrind options in that call and then the application name. This is not very useful since I won't be able to change skins and options on the fly. <p>One way I could do it is tweak Valgrind code to read options from an environment variable, say VALGRIND_OPTS="-v --logfile=/tmp/VLOG" --leak-check=yes" and then in execl() call do something like: <p>if ( valgrind switch is set ) <br> execl ( ... , "valgrind", "Application", .... ) <br>else <br> execl ( ... , "Application", ... ) <p>I would rather not modify Valgrind source, since I would have to carry over changes between Valgrind versions. Is there any easier way to do what I am trying to accomplish? Any help would be greatly appreciated! <p>Thanks! <br>Alex Ivershen <pre>-- Alex G. Ivershen Inet Technologies, Inc. Network Products Dept. 1500 N. Greenville Ave. Inet Technologies Inc. Richardson, TX 75081 Phone: +1-469-330-4295 USA "Black Holes are where God divided by zero"</pre> </html> |
From: Paul H. <pa...@ha...> - 2003-05-27 21:22:02
|
On Tue, 27 May 2003, Alex Ivershen wrote: > Hi all, > I have an application that spawns quite a few children processes. These > children cannot be run standalone, they have to spawned by that master > process.=A0 What I would like to do is to spawn just one of the children > with Valgrind. I can tell the master application which child to spawn > with Valgrind via a command-line switch, but the actual spawning is where > I am at a loss.=A0 The master app is doing an execl() call,=A0 so I would > need to explicitly list all Valgrind options in that call and then the > application name. This is not very useful since I won't be able to change > skins and options on the fly. > > One way I could do it is tweak Valgrind code to read options from an > environment variable, say VALGRIND_OPTS=3D"-v --logfile=3D/tmp/VLOG" > --leak-check=3Dyes" and then in execl() call do something like: Write a 2 line script ValgrindWithOptions, which does: #!/bin/sh exec valgrind $VALGRIND_OPTS $* You can replace the 2 line script with a program in your language of choice, assuming your language of choice supports some form of exec() and won't trample any state information (like file descriptors) that the parent process sends to the child. > if ( valgrind switch is set ) > =A0=A0=A0 execl ( ... , "valgrind", "Application", .... ) =A0=A0=A0 execl ( ... , "ValgrindWithOptions", "Application", .... ) Or if there is enough information, you could rename "Application" and call your script Application. Then your script gets more complicated, because it would have to figure out which child process should be valgrind'ed. > else > =A0=A0=A0 execl ( ... , "Application", ... ) > I would rather not modify Valgrind source, since I would have to carry > over changes between Valgrind versions. Is there any easier=A0 way to do > what I am trying to accomplish?=A0 Any help would be greatly appreciated! > Thanks! > Alex Ivershen > > --=A0 > Alex G. Ivershen=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 Inet Technologies, Inc. > Network Products Dept.=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 1500 N. Greenville Ave. > Inet Technologies Inc.=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 Richardson, TX 75081 > Phone: +1-469-330-4295=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 USA > > "Black Holes are where God divided by zero" > =A0 ------------------------------------------------------- This SF.net > email is sponsored by: ObjectStore. If flattening out C++ or Java code to > make your application fit in a relational database is painful, don't do > it! Check out ObjectStore. Now part of Progress Software. > http://www.objectstore.net/sourceforge > _______________________________________________ Valgrind-users mailing > list Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |
From: Alex I. <ale...@in...> - 2003-05-28 19:56:42
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> Thank you Paul and everyone who replied - I got it working perfectly now! <p>Regards, <br>Alex <p>Paul Haas wrote: <blockquote TYPE=CITE>On Tue, 27 May 2003, Alex Ivershen wrote: <p>> Hi all, <p>> I have an application that spawns quite a few children processes. These <br>> children cannot be run standalone, they have to spawned by that master <br>> process.? What I would like to do is to spawn just one of the children <br>> with Valgrind. I can tell the master application which child to spawn <br>> with Valgrind via a command-line switch, but the actual spawning is where <br>> I am at a loss.? The master app is doing an execl() call,? so I would <br>> need to explicitly list all Valgrind options in that call and then the <br>> application name. This is not very useful since I won't be able to change <br>> skins and options on the fly. <br>> <br>> One way I could do it is tweak Valgrind code to read options from an <br>> environment variable, say VALGRIND_OPTS="-v --logfile=/tmp/VLOG" <br>> --leak-check=yes" and then in execl() call do something like: <p>Write a 2 line script ValgrindWithOptions, which does: <p>#!/bin/sh <br>exec valgrind $VALGRIND_OPTS $* <p>You can replace the 2 line script with a program in your language of <br>choice, assuming your language of choice supports some form of exec() and <br>won't trample any state information (like file descriptors) that the <br>parent process sends to the child. <p>> if ( valgrind switch is set ) <br>> ??? execl ( ... , "valgrind", "Application", .... ) <p> ??? execl ( ... , "ValgrindWithOptions", "Application", .... ) <p>Or if there is enough information, you could rename "Application" and call <br>your script Application. Then your script gets more complicated, because <br>it would have to figure out which child process should be valgrind'ed. <p>> else <br>> ??? execl ( ... , "Application", ... ) <p>> I would rather not modify Valgrind source, since I would have to carry <br>> over changes between Valgrind versions. Is there any easier? way to do <br>> what I am trying to accomplish?? Any help would be greatly appreciated! <p>> Thanks! <br>> Alex Ivershen <br>> <br>> --? <br>> Alex G. Ivershen??????????????????????????? Inet Technologies, Inc. <br>> Network Products Dept.????????????????????? 1500 N. Greenville Ave. <br>> Inet Technologies Inc.????????????????????? Richardson, TX 75081 <br>> Phone: +1-469-330-4295????????????????????? USA <br>> <br>> "Black Holes are where God divided by zero" <br>> ? ------------------------------------------------------- This SF.net <br>> email is sponsored by: ObjectStore. If flattening out C++ or Java code to <br>> make your application fit in a relational database is painful, don't do <br>> it! Check out ObjectStore. Now part of Progress Software. <br>> <a href="http://www.objectstore.net/sourceforge">http://www.objectstore.net/sourceforge</a> <br>> _______________________________________________ Valgrind-users mailing <br>> list Val...@li... <br>> <a href="https://lists.sourceforge.net/lists/listinfo/valgrind-users">https://lists.sourceforge.net/lists/listinfo/valgrind-users</a> <br>></blockquote> <pre>-- Alex G. Ivershen Inet Technologies, Inc. Network Products Dept. 1500 N. Greenville Ave. Inet Technologies Inc. Richardson, TX 75081 Phone: +1-469-330-4295 USA "Black Holes are where God divided by zero"</pre> </html> |
From: Alex I. <ale...@in...> - 2003-05-28 20:04:42
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> Gentlemen, <p>I am issuing an ioctl() call on a UNIX-domain socket to set it to message non-discard mode. Here is the trivial snippet of code:<font face="Courier New,Courier"></font> <p><font face="Courier New,Courier">---------------------------------------------------------------------------------</font> <br><font face="Courier New,Courier"> struct sockaddr_un socketAddress;</font> <br><font face="Courier New,Courier"> int socketFd = socket ( AF_UNIX, SOCK_DGRAM, 0 );</font><font face="Courier New,Courier"></font> <p><font face="Courier New,Courier"> if ( socketFd < 0 )</font> <br><font face="Courier New,Courier"> return -1;</font><font face="Courier New,Courier"></font> <p><font face="Courier New,Courier"> memset( &socketAddress, 0, sizeof( socketAddress ));</font> <br><font face="Courier New,Courier"> strcpy ( socketAddress.sun_path, "/tmp/testlistener" );</font> <br><font face="Courier New,Courier"> socketAddress.sun_family = AF_UNIX;</font> <br><font face="Courier New,Courier"> unlink ( "/tmp/testlistener" );</font> <br><font face="Courier New,Courier"> unsigned int len = strlen(socketAddress.sun_path) +</font> <br><font face="Courier New,Courier"> sizeof(socketAddress.sun_family);</font><font face="Courier New,Courier"></font> <p><font face="Courier New,Courier"> if ( bind (socketFd,(struct sockaddr*)&socketAddress,len ) < 0 )</font> <br><font face="Courier New,Courier"> {</font> <br><font face="Courier New,Courier"> return -1;</font> <br><font face="Courier New,Courier"> }</font> <br><font face="Courier New,Courier"> </font> <br><font face="Courier New,Courier"> // ... Set the socket to message non-discard mode</font> <br><font face="Courier New,Courier"> ioctl ( socketFd, I_SRDOPT, RMSGN );</font><font face="Courier New,Courier"></font> <p><font face="Courier New,Courier">---------------------------------------------------------------------------------</font><font face="Courier New,Courier"></font> <p><font face="Courier New,Courier">Valgrind, however, thinks that this is a CDROM-related ioctl() call and issues three errors to me. The log is below. I am using RH8 with glibc 2.2.93. Looks like this is valgrind core related, not application error. Could someone look into that?</font><font face="Courier New,Courier"></font> <p><font face="Courier New,Courier">Thanks a lot!</font> <br><font face="Courier New,Courier">Alex</font> <br><font face="Courier New,Courier"></font> <font face="Courier New,Courier"></font> <p><font face="Courier New,Courier">==28423== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)</font> <br><font face="Courier New,Courier">==28423==</font> <br><font face="Courier New,Courier">==28423== 1 errors in context 1 of 3:</font> <br><font face="Courier New,Courier">==28423== Syscall param ioctl(CDROMREADTOCENTRY) contains unaddressable byte(s)</font> <br><font face="Courier New,Courier">==28423== at 0x420D3454: __GI___ioctl (in /lib/i686/libc-2.2.93.so)</font> <br><font face="Courier New,Courier">==28423== by 0x420158D3: __libc_start_main (in /lib/i686/libc-2.2.93.so)</font> <br><font face="Courier New,Courier">==28423== by 0x8048408: (within /home/agi/probe/Prototype/ValgrindIoctlTest/a.out)</font> <br><font face="Courier New,Courier">==28423== Address 0x2 is not stack'd, malloc'd or free'd</font> <br><font face="Courier New,Courier">==28423==</font> <br><font face="Courier New,Courier">==28423== 1 errors in context 2 of 3:</font> <br><font face="Courier New,Courier">==28423== Syscall param ioctl(CDROMREADTOCENTRY (cdte_track, char)) contains uninitialised or unaddressable byte(s)</font> <br><font face="Courier New,Courier">==28423== at 0x420D3454: __GI___ioctl (in /lib/i686/libc-2.2.93.so)</font> <br><font face="Courier New,Courier">==28423== by 0x420158D3: __libc_start_main (in /lib/i686/libc-2.2.93.so)</font> <br><font face="Courier New,Courier">==28423== by 0x8048408: (within /home/agi/probe/Prototype/ValgrindIoctlTest/a.out)</font> <br><font face="Courier New,Courier">==28423== Address 0x2 is not stack'd, malloc'd or free'd</font> <br><font face="Courier New,Courier">==28423==</font> <br><font face="Courier New,Courier">==28423== 1 errors in context 3 of 3:</font> <br><font face="Courier New,Courier">==28423== Syscall param ioctl(CDROMREADTOCENTRY (cdte_format, char)) contains uninitialised or unaddressable byte(s)</font> <br><font face="Courier New,Courier">==28423== at 0x420D3454: __GI___ioctl (in /lib/i686/libc-2.2.93.so)</font> <br><font face="Courier New,Courier">==28423== by 0x420158D3: __libc_start_main (in /lib/i686/libc-2.2.93.so)</font> <br><font face="Courier New,Courier">==28423== by 0x8048408: (within /home/agi/probe/Prototype/ValgrindIoctlTest/a.out)</font> <br><font face="Courier New,Courier">==28423== Address 0x4 is not stack'd, malloc'd or free'd</font> <br><font face="Courier New,Courier">==28423== IN SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)</font> <br><font face="Courier New,Courier">==28423==</font> <br><font face="Courier New,Courier">==28423== malloc/free: in use at exit: 0 bytes in 0 blocks.</font> <br><font face="Courier New,Courier">==28423== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.</font> <pre>-- Alex G. Ivershen Inet Technologies, Inc. Network Products Dept. 1500 N. Greenville Ave. Inet Technologies Inc. Richardson, TX 75081 Phone: +1-469-330-4295 USA "Black Holes are where God divided by zero"</pre> </html> |
From: Robert W. <rj...@du...> - 2003-05-28 20:25:41
|
> Valgrind, however, thinks that this is a CDROM-related ioctl() call > and issues three errors to me. The log is below. I am using RH8 with > glibc 2.2.93. Looks like this is valgrind core related, not > application error. Could someone look into that? If you look in the header files, CDROMREADTOCENTRY has the same value as I_SRDOPT, which is unfortunate. The only way you could tell these two apart is by knowing that the file descriptor in question is a socket file descriptor. My file descriptor leakage patch already makes note of that (i.e. that a file descriptor is a socket file descriptor) - it shouldn't be too much trouble to modify it the ioctl code to check this. Give me about a day or so and I'll see what I can do. Regards, Robert. |
From: Olly B. <ol...@su...> - 2003-05-28 00:57:17
|
On Tue, May 27, 2003 at 03:59:33PM -0500, Alex Ivershen wrote: > One way I could do it is tweak Valgrind code to read options from an > environment variable, say VALGRIND_OPTS="-v --logfile=/tmp/VLOG" --leak-check= > yes" Um, valgrind already reads options from the environmental variable VALGRIND_OPTS - it has since at least valgrind 1.0.4 (the oldest I have to hand). Cheers, Olly |
From: Nicholas N. <nj...@ca...> - 2003-05-28 07:53:07
|
On Tue, 27 May 2003, Alex Ivershen wrote: > I have an application that spawns quite a few children processes. By default, Valgrind does not trace child processes. This means that if you Valgrind a script, Valgrind will check the script interpreter, eg. Perl or Bash or whatever, but not any child processes exec'd by the script. But if you specify --trace-children=yes, it does trace children. But if you must Valgrind only one of the children, this won't be precise enough. > if ( valgrind switch is set ) #include memcheck.h, and use the RUNNING_ON_VALGRIND macro to do this check. HTH N |