Applying Suppression Files from the Command Line
After creating or converting suppression files, you can apply suppression files during analysis, finalization (symbol re-resolution) or when generating a report. There are several ways to pass suppression files to the
Intel Inspector
inspxe-cl
command tool, including passing them in through an option file, which can be useful when you have many suppression files.
Ideally, a suppression file should be created for a specific analysis type, as described in
Creating Suppression Files.
To make it easy to switch between the GUI
and the command line, store suppression files in the
Microsoft Visual Studio* IDE
standard suppressions directory:
C:\myProject\My Inspector
Results-[project name]\suppressions
.
Suppression files can be used along with other problem-suppression
tactics, such as assigning a problem the
Not a Problem
state, then filtering out all
problems with this state when viewing problems in the GUI or generating a
report on the command line. You can also propagate this state assignment
forward into other results using one of the following techniques:
- To merge problem state assignments from one existing result to another, use themerge-statesoption. State assignments from the merge-from result are used to update state assignments in the merge-to result. Problem states in the merge-to result are edited according to a set of rules.
- To propagate problem state assignments forward when performing analysis, finalization or generating a report, use thebaseline-resultoption.
Specifying Suppression Files
Depending on the number of suppression files you want to apply and their locations, you may want to specify a single suppression file, multiple individual suppression files, or the suppressions directory, as shown in these examples. The example commands all perform analysis using the
ti2
Detect Deadlocks and Data Races
analysis type, and the project is named myTi2Analysis.
Single Suppression File
If you want to use a single suppression file only, for example, you may have created a suppress-all file on the command line, you can specify just this one file. In this command, a suppress-all file
myTi2SuppressAllFile
.sup
is specified when running an analysis.
$ inspxe-cl -collect ti2 -s-f
"C:\myTi2Analysis\My Inspector Results-myTi2Analysis\suppressions\myTi2SuppressAllFile.sup"
Example: Multiple Individual Suppression Files, Possibly with Different Paths
You may want to specify multiple individual suppression files if you have suppression files stored in multiple directories, or if you only want to apply some of the suppression files stored in your project's suppressions directory. Use one of these two syntax variations when you want to pass in multiple individual suppression files.
Specify the
suppression-file
option followed by a comma-separated string of suppression file PATH/names (no spaces).
$ inspxe-cl -collect ti2 -s-f
"C:\myTi2Analysis\Results\suppressions\myTi2SuppressAllFile.sup"
,"C:\myTi2Analysis\Results\suppressions\myTi2SuppressAllFile5.sup"
-- myAppOr specify the suppression-file option multiple times, each one followed by a suppression file PATH/name.
$ inspxe-cl -collect ti2 -s-f
"C:\myTi2Analysis\Results\suppressions\myTi2SuppressAllFile.sup"
-s-f "C:\myTi2Analysis\Results\suppressions\myTi2SuppressAllFile5.sup"
-- myAppIt is easiest to use an option file to pass in multiple suppression files, as explained in the next section.
Example: Multiple Suppression Files in a Single Suppressions Directory
If you have multiple suppression files in the same directory and want to apply all the suppression files in this directory, you can simply specify the directory.
$ inspxe-cl -collect ti2 -s-f
"C:\myTi2Analysis\Results\suppressions"
-- myAppUsing an Option File to Pass in Multiple Suppression Files
If you have multiple suppression files but cannot specify the suppressions directory as described above, you can use the
option-file
option to pass in an option file with the
suppression-file
option and arguments. The option file is a plain text file with each option and its arguments followed by a newline. As you create new suppression files, you can add them to the option file as desired.
This option file is named
myOptionFile.txt
. It specifies suppression files from three different directories, including a suppress-all file from the baseline result directory, all suppressions from a suppressions directory that holds converted suppression files, and the latest suppression file from the current result directory.
-s-f "C:\myTi2Analysis\BaselineResult\suppressions\myTi2SuppressAllFile.sup" -s-f "C:\myConvertedSuppressions\" -s-f "C:\myNewTi2Analysis\Results\suppressions\myNewTi2Suppressions.sup"
Now
myOptionFile.txt
is passed into the analysis process, so all the suppression files specified in
myOptionFile.txt
are applied.
$ inspxe-cl -collect ti2 -option-file
.\myOptionFile.txt
-- myAppApplying Suppression Files During Analysis
Use the
collect
or
collect-with
action with the
suppression-file
option to pass in one or more suppression files.
As previously described, it is easiest to configure analysis through the
Intel Inspector
GUI, then use the
Dialog Box Corresponding inspxe-cl Command Options to copy the command with the analysis type and other arguments to your clipboard, and then save it for use on the command line or in scripts.
In this example, the
collect
action is used with the
ti2
Detect Deadlocks and Data Races
analysis type. The command is simplified, so all other analysis settings are left to default. This command:
- Runs aDetect Deadlocks and Data Races (ti2)analysis on the applicationmyApp.
- Uses the short name-s-ffor thesuppression-fileoption.
- Specifies the suppression directory, rather than individual suppression files. When the directory is specified, theinspxe-clcommand tool applies all suppression files in this directory.
- To make it easy to switch between the GUI and the command line, the suppression files were stored in theMicrosoft Visual Studio* IDEstandard location for suppression files:C:\myProject\My Inspector Results-[project name]\suppressions.
$ inspxe-cl -collect ti2 -s-f
"C:\myProject\My Inspector Results\suppressions"
-- myAppApplying Suppression Files When Generating a Problems Report
If a suppression file was not used during analysis and data collection, it can be applied when generating a Problems report. Use the
report
action with the
suppression-file
option to pass in one or more suppression files, or a suppressions directory. For most complete suppression of problems, the suppression file should be based on the same analysis type as the result.
This simple report-generation command uses all default settings except that it:
- Uses a result from aDeadlocks and Data Races (ti2)analysis.
- Uses the short name-s-ffor thesuppression-fileoption.
- Generates a Problems report of only new, unsuppressed problems.
$ inspxe-cl -report problems -s-f
"C:\myProject\My Inspector Results\suppressions\myTi2Suppress-AllFile"