HP UX Web Development Tools manual Generating reports, Report generation options table

Page 27

6 Generating reports

Cadvise either stores the diagnostic messages in the PDB or outputs them into the stderr. To analyze these diagnostic messages, you can generate a report using the cadvise report command. Cadvise report provides multiple options for filtering the diagnostic messages stored in the log files. These reports can also be viewed and saved as HTML files. Using these options, you can view a selected set of diagnostic messages. The cadvise reports can be generated from the following:

The PDB

Cadvise builds that use the -pdboption store the diagnostic messages in the program database. The following command generates report from the PDB:

cadvise report <report-options> -pdb pdbdir

The log files

Cadvise builds that do not use the -pdboption, output them into stderr. You can redirect these to a log file for later analysis. The following command generates the report from log files:

cadvise report <report-options> logfile

6.1Report generation options table

You can use the following options to generate reports:

“-summary” (page 28)

Prints the summary information of all messages in the log file.

“-file_summary” (page 28)

Prints the summary information for each source file.

“-all” (page 28)

Prints all the messages in the log file.

“-html[=<dir>]” (page 29)

Displays the reports in HTML.

“-xml[=<filename>]” (page 30)

Generates the specified cadvise reports in XML format.

“-diag

Prints only those diagnostics with specified diagnostic numbers, N1,N2..Nn.

N1,N2,N3,...,Nn” (page 30)

 

“-severity N” (page 31)

Prints the messages with severity greater than or equal to (>=) to N.

“-exclude

Suppresses diagnostics or metrics from source files that have any of the specified

<string1:string2:...:stringN>”(page31)

strings in the filename path.

“-include

Generates diagnostics or metrics from source files that contain the any of the specified

<string1:string2:...:stringN>”(page32)

string in the file name path. Messages from any other files are suppressed.

“+metrics” (page 32)

Prints program complexity data for all or selected source files.

“-migration” (page 39)

Print only those messages that are related to migration, such as endian and 32-bit

 

to 64-bit migration related diagnostics.

“-module <name>” (page 33)

Generates report only for source files that make up the module <name>.

“-noheader” (page 34)

Suppresses the report header in cadvise reports.

“-chseverity

Enables you to modify the severity of diagnostic DNn to SLn.

<DN1:SL1,DN2:SL2,...,DNn:SLn>”(page34)

 

“-basepdb

Enables you to compare PDB <pdb-name> with the PDB specified using -pdb option.

<basepdbname>” (page 34)

 

“+opts <file>” (page 38)

Reads the report options from the specified file.

6.1 Report generation options table

27

Image 27
Contents HP Code Advisor C.02.20 User Guide Page Contents Contents Related information Document conventions and symbolsAbout this document Intended audienceCadvise-help@lists.hp.com HP encourages your commentsCadvise user interface FeaturesCadvise user interface Features Introduction$ cadvise cc -c hello.c Advanced static code analysis$ cadvise -pdb ./mypdb +wlint aCC hello.cpp Supported compilersGetting started Using CadviseSteps in using cadvise Supported platforms Installing CadviseInvoking Cadvise Integrating Cadvise with the makefiles and build process Using Cadvise as a wrapper around Compiler or LinkerFor information on PDB, see Using the Program Database PDB See the following makefile contentEnabling different categories of diagnostic messages Generating code complexity metricsExample 2 Sample wrapper script Objfile.metrics Example 3 Generating code complexity metricsGenerating code complexity metrics $ cat /tmp/example.c Example 4 Code complexity metrics+wcodeguide=rules-library Example 5 Writing a rule to enforce naming convention Source structure in the rules libraryUsing the Program Database PDB Disabling locks in PDB operations PDB options tableSpecifying the PDB location Deleting PDBExample 9 Creating a PDB snapshot Creating a PDB snapshot at a specified locationDisplaying PDB version Example 8 Removing object file information from the PDBUsing cross-file analysis UsageCross-file analysis options Crossfile=auto Example 15 Specifying the location of object files Enabling warnings selectively Configuring diagnostic messagesDiagnostic configuration options table Suppressing warnings selectivelyInterpreting selective warnings as errors Disabling warnings in a macroManaging warnings in a source file Cadvise report report-options logfile Generating reportsReport generation options table Cadvise report report-options -pdb pdbdir$cadvise report -summary -pdb testpdb -noheader Generating summary reportsGenerating file summary report Generating detailed report$ cadvise report -pdb testpdb -all To save reports, run the following commandGenerating Html report Example 23 Generating detailed reportExample 24 Generating an XML report Printing diagnostics with specific diagnostic numbersFollowing example shows the command to generate XML report Generating XML reportExample 26 Generating reports based on severity Suppressing diagnostics for specific filesGenerating reports based on severity $ cadvise report -pdb testpdb -diag$ cadvise report -pdb test.pdb -summary -include inflate.c Reporting diagnostics from specific filesReporting program complexity metrics $ cadvise report -pdb test.pdb -summary -exclude inflate.cGenerating report for a module Example 29 Reporting program complexity metrics$ cadvise report -pdb gzip.pdb +metrics -include inflate.c $ cadvise report -pdb test.pdb -summary -module test1 Modifying the default severity level of a diagnosticSuppressing report header Generating PDB comparison report$ cadvise report -pdb tmp.pdb -basepdb tmp1.pdb -all Example 34 Generating detailed diff report with the header$ cadvise report -pdb tmp.pdb -basepdb tmp1.pdb -diag Example 35 Generating diff report for any particular warning$ cadvise -pdb pdb1 cc one.c two.c $ cadvise report -pdb tmp.pdb -basepdb tmp1.pdb -severity$ cadvise report -pdb new.pdb -basepdb old.pdb -all Report options fileExample 41 Report options file Example 42 Generating a report using -migration optionGenerate report for migration related warnings Generating consolidated report from multiple PDBs$ cadvise report -pdb 1.pdb2.pdb3.pdb4.pdb -all Recommended process for analyzing the diagnostic messagesGenerating PDB diffs with multiple PDBs Report options interoperability$ cadvise report -pdb test.pdb -summary -include a.cb.c Example 44 Reporting options interoperability$ cadvise report -pdb test.pdb -diag 2549 -exclude b.c Example 45 Ignoring the -includeoptionExample 47 Displaying the list of cadvise options Example 48 Using -noabortMiscellaneous driver options Help-h-HFollowing example shows the usage of -nobuildoption Example 49 Using -nobuild optionFollowing command creates the file cadvdir/foo.cad Example 51 Using -tee optionLine generates the following messages Example 52 Using +opts filename optionCategories of diagnostics with examples Categories of diagnostics tableDetecting generic programming errors Categories of diagnostics with examples Such cases, cadvise generates the following warning Example 53 Null pointer dereference checkSuch cases, cadvise generates the following warnings Example 54 Potential memory leak checkExample 56 Out of scope access Example 55 Out of bound accessSuch cases, cadvise generates the following error Example 57 Use of pointer after freeExample 58 Allocator/deallocator mismatch Example 59 Signed bit field of length Detecting 32-bit to 64-bit migraton issuesDetecting endianness migration issues Example 60 Detecting 32-bit to 64-bit migraton issuesDetecting potential security vulnerabilities Example 61 Detecting endian dependent code fragmentsConsider the following code fragment This case, cadvise generates the following error Detecting multi-threaded programming issuesExample 63 Detecting multi-threaded programming issues Running cadvise generates the following errorDetecting potential performance improvement opportunities Detecting potential performance improvement opportunities Fixing the warnings by source change AC++ standard conformance and compatibility changes Incompatibilities on PA-RISC based systemsIndex Symbols