主要内容

polyspace.BugFinderResults

MATLAB 读取 Polyspace Bug Finder 结果

说明

使用此对象将 Polyspace® Bug Finder™ 分析结果读取到 MATLAB® 表中。您可以获取结果的高级概览或详细信息(如缺陷的每个实例)。

注意

在从 MATLAB 中运行 Polyspace 之前,必须将已安装的 Polyspace 与 MATLAB 相关联。请参阅将 Polyspace 与 MATLAB 和 Simulink 集成将 Polyspace Server 产品与 MATLAB 集成

创建对象

描述

resObj = polyspace.BugFinderResults(resultsFolder) 创建一个对象,用于将一组特定的 Bug Finder 结果读取到 MATLAB 表中。使用对象方法读取结果。

示例

proj = polyspace.Project; resObj = proj.Results; 创建一个具有 Results 属性的 polyspace.Project 对象。如果运行 Bug Finder 分析,此属性是一个 polyspace.BugFinderResults 对象。

示例

输入参量

全部展开

结果文件夹的名称,指定为字符向量。该文件夹必须直接包含扩展名为 .psbf 的结果文件。即使结果文件位于指定文件夹的子文件夹中,也无法访问。

如果文件夹不在当前文件夹中,则 resultsFolder 必须包含完整路径或相对路径。

示例: 'C:\Polyspace\Results\'

对象函数

getSummaryView number of Polyspace results organized by results type (Bug Finder) or color and file (Code Prover)
getResultsView all instances of Bug Finder or Code Prover results

示例

全部折叠

此示例说明如何从 MATLAB 读取 Bug Finder 分析结果。

将演示结果集复制到临时文件夹。

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

创建结果对象。

resObj = polyspace.BugFinderResults(userResPath);

使用对象将结果读取到 MATLAB 表中。

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

对演示文件 numerical.c 运行 Polyspace Bug Finder 分析。配置以下选项:

  • 指定 GCC 4.9 为编译器。

  • 将结果保存在当前工作文件夹的 results 子文件夹中。

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 = run(proj, 'bugFinder');

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

版本历史记录

在 R2017a 中推出