<div dir="ltr">I tried using valgrind in a different project. The main problems I&#39;ve had with valgrind are speed (which is not a problem here) and false positives.<div>Getting gdb to report that during runtime has its advantages.</div>
<div>Anyhow, I was hoping to hear about products/valgrind add-ons etc I do not know.</div><div><br><div>The main practical problem with it, is convincing management that getting a linux box or VM and build the code on it is worth our while...<br>
<br><div class="gmail_quote">On Tue, Jan 12, 2010 at 12:27 AM, guy keren <span dir="ltr">&lt;<a href="mailto:choo@actcom.co.il">choo@actcom.co.il</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<br>
valgrind will tell you whenever you are using an un-ninitialized variable. it&#39;ll do so using runtime analysis.<br>
<br>
have you tried using valgrind at all?<br>
<br>
--guy<br>
<br>
Elazar Leibovich wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Just a remark, as some people asked me about it privately.<br>
I&#39;m not interested in static analysis (which gcc gives for uninitialized variables). But with runtime analysis of where the uninitialized variable have been actually used when the code was run. This is useful in many situations (for instance, when having 3000 (literally) static warnings, some of similar spirit, and no time to check them all)<br>

I didn&#39;t find anything parallel to that for gcc.<br>
<br></div><div class="im">
On Mon, Jan 11, 2010 at 11:54 PM, Elazar Leibovich &lt;<a href="mailto:elazarl@gmail.com" target="_blank">elazarl@gmail.com</a> &lt;mailto:<a href="mailto:elazarl@gmail.com" target="_blank">elazarl@gmail.com</a>&gt;&gt; wrote:<br>

<br>
    We have a big legacy embedded code we need to maintain. Often, we<br>
    wish to run some functions of the code on the PC with injected<br>
    input, to test them or to test changes we&#39;ve done to them without<br>
    loading the code to the device it should run on.<br>
    The code is written with C.<br>
    Obviously, this is not an easy task, it is more difficult because,<br>
    the code is bug ridden, and many times it works by accident (for<br>
    example, a NULL pointer added a constant and then derefeced, this<br>
    worked because the memory address was legal).<br>
    Since the code is big, our strategy is: compile just the parts you<br>
    need, debug it enough so that it would run on the PC, and keep the<br>
    changes. Hopefully, after enough time, all (or most) of the code<br>
    would be runnable on a PC.<br>
    We use gcc+gdb to compile and debug the code. In Visual Studio&#39;s<br>
    cl.exe there are some security checks<br></div>
    &lt;<a href="http://msdn.microsoft.com/en-us/library/aa289171(VS.71).aspx" target="_blank">http://msdn.microsoft.com/en-us/library/aa289171(VS.71).aspx</a>&gt; at<div class="im"><br>
    run time. This can really assist debugging. For example knowing when<br>
    an unintialized variable was used can save you alot of frustration<br>
    when trying to figure out why you&#39;re getting a wrong numberic results.<br>
    My questions are:<br>
    1) Are there parallel (or better) runtime security checks for<br>
    gcc/gdb? I found the -fstack-protection stack canary switch, but are<br>
    there more of this type?<br>
    2) What other tools are there which offer similar protection?<br>
    Valgrind of course is the first thing that comes to my mind, but<br>
    I&#39;ll be glad to hear any more ideas.<br>
    For example, I would love to be able to get a warning whenever a<br>
    pointer is dereferenced twice, where the first time the pointer<br>
    points at the memory address of variable x, and the second time it<br>
    points to variable y. That way I&#39;ll get a warning for the following bug:<br>
    int x[3] = {1,2,3};int y[3] = {4,5,6};<br>
    int *p = x;<br>
    for (int i=0;i&lt;=3;i++,p++) (*p) = (*p)++; // note the &lt;=<br>
    3) We use win32 for regular development, so if anyone knows what is<br>
    the support for such tests in cygwin/mingw, I&#39;ll be glad to hear<br>
    about it.<br>
<br>
    Thanks<br>
    Elazar Leibovich<br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<div class="im"><br>
<br>
_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il" target="_blank">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
</div></blockquote>
<br>
</blockquote></div><br></div></div></div>