Static analysis
Static analysis is a powerful companion to debugging. Linaro DDT helps you discover errors by code and state inspection along with automatic error detection components such as memory debugging. Static analysis inspects the source code and attempts to identify errors that can be detected from the source alone, independently of the compiler and actual process state.
Linaro DDT includes the static analysis tools cppcheck
and ftnchek
.
These will by default automatically examine source files as they are
loaded and display a warning symbol if errors are detected. Typical
errors include:
Buffer overflows. Accessing beyond the bounds of heap or stack arrays.
Memory leaks. Allocating memory within a function and there being a path through the function which does not deallocate the memory and the pointer is not assigned to any externally visible variable, nor returned.
Unused variables, and also use of variables without initialization in some cases.

Static analysis is not guaranteed to detect all, or any, errors. An absence of warnings does not mean there are no bugs.