...
- Identify or create a Test Configuration with your preferred BugDetective standard analysis settings.
- For a description of preconfigured Test Configurations, see Built-in Test Configurations.
- For general procedures related to configuring and sharing Test Configurations, see the Configuring Test Configurations and Rules for Policies. For details on C++test-specific BugDetective options, see Static Tab Settings: Defining How Static Analysis is Performed.
- Start the test using the preferred Test Configuration.
- For details on testing from the GUI, see Testing from the GUI.
- For details on testing from the command line, see Testing from the Command Line Interface.
- Review and respond to the results.
- For details, see Reviewing BugDetective Static Analysis Results.
- (Optional) Fine-tune BugDetective settings as needed.
- For details, see Customizing BugDetective Static Analysis.
...
Swapping of analysis data mode is enabled by default. In this mode, analysis data is written to disk. Swapping of analysis data uses the same persistent storage and is done in a similar process as incremental analysis. If analysis is run on a large project, the analysis data that represents a semantical model of the analyzed source code may consume all the memory available for running BugDetective. If this occurs, BugDetective will remove from memory parts of the analysis data that are not currently necessary and reread it from disk later.
In general, we recommend running C++test in a large JVM heap configured with the Xmx JVM option. This is to minimize swapping, which results in greater performance.
If sufficient memory is available, swapping of analysis data may be disabled, which may speed up code analysis. For information on how to disable swapping of analysis data please refer to Enable swapping of analysis data to disk bullet in the Performance Tab Options topic.
...
For tests run from the command line interface, rule violations are reported in the Static Analysis section of the report. If results were sent to Team Server, results can be imported into the GUI as described in thein Importing Results into the UI. They will then be available in the Fix Static Analysis Violations category of the Quality Tasks view.
...
To highlight the source code referenced by a BugDetective violation message, simply double-click that message. An editor will open with the source code corresponding to the violation selected and the flow path highlighted in light blue. Any line at which an exception is thrown is marked with pink. All the lines which are important for the violation (violation cause, violation point, critical data flow) are highlighted in a dark color.
If you want to navigate through the code related to a reported execution path, use the Next Violation Element and Previous Violation Element buttons in the Quality Tasks view toolbar.
...
- Do not report violations when cause cannot be shown: Determines whether BugDetective reports violations where causes cannot be shown.
Some BugDetective rules require that BugDetective checks all the possible paths leading to a certain point and verifies that a certain condition is met for all those paths. In such cases, a violation is associated with a set of paths (whereas in simple cases, a violation is represented by only one path). All of the paths in such a violation end with the violation point common to all the paths in the violation. However, different paths may start at different points in code. The beginning of each path is a violation cause (a point in code which stipulates a violation of a certain condition later in the code at the violation point). If a multipath violation's different paths have different causes, BugDetective will show only the violation point (and not the violation causes).Violations containing only the violation point may be difficult to understand (compared to regular cases where BugDetective shows complete paths starting from violation causes and leading to violation points). That’s why we provide an option to hide violations where the cause cannot be shown.
See the example below for additional details.
- Do not report more than one violation per point: Restricts reporting to one violation (for a single rule) per violation point. For example, one violation will be reported when Flow Analysis detects a potential null dereference with multiple sources of the null value. When verbosity is set to this level, Flow Analysis performance is somewhat faster.
- Do not report violations whose paths pass via inline assembly code: Prevents the reporting of violations whose paths pass via inline assembly code instructions.
...
- Report all similar violations: Reports all identified BugDetective violations.
- Do not show more than one violation with the same cause and violation point: Prevents the reporting of duplicate BugDetective violations. Duplicate violations are those that share the same violation cause and the same violation point (even though their flow paths may be different).
- Do not show more than one violation per suspicious point: Restricts reporting to one violation (for a single rule) per suspicious point. When verbosity is set to this level, BugDetective performance is somewhat faster.
Example - Impact of "Do not report violations when cause cannot be shown"
The
Example - Impact of "Do not report violations when cause cannot be shown"
The following sample code causes a multi-cause violation of the BD.PB-SWITCH rule to be reported only when Do not report violations when cause cannot be shown is enabled:
...
- In the Resource tab, click Add and define the name of the new resource. This name will be used to report violations associated with this resource.
- Disable the Do not report violations at application termination option.
- Click Edit to specify how this resource is manipulated.
- Define
openMyResource
as an allocator as follows:- Fully qualified type name or namespace: empty
- + definitions in subclasses: unchecked
- '"this" object is a resource: unchecked
- Returns a resource object: unchecked
- Return value constraint on error: ==-1
- Numbers of the parameters representing resources: 1
- Specify the deallocator as follows:
- Fully qualified type name or namespace: empty
- Method name: closeMyResource
- + definitions in subclasses: unchecked
- "this" object is a resource: unchecked
- Numbers of the parameters representing resources: 1
onfiguring Test Configurations and Rules for Pol