Page tree
Skip to end of metadata
Go to start of metadata

A difficulty that you may find when analyzing C and C++ source files is that important information needed for the analysis is specified at compilation time and Kiuwan Local Analyzer can't know about this in advance. This important information is:

  • Where header files used in the source code are located.
  • Which macros are defined at compilation time.

Here we will see how Kiuwan Local Analyzer can automatically resolve this configuration to get a complete reliable analysis.

You can also find usefull and step-to-step guide on how to configure C/C++ analysis in the following posts of Kiuwan Blog

  1. Analyzing C and C++ with Kiuwan
  2. C/C++ analysis with Kiuwan, part II

Inspecting build logs

Kiuwan Local Analyzer can inspect C and C++ build log files to automatically resolve headers and macros used in your source code.

Follow this steps to configure Kiuwan Local Analyzer by inspecting your build logs:

  1. Run the build tool (make, nmake, imake, MSbuild, scons, etc.) for the software to analyze and dump the build output to a log file. Make sure that build runs with clean dependencies. You may set the -n flag to make to build without executing compilation scripts and to ensure that commands are dumped. Examples:
    1. make clean && make -n > build.log
    2. nmake /N clean all > build.log
    3. msbuild /nologo /t:rebuild MyProject.proj > build.log
    4. scons -Q -n > build.log
  2. Open Kiuwan Local Analyzer, log in, select the application to analyze and set a source code folder.
  3. Select the language to analyze (C or C++) and click the "Configuration" button.
  4. In the "Analysis Configuration" tab, select the analysis language in the "Select block" dropdown (C or C++).
  5. Click on the "Details" button in the "Analyze build logfile" row.
  6. Browse the generated build log file and click "Analyze".

The selected build log file will be analyzed to resolve used headers and macro definitions. Once the build log file analysis is done, a results window will be shown:

Follow these steps to apply the found information to your configuration:

  • Click on "OK" button to update the header and macro configuration with the found data.
  • You can check that the "Header directories" and the defined macros will have been updated with the new information.
  • Click on "Save" button to apply the configuration to your application (or globally).

You can also click on "Cancel" button if you want to analyze again a log file, change the log file or not apply the found information to the current configuration. Note that the configuration will not be saved until you click on "Save" button in the main configuration dialog.

Now you can click on "Analyze" to analyze your C or C++ application with the new header and macro definitions.