Difference between revisions of "Toolbox"

From eLinux.org
Jump to: navigation, search
(Other debugging tools(not debuggers))
(Debuggers: add lots of memory debugger links)
Line 15: Line 15:
 
* [[kgdb| kgdb - kernel source level debugger]]
 
* [[kgdb| kgdb - kernel source level debugger]]
 
* [[Valgrind|valgrind - memory, cache and other debuggers and profilers]]
 
* [[Valgrind|valgrind - memory, cache and other debuggers and profilers]]
* [[Electric Fence| efence - Memory Debugger]]
+
 
 +
== Memory Debuggers ==
 +
Several tools exist for finding memory leaks or for reporting individual memory allocations
 +
of a program.
 +
 
 +
* [http://www.linuxjournal.com/article/6059 Memory Leak Detection in Embedded Systems] by Cal Erickson, Linux Journal, September 2002
 +
** This mentions mentions mtrace, memwatch and dmalloc
 +
 
 +
=== Electric Fence ===
 +
See [[Electric Fence]]
 +
 
 +
=== mtrace ===
 +
mtrace is a builtin part of glibc which allows detection of memory leaks caused by unbalanced malloc/free calls.  To use it, the program is modified to call mtrace() and muntrace() to start and stop tracing of allocations.  A log file is created, which can then be scanned by the 'mtrace' Perl script.  The 'mtrace' program lists only unbalanced allocations.  If source is available it can
 +
show the source line where the problem occurred. mtrace can be used on both C and C++ programs.
 +
 
 +
=== memwatch ===
 +
memwatch is a program that not only detects malloc and free errors but also reads and writes beyond the allocated space (buffer over and under-runs).  To use it, you modify the source to include
 +
the memwatch code, which provides replacements for malloc and free.
 +
 
 +
Some things that memwatch does not catch are writing to an address that has been freed and reading data from outside the allocated memory.
 +
 
 +
=== mpatrol ===
 +
mpatrol appears to be like memwatch.
 +
 
 +
See http://mpatrol.sourceforge.net/
 +
 
 +
=== dmalloc ===
 +
"The debug memory allocation or dmalloc library has been designed as a drop in replacement for the system's malloc, realloc, calloc, free and other memory management routines while providing powerful debugging facilities configurable at runtime. These facilities include such things as memory-leak tracking, fence-post write detection, file/line number reporting, and general logging of statistics."
 +
 
 +
This library can be used without modifying the existing program, and uses environment variables
 +
to control it's operation and set of issues to log.
 +
 
 +
It's home page is at: http://dmalloc.com/
 +
 
 +
See Cal Erickson's article (link above, page 2) for information about using this system.
 +
 
 +
=== dbgmem ===
 +
dbgmem looks like another dynamic library replacement tool, similar to dmalloc (but possibly having less features)
 +
 
 +
See http://dbgmem.sourceforge.net/
 +
 
 +
=== valgrind ===
 +
valgrind does dynamic source code modification to instrument the program, and provides a number
 +
of memory problem detection tools and profiling tools.  Unfortunately, as of July 2010 it only available for x86 (and ppc64, but that doesn't count.)
 +
 
 +
See http://valgrind.org/
 +
 
 
== Other debugging tools(not debuggers) ==
 
== Other debugging tools(not debuggers) ==
 
* [[Strace]]
 
* [[Strace]]

Revision as of 16:09, 15 July 2010

This page has information about developing Embedded Linux, including links to toolchains, debuggers and other development tools. Also, it has links to pages with debugging tips.

Development Tools

Logic Analyzers

Toolchains

Debuggers

Debugging is one of the most common activities of an embedded developper. Here are some debuggers howto and links:

Memory Debuggers

Several tools exist for finding memory leaks or for reporting individual memory allocations of a program.

Electric Fence

See Electric Fence

mtrace

mtrace is a builtin part of glibc which allows detection of memory leaks caused by unbalanced malloc/free calls. To use it, the program is modified to call mtrace() and muntrace() to start and stop tracing of allocations. A log file is created, which can then be scanned by the 'mtrace' Perl script. The 'mtrace' program lists only unbalanced allocations. If source is available it can show the source line where the problem occurred. mtrace can be used on both C and C++ programs.

memwatch

memwatch is a program that not only detects malloc and free errors but also reads and writes beyond the allocated space (buffer over and under-runs). To use it, you modify the source to include the memwatch code, which provides replacements for malloc and free.

Some things that memwatch does not catch are writing to an address that has been freed and reading data from outside the allocated memory.

mpatrol

mpatrol appears to be like memwatch.

See http://mpatrol.sourceforge.net/

dmalloc

"The debug memory allocation or dmalloc library has been designed as a drop in replacement for the system's malloc, realloc, calloc, free and other memory management routines while providing powerful debugging facilities configurable at runtime. These facilities include such things as memory-leak tracking, fence-post write detection, file/line number reporting, and general logging of statistics."

This library can be used without modifying the existing program, and uses environment variables to control it's operation and set of issues to log.

It's home page is at: http://dmalloc.com/

See Cal Erickson's article (link above, page 2) for information about using this system.

dbgmem

dbgmem looks like another dynamic library replacement tool, similar to dmalloc (but possibly having less features)

See http://dbgmem.sourceforge.net/

valgrind

valgrind does dynamic source code modification to instrument the program, and provides a number of memory problem detection tools and profiling tools. Unfortunately, as of July 2010 it only available for x86 (and ppc64, but that doesn't count.)

See http://valgrind.org/

Other debugging tools(not debuggers)

Integrated Development Environments

  • Eclipse - Powerfull IDE written in JAVA.
  • jEdit - Editor written in JAVA which can be expanded to a full IDE with plug-ins.
  • KDevelop - Standard IDE for KDE.
  • Emacs - Powerful IDE, extensible in LISP, ships with modes to integrates with SCM (GIT, SVN, CVS...), build systems, debugger and even fancy multi-window with ECB.
  • VIm - Powerful IDE, extensible with scripting, can use various modules for completion and more.
  • KScope - Cscope based source editing environment with KDE.
  • Anjuta - IDE with nice plugin support
  • FIXTHIS - need more links for IDEs

Emulators

Tracers and Profilers

Benchmarks

Source Management Tools

There are a number of tools for managing patches, which are useful for different tasks. There's now a whole page devoted to this. See Source Management Tools

For some simple tools for managing patches, see Diff And Patch Tricks

Test Systems

Developer Resources

mailing lists, web sites, etc.

Articles on kernel subsystems

  • The TTY Demystified - excellent explanation of kernel tty system
  • Device Trees - a structure used to describe system hardware at startup - can be passed or modified by firmware, or built into kernel

Documentation

Kernel

Online

Books

See also Category:Books

Reference Material

  • ARM Processor Reference Manuals - Registration required, but it's free.
    • go to http://infocenter.arm.com/ => ARM architecture => Reference Manuals => ... => registration link (only name, e-mail address and company name are strictly required).
  • The UHAPI Forum standardizes hardware-independent application programming interfaces (APIs) for analog and digital televisions, set top boxes, DVD players and recorders, personal video recorders (PVRs), home servers and other consumer audio/video (A/V) devices.

Podcasts

  • [1] - The (Original) Linux Link Tech Show, weekly Linux podcast with archive going back to 2003.
  • [2] - Timesys LinuxLink Radio. (Despite the name, it's has nothing to do with the older Linux Link podcast, and it's not on the radio. No longer updates on a regular schedule, but the archives are available.)

Code Style Tips

Debugging Tips

  • See the Kernel Debugging Tips page
  • See also Debugging Makefiles
  • Printk
  • Debug user-space initialization:
    • If you get a panic - "not syncing: Attempted to kill init!" it can be for many different reasons. Try setting CONFIG_DEBUG_USER=y in your .config and pass 'user_debug=255' in the kernel command line. That will give you a more verbose output about why user space programs crash. Thanks to Daniel Mack on the linux-arm-kernel mailing list for this tip.

GCC Tips and Tricks

  • This section of GCC Tips is a collection of tips and tricks helpful for embedded developers

Network Setup

Embedded Linux Distributions

Wishlist Items