HP UX Web Development Tools manual Generating Html report, Example 23 Generating detailed report

Page 29

Example 23 Generating detailed report

$ cadvise report -pdb testpdb -all

============================== SEVERITY LEVEL 8 ===============================

"example.C", line 13: warning #2549-D: variable "i" is used before its value is set i++;

^

6.5 Generating HTML report

The -html[=<dir>]option generates report in HTML format from specified PDB. This option can be used in the following ways:

To only view the HTML reports in the web browser, run the following command: $ cadvise report -pdb mypdb -html

The HTML report will be displayed on the browser. The browser is invoked as specified in the BROWSER environment variable. If this environment variable is not specified, it uses the default web browser (/opt/mozilla/mozilla). You can also save the generated HTML reports.

To save reports, run the following command:

NOTE: This command saves the html report in a specified directory. The web browser is not invoked with this option.

$ cadvise report -pdb mypdb -html=dirname

In addition, the HTML Report in cadvise filters diagnostics on the basis of:

Severity number

Diagnostic number

Filename path

To invoke the HTML reports page with filters, use the following command:

$ cadvise <cadvise-options> report <fitering_options> -html -pdb <pdb-name>

To generate a detailed HTML report, use the following command: $ cadvise report -pdb mypdb -html=dirname -all

This command creates detailed HTML reports and saves it to the specified directory. To view these reports, open the index.htm file available inside the directory name specified with –htmloption.

The HTML report has the following options when it is viewed from the web browser:

Tabbed Interface: Summary report and warnings for each severity level are placed in different tabs, which is named according to severity level.

Hot Keys to Navigate Tabs:

Ctrl + Alt + 0 : Shows summary tab.

Ctrl + Alt + (1-9): Shows severity tab corresponding to pressed numeric key.

Sorting and Text filtering options are available in the severity tabs.

Multi Page viewing: If the number of diagnostics messages exceeds 1000, a drop down page list is shown at top right side on the table. You can select a desired page number from the list. The selected page is loaded.

6.5 Generating HTML report 29

Image 29
Contents HP Code Advisor C.02.20 User Guide Page Contents Contents About this document Document conventions and symbolsIntended audience Related informationCadvise-help@lists.hp.com HP encourages your commentsCadvise user interface Features FeaturesIntroduction Cadvise user interface$ cadvise cc -c hello.c Advanced static code analysis$ cadvise -pdb ./mypdb +wlint aCC hello.cpp Supported compilersSteps in using cadvise Using CadviseSupported platforms Installing Cadvise Getting startedInvoking Cadvise For information on PDB, see Using the Program Database PDB Using Cadvise as a wrapper around Compiler or LinkerSee the following makefile content Integrating Cadvise with the makefiles and build processExample 2 Sample wrapper script Enabling different categories of diagnostic messagesGenerating code complexity metrics 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 Specifying the PDB location PDB options tableDeleting PDB Disabling locks in PDB operationsDisplaying PDB version Creating a PDB snapshot at a specified locationExample 8 Removing object file information from the PDB Example 9 Creating a PDB snapshotCross-file analysis options Using cross-file analysisUsage Crossfile=auto Example 15 Specifying the location of object files Diagnostic configuration options table Configuring diagnostic messagesSuppressing warnings selectively Enabling warnings selectivelyManaging warnings in a source file Interpreting selective warnings as errorsDisabling warnings in a macro Report generation options table Generating reportsCadvise report report-options -pdb pdbdir Cadvise report report-options logfileGenerating file summary report Generating summary reportsGenerating detailed report $cadvise report -summary -pdb testpdb -noheaderGenerating Html report To save reports, run the following commandExample 23 Generating detailed report $ cadvise report -pdb testpdb -allFollowing example shows the command to generate XML report Printing diagnostics with specific diagnostic numbersGenerating XML report Example 24 Generating an XML reportGenerating reports based on severity Suppressing diagnostics for specific files$ cadvise report -pdb testpdb -diag Example 26 Generating reports based on severityReporting program complexity metrics Reporting diagnostics from specific files$ cadvise report -pdb test.pdb -summary -exclude inflate.c $ cadvise report -pdb test.pdb -summary -include inflate.c$ cadvise report -pdb gzip.pdb +metrics -include inflate.c Generating report for a moduleExample 29 Reporting program complexity metrics Suppressing report header Modifying the default severity level of a diagnosticGenerating PDB comparison report $ cadvise report -pdb test.pdb -summary -module test1$ 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 fileGenerate report for migration related warnings Example 42 Generating a report using -migration optionGenerating consolidated report from multiple PDBs Example 41 Report options fileGenerating PDB diffs with multiple PDBs Recommended process for analyzing the diagnostic messagesReport options interoperability $ cadvise report -pdb 1.pdb2.pdb3.pdb4.pdb -all$ cadvise report -pdb test.pdb -diag 2549 -exclude b.c Example 44 Reporting options interoperabilityExample 45 Ignoring the -includeoption $ cadvise report -pdb test.pdb -summary -include a.cb.cMiscellaneous driver options Example 48 Using -noabortHelp-h-H Example 47 Displaying the list of cadvise optionsFollowing command creates the file cadvdir/foo.cad Example 49 Using -nobuild optionExample 51 Using -tee option Following example shows the usage of -nobuildoptionLine generates the following messages Example 52 Using +opts filename optionDetecting generic programming errors Categories of diagnostics with examplesCategories of diagnostics table 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 accessExample 58 Allocator/deallocator mismatch Such cases, cadvise generates the following errorExample 57 Use of pointer after free Detecting endianness migration issues Detecting 32-bit to 64-bit migraton issuesExample 60 Detecting 32-bit to 64-bit migraton issues Example 59 Signed bit field of lengthConsider the following code fragment Detecting potential security vulnerabilitiesExample 61 Detecting endian dependent code fragments This case, cadvise generates the following error Detecting multi-threaded programming issuesDetecting potential performance improvement opportunities Example 63 Detecting multi-threaded programming issuesRunning cadvise generates the following error Detecting potential performance improvement opportunities Fixing the warnings by source change AC++ standard conformance and compatibility changes Incompatibilities on PA-RISC based systemsIndex Symbols