Main Content

Export Global Variable List

You can export the list of global variables in your code to a tab delimited text file or a MATLAB® table. The text file or the table contains the same information as the Variable Access pane in the Polyspace® user interface.

Using the text file, you can:

  • Generate graphs or statistics about global variables. For instance, you can see the percentage of shared global variables that are not protected against concurrent access.

  • Use the range information to create external constraints for global variables. For instance, you can report that your code is free of certain run-time errors only for the extracted range of global variables.

    You can also use the range to specify external constraints on subsequent verifications or verification of other modules. See Specify External Constraints for Polyspace Analysis.

Export Variable List to Text File

You can export results from the user interface or command line.

User InterfaceCommand Line
  1. Open your verification results.

  2. Select Reporting > Export > Export Variable Access. If you are using the Polyspace Platform user interface, select Report > Export Variable Access.

  3. Select a location to save the text file and click OK.

Use appropriate options with the polyspace-report-generator command.

The available options are:

  • -generate-variable-access-file: Specifies that a text file must be generated.

  • -results-dir folder_paths: Path to folder containing your analysis results. If you do not specify a folder path, the software uses analysis results from the current folder.

    To generate text files for multiple analyses, specify folder_paths as comma separated list with no spaces after the commas. For example:

    C:\My_project\Module_1\results,C:\My_project\Module_2\Results

    To merge the text files, use the join function.

  • -set-language-english: Use this option to generate English reports if the default report is in another language. The display language (Windows®) or locale (Linux®) of your operating system determines the default language in the report.

Export Variable List to MATLAB Table

Instead of a text file, you can read your Polyspace analysis results into a MATLAB table. See variableAccess.

View Exported Variable List

The text file or the table contains the result information available on the Variable Access pane in the user interface.

For instance, suppose the Variable Access pane shows a variable SHR with this information.

If you export this information to the tab-delimited text file and open the file in Excel®, you see the same information. Some of the information is shown below.

VariablesData TypeAccessValues#Reads#WritesWritten by taskRead by taskProtectionLineColFileFunctionExtension
SHRint32Aggregate0 or 2212server1 server2tregulateCritical section3011tasks1.c c
SHR Write0     3011tasks1.c_init_globals()c
SHR Write22     818tasks1.cTserver()c
SHR Read0 or 22     5314tasks1.cinitregulate()c

See also Variable Access in Polyspace Desktop User Interface.

Some differences in presentation between the Variable Access pane and the text file (or MATLAB table) are listed below.

  • The Access column in the text file indicates whether the row shows information about the variable (Aggregate) or information about operations on the variable (Write or Read).

  • The Function column in the text file shows the functions where the variable is read or written ( and on the Variable Access pane).

  • There are no rows corresponding to read and write operations from tasks ( and on the Variable Access pane). This information is available in the Written by task and Read by task columns in the text file (Tasks_Write and Tasks_Read columns in the MATLAB table).

  • The colors on the Variable Access pane are represented through the columns Unreachable and Protected:

    • If a shared variable is accessed in multiple tasks without a common protection, it is colored orange on the Variable Access pane. In the text file, the Protected column shows Unprotected.

    • If a shared variable is accessed in multiple tasks but with a common protection, it is colored green on the Variable Access pane. In the text file, the Protected column shows Protected.

    • If a shared variable is not accessed at all, it is colored gray on the Variable Access pane. In the text file, the Unreachable column shows Is unreachable.

  • The Potential column in the text file shows read or write operations via pointers ( or on the Variable Access pane). For operations via pointers, the column shows Potential access.

Related Topics