|
From: Karai C. <cs...@fr...> - 2006-08-16 15:20:51
|
Hi!
If you, developers are interested, I would write a new component for
valgrind, a precompiler.
The precompiler would modify the C/C++ code to detect more memory
errors in the program.
How it would work?
- one should compile with valgrind-cc instead of gcc
- valgrind-cc calls the gcc -E for getting a clean code
without macros and includes
- after that it modifies the code for further checks
- compiles the modified code
My precompiler could detect array bound errors, such as:
static int array [ 5 ];
void error()
{
array[ 10 ] = 10;
}
After the modifications:
static int array [ 5 ];
void error()
{
indexcheck(10,5);array[ 10 ] = 10;
}
void indexcheck( int i1, int i2 )
{
if( i1 < 0 || i1 >= i2 )
...
}
This could work for primitive types, where no operator[] is defined.
Do you think it worths to write such a component?
Thanks,
Csaba
|
|
From: Bart V. A. <bar...@gm...> - 2006-08-16 15:37:25
|
Hello Karai,
What would such a compiler do more than the -fmudflap feature of gcc 4 ?
See also
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Optimize-Options.html#Optimize-Options
On 8/16/06, Karai Csaba <cs...@fr...> wrote:
>
> Hi!
>
> If you, developers are interested, I would write a new component for
> valgrind, a precompiler.
>
> The precompiler would modify the C/C++ code to detect more memory
> errors in the program.
>
> How it would work?
>
> - one should compile with valgrind-cc instead of gcc
> - valgrind-cc calls the gcc -E for getting a clean code
> without macros and includes
> - after that it modifies the code for further checks
> - compiles the modified code
>
>
> My precompiler could detect array bound errors, such as:
>
>
> static int array [ 5 ];
> void error()
> {
> array[ 10 ] = 10;
> }
>
>
> After the modifications:
>
> static int array [ 5 ];
> void error()
> {
> indexcheck(10,5);array[ 10 ] = 10;
> }
>
> void indexcheck( int i1, int i2 )
> {
> if( i1 < 0 || i1 >= i2 )
> ...
> }
>
>
>
> This could work for primitive types, where no operator[] is defined.
>
> Do you think it worths to write such a component?
>
|
|
From: Karai C. <cs...@fr...> - 2006-08-16 16:39:52
|
ext Bart Van Assche =EDrta: > Hello Karai, >=20 > What would such a compiler do more than the -fmudflap feature of gc= c=20 > 4 ? See also=20 > http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Optimize-Options.html#Optim= ize-Options=20 > <http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Optimize-Options.html#Opti= mize-Options> >=20 I didn't know that GCC 4 implemented this feature. In this case writing this component is not necessary. Thank you, Bye, Csaba |
|
From: Nicholas N. <nj...@cs...> - 2006-08-16 23:56:05
|
On Wed, 16 Aug 2006, Karai Csaba wrote: > If you, developers are interested, I would write a new component for > valgrind, a precompiler. > > The precompiler would modify the C/C++ code to detect more memory > errors in the program. > > How it would work? > > - one should compile with valgrind-cc instead of gcc > - valgrind-cc calls the gcc -E for getting a clean code > without macros and includes > - after that it modifies the code for further checks > - compiles the modified code It sounds like this would be a totally different tool -- certainly complementary to Valgrind, but not particularly related. Another random point of note: people really like dynamic instrumentation because it's so easy to use -- you don't have to recompile anything or do any other kind of preparation. People *really* like that. Nick |
|
From: Gurganus, B. L <gur...@ro...> - 2006-08-17 02:09:03
|
That tools sounds like ccurred. Brant Gurganus http://www.rose-hulman.edu/~gurganbl -----Original Message----- From: val...@li... on behalf of = Nicholas Nethercote Sent: Wed 08/16/06 7:55 PM To: Karai Csaba Cc: val...@li... Subject: Re: [Valgrind-developers] Precompiler for valgrind =20 On Wed, 16 Aug 2006, Karai Csaba wrote: > If you, developers are interested, I would write a new component for > valgrind, a precompiler. > > The precompiler would modify the C/C++ code to detect more memory > errors in the program. > > How it would work? > > - one should compile with valgrind-cc instead of gcc > - valgrind-cc calls the gcc -E for getting a clean code > without macros and includes > - after that it modifies the code for further checks > - compiles the modified code It sounds like this would be a totally different tool -- certainly=20 complementary to Valgrind, but not particularly related. Another random point of note: people really like dynamic = instrumentation=20 because it's so easy to use -- you don't have to recompile anything or = do=20 any other kind of preparation. People *really* like that. Nick -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make your job = easier Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ Valgrind-developers mailing list Val...@li... https://lists.sourceforge.net/lists/listinfo/valgrind-developers |
|
From: Julian S. <js...@ac...> - 2006-08-17 02:13:44
|
> -----Original Message----- > From: val...@li... on behalf of > Nicholas Nethercote Sent: Wed 08/16/06 7:55 PM > To: Karai Csaba > Cc: val...@li... > Subject: Re: [Valgrind-developers] Precompiler for valgrind > > On Wed, 16 Aug 2006, Karai Csaba wrote: > > If you, developers are interested, I would write a new component for > > valgrind, a precompiler. > > > > The precompiler would modify the C/C++ code to detect more memory > > errors in the program. > > > > How it would work? > > > > - one should compile with valgrind-cc instead of gcc > > - valgrind-cc calls the gcc -E for getting a clean code > > without macros and includes > > - after that it modifies the code for further checks > > - compiles the modified code > > It sounds like this would be a totally different tool -- certainly > complementary to Valgrind, but not particularly related. A source code pre-processor would certainly be an interesting tool and maybe a good complement to Valgrind. It sounds like a huge amount of work though, especially for C++. Do you have experience in writing C/C++ compiler front ends? J |
|
From: Karai C. <cs...@fr...> - 2006-08-17 08:50:37
|
> A source code pre-processor would certainly be an interesting tool
> and maybe a good complement to Valgrind. It sounds like a huge
> amount of work though, especially for C++. Do you have experience
> in writing C/C++ compiler front ends?
>
> J
Not yet. It would be really big work, but the users could check it
gradually. It may require 1 year to make it stable alone without help.
I've checked the -fmudflap option of GCC. It does the index bound checking.
it has some drawbacks:
- consumes much memory, so big projects won't work, only little ones
- very very slow, even slower than valgrind.
- false notifications for va_arg, va_start, ...
- no stack trace
The mudflap component of GCC is very new, that's why it has lots of
errors.
The question is whether it worths to write such a new component, or wait
GCC to make a fast, stable and usable component of fmudflap.
I used some time Rational Purify and Purify also does some code
modifications at compile time.
Any other ideas?
Thanks,
Csaba
|
|
From: Nicholas N. <nj...@cs...> - 2006-08-17 11:45:11
|
On Thu, 17 Aug 2006, Karai Csaba wrote: > The mudflap component of GCC is very new, that's why it has lots of > errors. > > The question is whether it worths to write such a new component, or wait GCC > to make a fast, stable and usable component of fmudflap. You could contribute to mudflap. It's not that new, it's been around for a couple of years at least. The fact that they have so much implemented means you would likely be able to make a greater impact in a shorter time than if you started from scratch. Nick |