Contenido principal

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 in the Polyspace Platform user interface. If you are in the Dashboard perspective, select Review on the toolstrip to open the full list of results.

  2. 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 Global Variables Usage and Global Variable Accesses panes in the user interface.

For instance, suppose the Global Variables Usage pane shows a variable SHR:

If you select this variable, you see the following read or write operations on the variable on the Global Variables Access pane:

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 taskProtectionUsageLineColFileFunctionExtension
SHRint32Aggregate0 or 2212server1 server2tregulateCritical sectionshared3011tasks1.c c
SHR Write0      3011tasks1.c_init_globals()c
SHR Write22      818tasks1.cTserver()c
SHR Read0 or 22      5314tasks1.cinitregulate()c

See also Global Variables Usage in Polyspace Platform User Interface.

Some differences in presentation between the global variable information in the user interface 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 Global Variables Accesses pane).

  • The colors on the Global Variables Usage pane are represented through the columns Usage and Protection:

    • If a shared variable is accessed in multiple tasks without a common protection, it is colored orange on the Global Variables Usage pane. In the text file, the Protection column is empty.

    • If a shared variable is accessed in multiple tasks but with a common protection, it is colored green on the Global Variables Usage pane. In the text file, the Protection column shows an entry indicating the protection mechanism, for instance Critical section.

    • If a shared variable is not accessed at all, it is colored gray on the Global Variables Usage pane. In the text file, the Usage column shows neither read nor written and the Unreachable column contains an entry Is unreachable.

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

See Also

Topics