Re: [CODE] Debbuging Stock Bp21 with VALGRIND ?

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 07/27/02


On Fri, 26 Jul 2002, Daniel A. Koepke wrote:

> If I had to guess, I'd say your strlen() implemention is written in
> inline assembly and being inlined by the compiler.  The debugger isn't
> smart enough to notice the side-effects of the inline assembly, so it
> doesn't see the initialization.

As a follow-up, this does indeed appear to be the case, as mentioned
briefly at http://developer.kde.org/~sewardj/ :

  There are some limitations, the most significant of which are:

    [...]

    * String functions (strlen, at least) which are inlined by gcc-3.1 and
      above at high optimisation levels cause considerable numbers of
      false positives. This problem is under consideration. Current advice
      is to either use an earlier gcc or use gcc >= 3.1 but at a reduced
      optimisation setting.

    [...]

You might consider editing your Makefile to remove the -O2 flag from
CFLAGS while you are debugging with Valgrind.

In this case, I wouldn't suggest editing Makefile.in because you'll
probably want to bring back -O2 after debugging and won't want it to
disappear every time you update your Makefile with config.status.  (You
*do* edit Makefile.in and then run config.status to regenerate Makefile
instead of just directly editing Makefile with changes you desire to keep,
don't you?  You should.)


-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT