Channels ▼
RSS

Tools

AdaCore Launches CodePeer Source Code Analysis Tool


AdaCore has released CodePeer, a source code analysis tool that detects run-time and logic errors in Ada programs. Serving as a code reviewer, CodePeer identifies constructs that are likely to lead to run-time errors such as buffer overflows, and it flags legal but suspect code typical of logic errors. CodePeer also produces a detailed analysis of each subprogram, including pre- and postconditions. Such an analysis makes it easier to find potential bugs and vulnerabilities early: If the implicit specification deduced by CodePeer does not match the component's requirements, a reviewer is alerted immediately to a likely logic error. CodePeer can be used both during system development -- to prevent errors from being introduced or as part of a systematic code review process to dramatically increase the efficiency of human review -- and retrospectively on existing code, to detect and remove latent bugs.

Developed by AdaCore in partnership with SofCheck, CodePeer can be used either as a standalone tool or fully integrated into the GNAT Pro Ada development environment. It is highly flexible, with performance that can be tuned based on the memory and speed available on the developer's machine, and can efficiently exploit multicore CPUs. CodePeer can be run on partially complete programs; it does not require stubs or drivers.

CodePeer analyzes programs for a wide range of flaws including use of uninitialized data, pointer misuse, buffer overflow, numeric overflow, division by zero, dead code, and concurrency faults (race conditions). These sorts of errors can be difficult and expensive to detect and correct with conventional debugging, but CodePeer identifies them statically, without running the program, and determines not only where the failure could occur, but identifies where the bad values originate, be it within the current subprogram or from some distant subprogram that reached the point of failure through a series of calls. CodePeer also looks for code that, although syntactically and semantically correct, is performing a suspect computation, such as an assignment to a variable that is never subsequently referenced, or a conditional test that always evaluates to the same true or false value.

"Even the best programmers using the best programming languages will sometimes make mistakes," says AdaCore's Robert Dewar. "The key is to detect and correct errors early, and, thanks to our partnership with SofCheck, CodePeer is now available for precisely that purpose. We expect this tool to be especially valuable to our customers with safety-critical or high-security requirements, since CodePeer can identify potential hazards and vulnerabilities."

Internally CodePeer uses static control-flow, data-flow, and value propagation techniques to identify possible errors. It mathematically analyzes every line of code without executing the program, considering all combinations of program input across all paths within the program. It automatically generates both human-readable and machine-readable component specifications in the form of preconditions, postconditions, inputs, outputs, and heap allocations, which along with the error messages can be displayed graphically or as in-line comments in the source code listing to help immediately pinpoint the root cause of any defect. In a multi-threaded system CodePeer identifies where race conditions might occur. To increase performance and usability it internally maintains a historical error database, which allows it to highlight just the new coding problems and to track trends across multiple analyses.

"The technology underlying CodePeer was developed over many years of work on highly optimizing compilers," added SofCheck's Tucker Taft, "but now we are taking all the information the compiler was using internally for its own optimization purposes, augmenting it with advanced whole-program analyses, and presenting it in a way that allows the programmer to fix their software before it breaks."


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video