Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space CPPTDESKDEV and version 10.3.4

...

Anchor
Bug_detective
Bug_detective

...

Flow

...

Analysis

Note
titleImportant Note

An additional license is required to use this functionality. Contact your Parasoft representative.

BugDetective Flow is a new type of static analysis technology that uses several analysis techniques, including simulation of application execution paths, to identify paths that could trigger runtime defects. Defects detected include use of uninitialized memory, null pointer dereferencing, division by zero, memory and resource leaks.

Since this analysis involves identifying and tracing complex paths, it exposes bugs that typically evade static code analysis and unit testing, and would be difficult to find through manual testing or inspection. BugDetective’s Flow Analysis’ ability to expose bugs without executing code is especially valuable for users with legacy code bases and embedded code  (where runtime detection of such errors is not effective or possible).

BugDetective's This unique breed of static analysis starts analyzing the source code under test by searching for "suspicious points" in the code. A suspicious point is a point where there is potential for a bug. These suspicious points are defined in BugDetective Flow Analysis rules. Whenever a suspicious point is identified, BugDetective Flow Analysis investigates possible execution paths which lead to that point and checks if any of those paths actually violates the BugDetective ruleFlow Analysis rule. If such a path is found, a violation is reported. 

...

To make the analysis process more flexible and tailored to your unique project needs, some rules can be parameterized. As a result, BugDetective can Flow Analysis can even be used to detect violations bound to usage of very specific APIs.

Using BugDetectiveFlow Analysis, development teams gain the following key benefits:

  • Perform more comprehensive testing with existing resources: BugDetective, Flow Analysis complements other testing techniques by allowing you to find problems that would otherwise require the development, execution, and maintenance of complex test cases. BugDetective investigates  Flow Analysis investigates various branching possibilities in a program, providing a level of path coverage that is difficult to accomplish with traditional testing. As a result, BugDetective often Flow Analysis often identifies problems that occur while handling rare situations that are typically not covered during testing. Moreover, if the code functionality changes, you can search for bugs in the modified version without updating or regenerating test cases.
  • Automatically identify bugs that pass through multiple units: Traditional automated unit test generation helps you identify the bugs within a single compilation unit. This is critical. Yet, most developers have performed thorough unit-level testing, corrected all apparent problems, integrated the code, then later encountered problems, such as null pointer dereferencing, that took days to diagnose because they resulted from an obscure or complex execution path that passed through multiple functions or even multiple compilation units Using BugDetectiveFlow Analysis, the same problem could be identified automatically 
  • Focus on actual bugs and design flaws: BugDetective automatically Flow Analysis automatically identifies data-dependent or flow-dependent bugs with reasonable certainty. When BugDetective reports Flow Analysis reports a violation, it is often the case that there was a design flaw and this manifested itself as simple violation such as a division by zero or a resource leak.

    For example, BugDetective would Flow Analysis would not report a violation for the following code unless there was a method calling calculateBufferLength and passing it a null pointer:

    Code Block
    int calculateBufferLength(char* str)
    {
                return strlen(str) + 1;
    }
  • Find API misuses: Many of the bugs in practice are due to calling some API with wrong  arguments or not properly handling the values returned by the API. For example, an API  may be expecting a non-null argument for parameter 2, when parameter 1 is true, or the API may potentially set some field in an object to null. By performing interprocedural analysis, BugDetective can Flow Analysis can point out inconsistencies in the usage of such API.

For  details details on using BugDetective, see Using BugDetective Static Flow Analysis.

Unit Testing

"Unit testing" refers to testing software code at the simplest functional point, which is typically a single class or a function. Unit testing is typically performed by developers inside a development cycle, rather than in the QA phase. Using unit testing, you can ensure that the application building blocks are solid before they are integrated, thus improving the quality of the entire application. When you test early, it is typically less difficult and time-consuming to identify and fix defects at this point.

...