...
In general, we recommend running
Conditional Content |
---|
| product: (cpptest) |
---|
| product: (cpptest) |
---|
sv-attr:0A01020401598D973E6641760F8AF4E5 | 0A01020401598D973E6749C5267CE6FE |
---|
|
C/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.
...
Enable swapping of analysis data to disk:
Conditional Content |
---|
| product: (cpptest, jtest) |
---|
| product: (cpptest, jtest) |
---|
sv-attr:0A01020401598D973E6641760F8AF4E5 | 0A01020401598D973E6749C5267CE6FE 0A01020401598D973E671AAA268425A3 |
---|
|
Enabled |
by default. If this option is disabled, it may result in faster analysis, if you are running Flow Analysis analysis on small to moderate size projects that do not require a lot of memory or when plenty of memory is available (for example, for 64-bit systems).
...
- Do not report violations when cause cannot be shown: Determines whether Flow Analysis reports violations where causes cannot be shown.
Some Flow Analysis rules require that Flow Analysis 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, Flow Analysis 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 Flow Analysis 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. - Do not show 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.
Conditional Content |
---|
| product: (cpptest) |
---|
| product: (cpptest) |
---|
sv-attr:0A01020401598D973E6641760F8AF4E5 | 0A01020401598D973E6749C5267CE6FE |
---|
|
Specifying Terminating FunctionsYou can define functions that terminate application execution. C/C++ developers sometimes use functions that terminate application execution in the event of a fatal error from which recovery is impossible. Examples of such functions are abort() and exit() from the standard library. Since Flow Analysis analyzes the application’s execution flow, it's important for it to be aware of the terminating functions that break execution flow by immediately stopping the application. Without such knowledge, Flow Analysis might make incorrect assumptions about the application flow. Flow Analysis is aware of the terminating functions that are defined in the standard library. However, this is often not sufficient because non-standard libraries define their own terminating functions. If your application uses one of these functions, you should communicate that to Flow Analysis by specifying the custom terminating function in the Terminators tab. Otherwise, Flow Analysis may produce false positives with execution paths passing by terminating functions. Use the table listing supported APIs to enable/disable terminators from various APIs as well as to define your own APIs containing terminating functions. To add information about terminating functions from a certain library: - Click the + button in the top row of the table.
- Click the arrow to expand the Functions that terminate application execution tab.
- Complete the table that opens; the table has the following columns:
• Enabled: Specifies whether a built-in or custom terminator should be considered during the analysis. • Fully qualified type name or namespace (wildcard): Specifies the entity for a particular terminator. If this field is left empty, only the global function with the name specified in the 'Function name' column will be considered a terminator. For example: The field value may be "myNameSpace::myClass" if the terminator is declared in 'myClass' coming from the 'myNameSpace' namespace. Or, it may be "myNameSpace" if it is not declared in a type, but belongs only to the 'myNameSpace'. • Function name (wildcard): Specifies the name of the terminating function. • + definitions in subclasses: Indicates whether the terminating function definitions in subclasses should be considered terminating functions as well. Thisappliestobothinstanceandnon-instancefunctions, and makes sense only if its fully qualified type name is specified.
Specifying Multithreading OptionsThe Multithreading tab allows you to define functions for synchronization between threads as well as to activate/deactivate known multithreading functions. The information defined here affects the behavior of rules from the BD.TRS (Threads and Synchronization) category. These rules will check all the functions that are defined and activated on this tab. Use the table that lists supported APIs to enable/disable synchronization functions from various APIs as well as to define your own APIs containing synchronization functions. To add information about synchronization functions from a certain library: - Click the + button in the top row of the table.
- Type the name of the library in the API field.
- Click the arrow to expand the tabs and complete the tables to define the following types of functions (details about completing the tables are provided below):
• Functions for locking (for instance, obtaining a mutex) • Functions for unlocking (for instance, releasing a mutex) • Sleep functions • Destroy lock functions Image Modified
Functions for lockingComplete the table with the following information: - Enabled: specifies whether the locking function should be considered during analysis.
- Fully-qualified type name or namespace (wildcard): the fully-qualified name of the type or namespace where the function is declared. Use '*' if you want to describe a function declared in any type or namespace, or a global function declared outside of any type.
- Function name (wildcard): the name of the locking function. '*' can be used to denote any number of any symbols.
- + definitions in subclasses:a check box that indicates whether the definitions (of the function with the given name) in subclasses should be considered locking functions as well. Note that this applies to both instance and static functions.
- "this" object is a mutex:a check box that indicates that the function locks a mutex in the object on which the function is called.
- Returns a mutex:a check box that indicates that the function returns a mutex.
- Return value constraint on error: specifies a return value constraint in case of allocation failure if a resource allocator returns an integral value. Enter the condition in the following format: <comparison operator><integer value>. For example, if the function returns a non-zero value on failure, enter "!=0" (without quotes) into the field. If return code on error is -1, type "==-1" there. In addition to "!=" and "==", you can use the following operators for specifying error conditions: ">", ">=", "<", and "<=".
- Mutex parameter: specifies that the function locks a mutex in one of its parameters.
Functions for unlockingComplete the table with the following information: - Enabled: specifies whether the unlocking function should be considered during analysis.
- Fully-qualified type name or namespace (wildcard): the fully-qualified name of the type or namespace where the function is declared. Use '*' if you want to describe a function declared in any type or namespace, or a global function declared outside of any type.
- Function name (wildcard): the name of the unlocking function. '*' can be used to denote any number of any symbols.
- + definitions in subclasses: a checkbox that indicates whether the definitions (of the function with the given name) in subclasses should be considered unlocking functions as well. Note that this applies to both instance and static functions.
- "this" object is a mutex: a check box that indicates that a mutex in the object on which the function is called is unlocked
- Mutex parameter: specifies that a mutex in one of the parameters is unlocked.
Sleep functionsComplete the table with the following information: - Enabled: specifies whether the sleep function should be considered during analysis.
- Fully-qualified type name or namespace (wildcard): the fully-qualified name of the type or namespace where the function is declared. Use '*' if you want to describe a function declared in any type or namespace, or a global function declared outside of any type.
- Function name (wildcard): the name of the sleep function. '*' can be used to denote any num-ber of any symbols.
- + definitions in subclasses: a check box that indicates whether the definitions (of the function with the given name) in subclasses should be considered sleep functions as well. Note that this applies to both instance and static functions.
Destroy lock functionsComplete the table with the following information: - Enabled: specifies whether the lock-destroying function should be considered during analysis.
- Fully-qualified type name or namespace (wildcard): the fully-qualified name of the type or namespace where the function is declared. Use '*' if you want to describe a function declared in any type or namespace, or a global function declared outside of any type.
- Function name (wildcard): the name of the lock-destroying function. '*' can be used to denote any number of any symbols.
- + definitions in subclasses: a check box that indicates whether the definitions (of the function with the given name) in subclasses should be considered lock-destroying functions as well. Note that this applies to both instance and static functions.
- "this" object is a mutex: a check box that indicates that a mutex in the object on which the function is called is destroyed.
- Mutex parameter: specifies that a mutex in one of the parameters is destroyed.
|
Specifying Resources
The Resources tab allows you to define which resources the BD.RES category (Resources) rules should check. These rules check for the correct usage of all resources that are defined and enabled on this tab.
- Specify the Type of resource.
- Select the Enabled checkbox.
- If appropriate/desired, disable the Do not report leaks at termination option.
Click the arrow to expand the Resource Allocators and Resource Closers tabs and complete the tables that open with the information about allocators and closers. Details about completing these tabs are provided below.
Conditional Content |
---|
| product: (cpptest) |
---|
| product: (cpptest) |
---|
sv-attr:0A01020401598D973E6641760F8AF4E5 | 0A01020401598D973E6749C5267CE6FE |
---|
|
Image Modified
|
Configuring Resource Allocators
...
Conditional Content |
---|
| product: (cpptest) |
---|
| product: (cpptest) |
---|
sv-attr:0A01020401598D973E6641760F8AF4E5 | 0A01020401598D973E6749C5267CE6FE |
---|
|
The Resource closers table can be completed with the descriptors of functions that can close a resource. The table has the following columns: - Enabled: specifies whether the closer should be considered during analysis.
- Fully-qualified type name or namespace (wildcard): the fully-qualified name of the type or namespace where the function is declared. Use '*' if you want to describe a function declared in any type or namespace, or a global function declared outside of any type.
- Function name (wildcard): the name of the closing function. '*' can be used to denote any number of any symbols.
- + definitions in subclasses: a check box that indicates whether the definitions (of functions with the given name) in subclasses should be considered closers as well. Note that this applies to both instance and static functions.
- "this" object is a resource: a check box that indicates that a resource in the object on which the function is called is closed.
- Resource parameters: specifies that a resource in one or more of its parameters is closed. In this case, either specify a 1-based number of the parameter that is closed by the function, or use '*' to denote that all of the parameters are allocated.
|
Conditional Content |
---|
| product: (cpptest) |
---|
| product: (cpptest) |
---|
sv-attr:0A01020401598D973E6641760F8AF4E5 | 0A01020401598D973E6749C5267CE6FE |
---|
|
Extending Scope of AnalysisWhen performing code analysis, Flow Analysis processes definitions of functions that are defined in source and header files under test. Functions that are defined in header files outside the testing scope are not analyzed, and Flow Analysis is not aware of their semantics. If Flow Analysis requires information about function definitions that are defined in header files outside the testing scope, you can configure the following options: External files to analyze: Specifies absolute paths to additional header files to be analyzed by Flow Analysis. Use wildcards to specify the pattern. External functions to analyze: Specifies additional functions to be analyzed by Flow Analysis. Complete the table with the following information: - Enabled: specifies whether the function should be considered during analysis
- Fully-qualified type name or namespace (wildcard): the fully-qualified name of the type or namespace where the function is declared. Use '*' if you want to describe a function declared in any type or namespace, or a global function declared outside of any type.
- Function name (wildcard): the name of the function. '*' can be used to denote any number of any symbols.
- Number of parameters: specifies the number of function's parameters. '-1' can be used to denote any number of parameters.
- + definitions in subclasses: a checkbox that indicates whether the definitions (of functions with the given name) in subclasses should be included as well. Note that this applies to both instance and static functions.
Compiler-specific SettingsInternal representation of the "errno" value: The Standarddefineserno to be a modifiable lvalue of type int. It is unspecified whether errno is a macro or an identifier declared with an external linkage. Implementations may use the global variable "errno" or "__errno", or apply the "(*errno_function())" pattern with different names of the called functions. This option allows you to specify the names of these variables and functions with regular expressions: - Function name pattern: The name of the function that is called when the "errno" value is used. The name must be specified with regular expressions.
- Variable name pattern: The name of the variable that is called when the "errno" value is used. The name must be specified with regular expressions.
Internal representation of the call to a function from the header <ctype.h>: The Standard specifies several functions to be defined in the header <ctype.h>. Some implementations (e.g GNU GCC in the C mode) define these functions as macros that expand to the code which tests an element of the internal array against some flags. This can be either a global array or a pointer returned by a function. This option allows you to specify names of these variables and functions with regular expressions: - Function name pattern: The name of the function that is invoked internally instead of one of the functions from the header <ctype.h> (define with regular expressions). The name must be specified with regular expressions.
- Variable name pattern: The name of the variable that is used internally after a call to one of the functions from the header <ctype.h>. The name must be specified with regular expressions.
Reusing Flow Analysis Data for Desktop AnalysisOne way to improve desktop performance with Flow Analysis is to reuse the server analysis data on the desktop. To do this, you need to define a mapping that allows Flow Analysis engine to match server file paths with corresponding desktop file paths. Additionally, you can reuse data to run the analysis on a small scope (for example, one file) and build paths that include methods defined in files outside the defined scope of analysis, provided that these files have been analyzed. Please, contact Parasoft Support for more information on how to use this functionality. |