Oracle Solaris Studio 12.4 Man Pages

Exit Print View

Updated: January 2015
 
 

codean(1)

Name

codean - Command Line Interface of Code Analyzer

Synopsis

codean
     [-s] [-d] [-c] [--fullpath ] [-f source-file1
     [-f source-file2 ... ]] [-n number-of-lines]
     [--save [-t]] [--whatisnew |  --whatisfixed]
     [--tag tag-name] [-D destination-directory]
     [--ref reference-path]   [--showerrors   error-code]
     [--hideerrors error-code] [--showwarnings warning-code]
     [--hide-warnings warning-code] [executable|directory]

Description

The codean (/'code-an/) command launches the Code Analyzer Command-Line tool (Codean). Codean enables you to combine three types of analysis to help you produce secure, robust, and quality C and C++ applications. Codean reads the Analytics file, using data gathered from Previse, Uncover, and Discover as input. Codean then generates output in text and html formats. Codean also provides a mechanism for storing data in a history archive. You can later compare newer data with the data in the archive you created.

tag-name is the tag name. reference is a reference executable file or directory to compare recent data against. error-code is a three-letter error code. warning-code is a three-letter warning code. Note that the three-letter error code or three-leter warning code must be either all capitalized or all lower-case. For a full list of error codes and warning codes, see the Oracle Solaris Studio Code Analyzer User's Guide.

Options

codean accepts the following options:

-s

Process static data. You can specify multiple options or leave blank. If left blank, Codean processes all possible options, depending on whether .analyze/static(dynamic, coverage)/latest exists.

-d

Process dynamic data. You can specify multiple options or leave blank. If left blank, Codean processes all possible options, depending on whether .analyze/static(dynamic, coverage)/latest exists.

-c

Process coverage data. You can specify multiple options or leave blank. If left blank, Codean processes all possible options, depending on whether .analyze/static(dynamic, coverage)/latest exists.

--fullpath

Display the full file path.

-f source-file

Only display issues in given source file. You can specify more than one source file.

-n number-of-lines

Display the specified number of lines of source code.

--save [-t]

Save the latest reports. If -t is specified, overwrites the saved report with the same tag name.

--whatisnew

Present only the new issues since the last run. If a saved copy cannot be found with the checksums to compare against, most likely due to an absence or emptiness of the .analyze/history/ directory, Codean first internally does a save command and then does the comparison.

--whatisfixed

Present only the fixed issues. If a saved copy cannot be found with the checksums to compare against, most likely due to an absence or emptiness of the .analyze/history/ directory, Codean first internally does a save command and then does the comparison.

--tag tag-name

Specify tag name of saved report. This option names the saved copy if paired with --save and finds which historic copy to compare against if paired with –-whatisnew or –-whatisfixed. A tag name can be specified with this option. When --save is present, if no tag name is specified, Codean checks the last modified time of the latest report of the executable and uses the time stamp as the tag name. The format is hh::mm:ssmonddyear, such as 12:52:16Jul 12012. When --whatisnew or --whatisfixed is present, if no tag name is specified, the latest report is compared with the last saved copy.

-D destination-directory

Specify a location to put all the end reports. This flag must be followed by a destination directory.

--ref reference-path

Paired with --whatisnew or --whatisfixed only, --reference-path specifies a different file to compare against. The reference-path is a reference executable or directory name that must be specified. For example, if you have 2 cg binaries, cg.pass and cg.fail, then you can compare the binaries against each other.

codean -s --whatisnew --ref cg.pass cg.fail

Using the previous command shows the new issues in the cg.fail Previse report compared to the cg.pass Previse report.

--showerrors error-code

Display errors of type "error-code". The "error-code" can have the value of a three-letter error code, "MLK" for memory leak errors, or "all" for all errors.

--hideerrors error-code

Hide errors of type "error-code". The "error-code" can have the value of a three-letter error code, "MLK" for memory leak errors, or "all" for all errors.

--showwarnings warning-code

Display warnings of type "warning-code". The "warning-code" can have the value of a three-letter warning code, "MLK" for memory leak warnings, or "all" for all warnings.

--hidewarnings warning-code

Display warnings of type "warning-code". The "warning-code" can have the value of a three-letter warning code, "MLK" for memory leak warnings, or "all" for all warnings.

EXAMPLE OF HOW TO MONITOR A BUG FIX

The following section describes how you can monitor the affect of a bug fix, particularly how to keep track of the dynamic memory access because the bug has invalid memory access.

  1. Compile the target source before the fix.

  2. Instrument the binary using Discover. Make sure Analytics output is generated by using the command discover -a.

  3. Run the instrumented binary.

  4. Use Codean to store the Analytics output by using the following command:

    codean --save --tag before_bugfix -d a.out

    A history archive is created at a.out.analyze/history/before_bugfix/, and a history file called dynamic is also created under the directory.

  5. Fix the bug.

  6. Recompile the target source.

  7. Reinstrument the binary using Discover, with the command discover -a.

  8. Rerun the instrumented binary.

  9. Show the comparison results: You can run Codean to ensure the invalid memory access caused by the bug has gone. Use the following command:

    codean --whatisfixed --tag before_bugfix -d a.out

    The previous command also produces a new Analytics output file, a.out.analyze/dynamic/fixed_before_bugfix, which only contains fixed dynamic issues. You can then use Codean or the Code-Analyzer GUI to view these fixed issues.

  10. [Optional] You can also run Codean to ensure you did not introduce a new bug. Use the following command:

    codean --whatisnew --tag before_bugfix -d a.out

    Similar to using the --whatisfixed command, this also produces a new Analytics output file at a.out.analyze/dynamic/new_before_bugfix that only contains new dynamic issues.