HP UX Web Development Tools manual Example 34 Generating detailed diff report with the header

Page 35

6.15.1 Generating summary diff report

Using the PDB comparison option along with the -summaryoption displays the difference between the summary reports of 2 PDBs. The following example shows the usage of -basepdb <basepdbname> summary difference report:

Example 33 Generating summary diff report without the header

$ cadvise report -pdb test.pdb -basepdb test0.pdb -summary -noheader

Sev. OldCount Count

Diagnostic Message

---------------------------------------------------------------------------------

6

1

0

warning #20048-D:%s "%s" has incompatible type with previous declaration at line %s in

file "%s"

 

 

5

1

1

warning #20111-D: (SECURITY) Tainted data may be used in data length computation%s

5

4

4

warning #20200-D: Potential null pointer dereference %s%s is detected %s

5

12

12

warning #20112-D: (SECURITY) Tainted data may be copied to the target buffer%s

5

12

12

warning #20118-D: Tainted value may be used in pointer arithmetic expression%s

5

30

30

warning #20117-D: (SECURITY) Tainted value may be used in array index expression%s

5

45

45

warning #20114-D: (SECURITY) Tainted value may be used in loop exit condition computation%s

3

1

1

remark #2193-D: zero used for undefined preprocessing identifier

3

2

2

remark #4315-D: %s loop without body, did you insert an extra ';'?

...

 

 

 

6.15.2 Generating detailed diff report

Using the PDB comparison option along with the -alloption displays the detailed difference between the reports of 2 PDBs. The first part of the report shows the header on top and then shows the difference in warning summary. The second part of the report displays all regressions and improvements in detail. The following example shows the usage of -basepdb <basepdbname> detailed diff report with the -alloption:

Example 34 Generating detailed diff report with the header

$ cadvise report -pdb tmp.pdb -basepdb tmp1.pdb -all

Report generated using "HP Code Advisor C.XX.XX [Release Date]" on <Machine Name> at <Time>

Report command line: "Report Command Line"

New Pdb:

tmp.pdb

Base Pdb:

tmp1.pdb

Regressions:

2

=>2549(2)

Improvements:

1

=>20200(1)

=======================[ REGRESSIONS ]===========================

"/home/solankib/TESTING/b.c", line 6: warning #2549-D: variable "a" is used before its value is set c = a;

^

"/home/solankib/TESTING/b.c", line 9: warning #2549-D: variable "b" is used before its value is set a = b;

^

=======================[ IMPROVEMENTS ]===========================

"/home/solankib/TESTING/a1.c", line 11, procedure main: warning #20200-D: Potential null pointer dereference

You also have the flexibility of using the filtering options with this feature. If you use any filtering option in the command line, then the first step report is filtered and then the diff report is generated as shown in the following examples.

The following example shows the usage of -basepdb <basepdbname> detailed diff report with the -diagoption:

6.15 Generating PDB comparison report 35

Image 35
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 contentExample 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 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 PDBCross-file analysis options Using cross-file analysisUsage Crossfile=auto Example 15 Specifying the location of object files Enabling warnings selectively Configuring diagnostic messagesDiagnostic configuration options table Suppressing warnings selectivelyManaging warnings in a source file Interpreting selective warnings as errorsDisabling warnings in a macro 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.c$ cadvise report -pdb gzip.pdb +metrics -include inflate.c Generating report for a moduleExample 29 Reporting program complexity metrics $ 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 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 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 issuesConsider 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