This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Valgrind - A Heads Up.


Having used valgrind for i386-linux, I can attest to its usefulness.

Is there a write-up or any docs on using it with ECOS?   I assume it can be
used to debug ECOS itself?

How would you get the summary report? ctrl-c in debugger?  Or do you need to
force an exit in your code?

            __  __      ___   ________  ___      __  ___      ___
Dirk Broer / ||/ ||    /_ || /__  __// /__ \\   /// /__ \\   / __\\
          //||//|||   ///|||   ///    ///_///  __  /// |||  ///_
         ///| //|||  /___ ||  ///    /__  //  /// ///      /__ ||
        /// |// ||| ///  ||| ///    /// |||  /// ///__/// ____///
       ///      |||///   |||///    ///  ||| ///  |____// /____//

#include <standard_disclaimer>
#include <funny_quote>

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of John Carter
Sent: Monday, January 05, 2004 3:22 PM
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] Valgrind - A Heads Up.

Just a heads up on developments over at the Valgrind end of the
world...

You may be aware of Valgrind, an excellent debugging tool for
i386 Linux.
  http://valgrind.kde.org/

(Disclaimer: I have nothing to do with eCos, or Valgrind accept as a
user of both.)

Be patient, you will soon see the application to eCos and then go
"Oooh! That is very very interesting!"

Here I quote the docs....

   Valgrind is a flexible tool for debugging and profiling Linux-x86
   executables. The tool consists of a core, which provides a
   synthetic x86 CPU in software, and a series of "skins", each of
   which is a debugging or profiling tool. The architecture is
   modular, so that new skins can be created easily and without
   disturbing the existing structure.

   The memcheck skin detects memory-management problems in your
   programs. All reads and writes of memory are checked, and calls to
   malloc/new/free/delete are intercepted. As a result, memcheck can
   detect the following problems:

    * Use of uninitialised memory
    * Reading/writing memory after it has been free'd
    * Reading/writing off the end of malloc'd blocks
    * Reading/writing inappropriate areas on the stack
    * Memory leaks -- where pointers to malloc'd blocks are lost forever
    * Mismatched use of malloc/new/new [] vs free/delete/delete []
    * Overlapping src and dst pointers in memcpy() and related functions
    * Some misuses of the POSIX pthreads API

   cachegrind is a cache profiler. It performs detailed simulation of
   the I1, D1 and L2 caches in your CPU and so can accurately pinpoint
   the sources of cache misses in your code. If you desire, it will
   show the number of cache misses, memory references and instructions
   accruing to each line of source code, with per-function, per-module
   and whole-program summaries. If you ask really nicely it will even
   show counts for each individual x86 instruction.

   helgrind is a new debugging skin, designed to find data races in
   multithreaded programs. What helgrind looks for is memory locations
   which are accessed by more than one (POSIX p-)thread, but for which
   no consistently used (pthread_mutex_)lock can be found. Such
   locations are indicative of missing synchronisation between
   threads, and could cause hard-to-find timing-dependent problems.

Now the latest improvement (currently only in the latest version in
CVS not in any released version) is Full Virtualization. This means
that it doesn't even need to get in via the dynamically link library
back door. It can run on eCos Linux synthetic target statically linked
binaries.

At this stage you should be saying, "Oooh, that is very
interesting". This means no matter what weird thing your target CPU
is, you can test your code under Valgrind by compiling it for the
synthetic target.

However, I believe additional work needs to be done to get eCos to
gain the full benefit from Valgrind.

For example:
 * Valgrind needs to understand eCos memory pools.
 * Valgrind needs to understand eCos threading scheduler.

So this is just a little pointer to anyone that may find this useful.

John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand

A Million Monkeys can inflict worse things than just Shakespeare on
your system.

--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss




-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]