User's Manual

NOTE: The combined use of the crossfile=defer and
crossfile=[pdb|module|list|listfile] options are useful in the following situations:
If you want to perform cross-file analysis on a set of object files that is bigger than the set of
object files linked during the application build process, for example, if the application build
creates multiple shared libraries, the default automatic cross-file analysis is done only across
the files specified for each shared-library link command. In such cases, you can also force the
analysis to be done on all the files by deferring the analysis using the -crossfile=defer
option until the whole application is built and then invoking the analysis on all the files in the
PDB, by using the -crossfile=pdb option. Alternatively, you can use -crossfile=list option
to specify object files from a subset of the shared libraries to perform cross-file analysis.
If you want to perform cross-file analysis on a set of object files that is smaller than the set of
object files linked during the application build process, for example, if you want to perform
cross-file analysis on a few object files, you can compile only those object files, get a PDB
with the intermediate representation and then use the -crossfile=pdb option to perform
cross-file analysis. Alternately, compile the whole application with the -crossfile=defer
option and then use -crossfile=list option to do the cross-file analysis on a subset of
object files.
However, do not use the -crossfile=pdb option if the PDB contains diagnostic information of
multiple applications because HP Code Advisor can misinterpret multiple definitions for the same
symbols.In this scenario it is better to use the -crossfile=list or -crossfile=module option
to perform cross-file analysis on a subset of object files in the PDB.
For the -crossfile=list or -crossfile=listfile options, the location of each object file
specified must be one of the following:
Location of an existing object file build during the application compilation.
Location of the object file as it would have been created during the application compilation.
Therefore, an object file does not need to exist (it may have been removed or you may have used
the “-nobuild” option) as long as cadvise and the PDB are used to monitor the compilation that
creates the object file.
Example 15 Specifying the location of object files
cd /tmp
$cadvise -pdb testpdb -crossfile=defer aCC 1.c 2.c 3.c -o objdir/testexec
For cross-file analysis on all the files used to build testexec, run the following commands:
$cadvise -pdb testpdb -crossfile=module:objdir/testexec
Or
$cadvise -pdb testpdb -crossfile=module:/tmp/objdir/testexec
NOTE: To specify the module name as specified with the-o option you must be in the same
directory where the first command was invoked. To invoke cadvise from any other location you
must specify the absolute path of the module. For cross-file analysis on object files 1.o and 2.o,
run the following command:
$cadvise -pdb testpdb -crossfile=list:1.o:2.o
OR
$cadvise -pdb testpdb -crossfile=list:/tmp/1.o:/tmp/2.o
24 Using cross-file analysis