From: Behdad E. <be...@cs...> - 2006-05-30 13:55:47
|
On Tue, 30 May 2006, Ashley Pittman wrote: > On Sun, 2006-05-28 at 13:41 -0400, Behdad Esfahbod wrote: > > Given that valgrind.h/memcheck.h > > are suggested to be copied into user projects > > Is that true? As a header file surely it should be included via a > #include line rather than copied and distributed with the user project. Yes, it is true. I certainly know how to #include a header! Just read the second comment block in valgrind.h: /* This file is for inclusion into client (your!) code. ... > > I'm wondering what > > stability promises do valgrind make. Or for example, if this new > > hint is added, is there a way to detect that and not enable the > > hints if the new hint is not available? > > There are two issues here, firstly there was a major change (in > practical terms at least) where Julian changed the magic for making > client requests, there is now a "old method" and a "new method", the new > code coming into force with r5603 in February. I expected a major version change with such a breakage. > The client requests themselves did not change at this time, merely the > underlying magic sequence so the same client code will work with either > set, as long as it was compiled with the correct header for the running > version. This is a good reason for not shipping your own copies of the > valgrind headers. But there are other reasons for why including the headers is a good idea, and that's the recommended way anyway. > The second issue is the question of how to tell if a specific hint is > supported, most of them have a return code of 0 if not running on > valgrind and 1 for success, other values for different error cases. > Valgrind itself gives a warning to the user if you make a client request > it doesn't know about. All the client requests return 0 if you are > using the wrong headers. Humm, didn't find this documented anywhere in the headers, thanks. > Ashley, --behdad http://behdad.org/ "Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill" -- Dan Bern, "New American Language" |