JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
General

Offline Build/Analysis

A CodeSonar analysis can be performed offline in the build interval, analyze interval, or both.

Offline build and analysis do not interact with a hub. The information that would be continually submitted if the analysis were online is instead stored in the analysis directory (or build directory, during the build interval). The stored offline information is submitted to the hub with codesonar submit-results.

You will still require a hub to access your analysis results.



By default, the CodeSonar build/analysis is performed online: information is continually submitted to the hub as the CodeSonar project is constructed and analyzed.

It is also possible to perform the operations in the build interval and analyze interval offline. Offline build and analysis do not interact with a hub. The information that would be continually submitted to the hub in an online build/analysis is instead stored in the build directory/analysis directory so that it can be submitted later with codesonar submit-results. You will still require a hub to access your analysis results.

You can instruct CodeSonar to work offline for the build interval, analyze interval, or both.

The situations in which offline build and analysis can be useful include the following.

Online (standard) CodeSonar build/analysis

This is the default behavior for CodeSonar build and analysis. This manual refers to online build and analysis only when it is necessary to distinguish it from the offline variant.

diagram: online build and analysis continually submit information to the hub

Offline CodeSonar build/analysis

diagram: offline build and analysis do not interact with the hub. codesonar submit-results must be invoked to submit accumulated offline information.

Offline status interacts with other analysis types as follows.

Specifying Offline Build/Analysis

There are two ways to specify offline build/analysis.

Offline analysis is not compatible with command line options or configuration file settings that involve hub interaction. Conflicting settings are resolved as follows.

Submitting Offline Data to a Hub: codesonar submit-results

When a CodeSonar build or analysis command is executed offline, all collected information is stored in the build directory or analysis directory (whichever is applicable). This includes:

Offline information must be submitted to the CodeSonar hub with the codesonar submit-results command in order to be used. Specifically, codesonar submit-results must be invoked:

For full details, see codesonar submit-results: Submit Offline Build/Analysis Information.

The examples below illustrate some typical operation sequences for offline/build analysis with codesonar submit-results.

Copying or Moving the Build/Analysis Directory

When the build interval is performed offline, you can copy or move the build directory before performing the analysis.
This can be particularly useful when the CodeSonar-facing build requires tools that are not available on machines with access to the hub. For example:

Similarly, when the analyze interval is performed offline you can copy or move the analysis directory before submitting results to the hub with codesonar submit-results.

Examples 4, 5, 6, and 7, below, illustrate some typical operation sequences for moving and copying the build directory and analysis directory.

Important: There are several important requirements when copying or moving a build directory or analysis directory containing offline information.

Typical Operation Sequences

The following operation sequences illustrate typical use cases for offline build/analysis. For more examples, see codesonar submit-results: Examples.

For all of these examples, the CodeSonar-facing build is involved by make and the hub location is hubmachine:7340 unless otherwise noted.

Example 1: Perform build interval and analyze interval offline, then submit results to the hub.

Specify the -offline option with both codesonar build and codesonar analyze, then invoke codesonar submit-results.

codesonar build myproj -offline make
codesonar analyze myproj -offline
codesonar submit-results myproj hubmachine:7340

The execution of codesonar submit-results causes the information accumulated by the offline codesonar build and offline codesonar analyze to be submitted from the hub.
The hub has no record of the analysis until codesonar submit-results is executed.

We could also use the following sequence, with the same outcome.

codesonar analyze myproj -offline make
codesonar submit-results myproj hubmachine:7340

Example 2: Perform build interval offline, then submit results to the hub, then perform analyze interval online.

Specify the -offline option with codesonar build, then invoke codesonar submit-results, then perform codesonar analyze online.

This approach is useful if a network outage occurs when you are building the CodeSonar project, but the outage is resolved by the time you are ready to analyze.

codesonar build myproj -offline make
codesonar submit-results myproj hubmachine:7340
codesonar analyze myproj hubmachine:7340

Example 3: Perform build interval online, then perform analyze interval offline, then submit results.

Perform codesonar build online, then invoke codesonar submit-results, then specify the -offline option with codesonar analyze.

This approach is useful if you experience a network outage partway through the build and analysis process.

codesonar build myproj hubmachine:7340 make
codesonar analyze myproj -offline
codesonar submit-results myproj hubmachine:7340

Example 4: Perform build interval offline, copy build directory to a new location, perform analyze interval offline, then submit results.

For example, you might want to associate the accumulated build information with multiple CodeSonar projects on the same machine.

Important: Do not change the basename of the directory. (In this example it is myproj.prj_files throughout.)

codesonar build myproj -offline make
cp -r myproj.prj_files /new/location/
cd /new/location
codesonar analyze myproj -offline
codesonar submit-results myproj hubmachine:7340

Example 5: Perform build interval offline on machineX, copy build directory to machineY, perform analyze interval offline on machineY, then submit results.

For example, suppose machineX has a specialized C/C++ compiler that is used in the native software build, but is not installed on other machines. Moving to a different machine for the analyze interval allows us to reduce the overall load on machineX while still using it in the build interval.

  1. Perform offline build on machineX.
    For this example, the system user is alex and they are storing their CodeSonar build directory under /alexfiles/Projects/.
    cd /alexfiles/Projects
    codesonar build myproj -offline make
  2. Switch to machineY for the remaining steps.
  3. Copy the build directory from machineX to a suitable location on machineY
    You can use whatever system tool you usually use for copying between different machines. This example uses scp.

    Important: Do not change the basename of the directory. (In this example it is myproj.prj_files throughout.)

    scp -r alex@machineX:/alexfiles/Projects/myproj.prj_files /new/location/
  4. Perform offline analysis and submit the results.
    cd /new/location
    codesonar analyze myproj -offline
    codesonar submit-results myproj hubmachine:7340

Example 6: Perform the build interval offline on machineX, make multiple copies of the build directory, then analyze and submit results for each copy separately.

If multiple projects share a compilation unit, you may decide that it is most convenient to perform a single offline codesonar build to observe the corresponding compilation, then make multiple copies of the resulting build directory so that there is one for each CodeSonar project you want to build and analyze.

Important:

For this example, the system user is alex.

  1. Perform the offline build on machineX.
    codesonar build myproj -offline make
  2. Copy the build directory as many times as you like.
    For example, we could remain in the same machineX working directory that we used in step 1, and make three copies.
    scp -r myproj.prj_files alex@machineY:/alexfiles/ProjectA/
    scp -r myproj.prj_files alex@machineY:/alexfiles/ProjectB/
    scp -r myproj.prj_files alex@machineZ:/alexfiles/ProjectC/
  3. For each copy, proceed as required for that project.
    For example:

Example 7: Perform the build directory offline on machineX, move to machineY for the analyze interval, then move to machineZ to submit the results.

  1. Perform offline build on machineX.
    For this example, the system user is alex and they are storing their CodeSonar build directory under /alexfiles/Projects/.
    cd /alexfiles/Projects
    codesonar build myproj -offline make
  2. Switch to machineY.
  3. Copy the build directory from machineX to a suitable location on machineY
    You can use whatever system tool you usually use for copying between different machines. This example uses scp.

    Important: Do not change the basename of the directory. (In this example it is myproj.prj_files throughout.)

    scp -r alex@machineX:/alexfiles/Projects/myproj.prj_files /machY/location/
  4. Perform offline analysis.
    cd /machY/location
    codesonar analyze myproj -offline
  5. Switch to machineZ.
  6. Copy the analysis directory from machineY to a suitable location on machineZ.

    Important: Do not change the basename of the directory.

    scp -r alex@machineY:/machX/location/myproj.prj_files /machZ/final_location/
  7. Submit the results.
    cd /machZ/final_location
    codesonar submit-results myproj hubmachine:7340

Related Links