main content

view c/c global variables along with read/write operations -凯发k8网页登录

view c/c global variables along with read/write operations

description

example

varlist = variableaccess(resobj) returns the distribution of global variables in a code prover result set denoted by the object resobj. the list also contains all read and write operations on the global variables.

examples

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 list of global variables to matlab tables using the object.

varlist = variableaccess(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 = variableaccess(resobj);

input arguments

code prover results set, specified as a object.

output arguments

table showing all global variables from a single code prover analysis along with read and write operations on them.

  • for each global variable, the table has information such as data type, number of times accessed, and so on.

  • for each read or write operation, the table has information such as file and function name, line number, and so on.

if a particular information is not available for a result, the entry in the table states .

for more information on:

  • the columns of the table, see .

  • matlab tables, see .

version history

introduced in r2017a

see also

topics

    网站地图