メインコンテンツ

getResults

Bug Finder または Code Prover の結果のすべてのインスタンスを表示する

説明

resTable = getResults(resObj, content) は、Polyspace® 結果セット resObj ですべての結果を示すテーブルを返します。結果セット resObj は、polyspace.BugFinderResults オブジェクトで示される Bug Finder の結果セットにすることも、polyspace.CodeProverResults オブジェクトで示される Code Prover の結果セットにすることもできます。テーブルを操作して、ユーザー インターフェイスから簡単に取得できない結果についてのグラフや統計を生成できます。

すべて折りたたむ

この例では、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 table に読み取ります。

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

デモ ファイル numerical.cPolyspace 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 = proj.run('bugFinder');

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

この例では、MATLAB から Code Prover の解析結果を読み取る方法を示します。

デモの結果セットを一時フォルダーにコピーします。

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

結果オブジェクトを作成します。

resObj = polyspace.CodeProverResults(userResPath);

このオブジェクトを使用して結果を MATLAB table に読み取ります。

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

デモ ファイル single_file_analysis.cPolyspace Code Prover™ 解析を実行します。以下のオプションを構成します。

  • コンパイラとして GCC 4.9 を指定します。

  • 結果を現在の作業フォルダーの results サブフォルダーに保存します。

  • ソース コード中に存在しない場合は main 関数を生成することを指定します。

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');

入力引数

すべて折りたたむ

それぞれ、polyspace.BugFinderResults オブジェクトまたは polyspace.CodeProverResults オブジェクトとして指定された Bug Finder または Code Prover の結果セット。

各結果に含める情報の量。'' を指定すると、すべての情報が含まれます。'readable' を指定すると、次の情報は含まれません。

この引数を指定しない場合、完全な table が含まれます。

Polyspace 解析結果のエクスポートを参照してください。

出力引数

すべて折りたたむ

1 回の Bug Finder 解析または Code Prover 解析のすべての結果を示すテーブル。結果ごとに、ファイル、ファミリなどの情報がテーブルに含まれます。特定の情報が結果に使用できない場合、テーブルのエントリに <undefined> が示されます。

詳細については、それぞれ以下を参照してください。

バージョン履歴

R2017a で導入