Main Content

getResults

View all instances of Bug Finder or Code Prover results

Description

resTable = getResults(resObj, content) returns a table showing all results in a Polyspace® result set, resObj. The results set resObj can be a Bug Finder results set denoted by a polyspace.BugFinderResults object or a Code Prover results set denoted by a polyspace.CodeProverResults object. You can manipulate the table to produce graphs and statistics about your results that you cannot obtain readily from the user interface.

example

Examples

collapse all

This example shows how to read Bug Finder analysis results from MATLAB®.

Copy a demo result set to a temporary folder.

resPath = fullfile(polyspaceroot,'polyspace','examples','cxx','Bug_Finder_Example', ...
'Module_1','BF_Result');
userResPath = tempname;
copyfile(resPath,userResPath);

Create the results object.

resObj = polyspace.BugFinderResults(userResPath);

Read results to MATLAB tables using the object.

resSummary = getSummary(resObj, 'defects');
resTable = getResults(resObj);

Run a Polyspace Bug Finder™ analysis on the demo file numerical.c. Configure these options:

  • Specify GCC 4.9 as your compiler.

  • Save the results in a results subfolder of the current working folder.

proj = polyspace.Project

% Configure analysis
proj.Configuration.Sources = {fullfile(polyspaceroot, 'polyspace', ... 
    'examples', 'cxx', 'Bug_Finder_Example', 'sources', 'numerical.c')};
proj.Configuration.TargetCompiler.Compiler = 'gnu4.9';
proj.Configuration.ResultsDir = fullfile(pwd,'results');

% Run analysis
bfStatus = proj.run('bugFinder');

% Read results
resObj = proj.Results;
bfSummary = getResults(resObj, 'readable');

This example shows how to read Code Prover analysis results from MATLAB.

Copy a demo result set to a temporary folder.

resPath=fullfile(polyspaceroot,'polyspace','examples','cxx','Code_Prover_Example', ...
'Module_1','CP_Result');
userResPath = tempname;
copyfile(resPath,userResPath);

Create the results object.

resObj = polyspace.CodeProverResults(userResPath);

Read results to MATLAB tables using the object.

resSummary = getSummary (resObj);
resTable = getResults (resObj);

Run a Polyspace Code Prover™ analysis on the demo file single_file_analysis.c. Configure these options:

  • Specify GCC 4.9 as your compiler.

  • Save the results in a results subfolder of the current working folder.

  • Specify that a main function must be generated, if it does not exist in the source code.

proj = polyspace.Project

% Configure analysis
proj.Configuration.Sources = {fullfile(polyspaceroot, 'polyspace', 'examples',...
    'cxx', 'Code_Prover_Example', 'sources', 'single_file_analysis.c')};
proj.Configuration.TargetCompiler.Compiler = 'gnu4.9';
proj.Configuration.ResultsDir = fullfile(pwd,'results');
proj.Configuration.CodeProverVerification.MainGenerator = true;


% Run analysis
cpStatus = proj.run('codeProver');

% Read results
resObj = proj.Results;
cpSummary = getResults(resObj, 'readable');

Input Arguments

collapse all

Bug Finder or Code Prover results set, specified as a polyspace.BugFinderResults or polyspace.CodeProverResults object respectively.

Amount of information to be included for each result. If you specify '', all information is included. If you specify 'readable', the following information is not included:

If you do not specify this argument, the full table is included.

See Export Polyspace Analysis Results.

Output Arguments

collapse all

Table showing all results from a single Bug Finder or Code Prover analysis. For each result, the table has information such as file, family, and so on. If a particular information is not available for a result, the entry in the table states <undefined>.

For more information on:

Version History

Introduced in R2017a