VariableAccess
読み取り/書き込み操作と C/C++ グローバル変数の表示
説明
は、varList
= variableAccess(resObj
)polyspace.CodeProverResults
オブジェクト resObj
によって表される Code Prover 結果セットにおけるグローバル変数の分布を返します。このリストには、グローバル変数に対するすべての読み取り操作および書き込み操作も含まれます。
例
既存の検証結果から MATLAB table へのグローバル変数の読み取り
この例では、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 に読み取ります。
varList = variableAccess(resObj);
Code Prover 解析の実行と MATLAB table へのグローバル変数の読み取り
デモ ファイル single_file_analysis.c
に Polyspace® 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 = variableAccess(resObj);
入力引数
resObj
— Code Prover 結果
polyspace.CodeProverResults
オブジェクト
polyspace.CodeProverResults
オブジェクトとして指定された Code Prover 結果セット。
出力引数
varList
— グローバル変数の分布
table
1 つの Code Prover 解析のすべてのグローバル変数と、それらのグローバル変数に対する読み取り操作および書き込み操作を示すテーブル。
それぞれのグローバル変数について、データ型、アクセス回数などの情報がテーブルに含まれます。
それぞれの読み取りまたは書き込み操作について、ファイルと関数名、行番号などの情報がテーブルに含まれます。
特定の情報が検証結果に使用できない場合、テーブルのエントリに <undefined>
が示されます。
詳細については、それぞれ以下を参照してください。
テーブルの列については、グローバル変数リストのエクスポートを参照してください。
MATLAB table は、tableを参照してください。
バージョン履歴
R2017a で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)