Oovaide User Guide

Created: June 8, 2009 Last update: Nov 18, 2015

Contents


  1. Contents
  2. Quick Start
  3. Oovaide
    1. Setting Up C++ Analysis Projects
    2. Setting Up Java Analysis Projects
    3. Component Diagrams
    4. Zone Diagrams
    5. Class Diagrams
      1. Class Diagram Symbols
      2. Class Diagram Display Options
    6. Portion Diagrams
    7. Sequence Diagrams
    8. Include Diagrams
    9. Editing SVG diagrams
    10. Complexity Analysis
    11. Member Usage Analysis
    12. Duplicate Code Analysis
    13. Code Test Coverage System
  4. Build System
    1. Build Features
    2. Build Quick Start
    3. Cross Compiling
    4. Resolving Include Problems During Analysis
      1. Windows Include Problems
    5. Linux Example
    6. Windows MFC Example
    7. Windows GTK Example
    8. Build Sequence
    9. Project Limitations
  5. OovEdit

Quick Start

To work with the examples, see examples.

  1. Use File/New and create a new Oovaide project using an existing or new C++ project. There are example source projects in trunk/examples.
    1. select a new directory for source files, or an existing directory that is the root directory of existing source files.
    2. select an output project directory to store oov project files.
  2. OR: Use File/Open and open the trunk/test/trunk-oovaide-win or trunk/test/trunk-oovaide-linux directory.
  3. At this point, it may be possible to view diagrams if the include paths are set. They are already set if the oovaide project was opened. Select Analysis/Settings and select the C++ Settings tab to change the include paths and compile and link settings. Note that the include and library paths can both be set using the External Project Packages button, or recursive searches using "-ER". See the Build System section for more information.
  4. Build a project. These steps are not required for viewing diagrams. Building Oovaide requires CLang and GTK to be downloaded and to match the paths in the Analysis/Settings/C++ Settings.
    1. Select Build/Settings and set the component type for each component. For the Oovaide project, the oovCommon and oovGuiCommon components are static libraries, and all other oov... components are executables.
    2. Select Build/Build Debug to build a debug version of the project.

Oovaide

The Oovaide program performs many types of analysis on a selected set of source code.  Setting up a new project requires selecting the root directory that contains the source code.  Then Oovaide scans the directories for include and source files.  There are many types of diagrams to allow viewing different levels of code.

View Diagram Type Name Description
Many
Classes
Zone Zone diagrams show all classes in a project and their relations.  Each class can be shown as a dot so that thousands of classes can be viewed on a single diagram. Filtering can be applied to view smaller subsets of classes.
Directories Component Component diagrams show the relations between components.  Examples of components are libraries or executables. Component diagrams requires that certain directories have a component type defined for them.
Few Classes Class Class diagrams show a few classes since the interface of each class is displayed.
Class Parts Portion Portion diagrams show member data, and relations between functions and the member data.
Class Methods Sequence or Operation Sequence diagrams show conditionals (if or loop constructs) and calls to other class methods.
Include Files Include Include dependency diagrams show which include files are used by other include files.

The Oovaide program also allows collecting analysis information from a project.

Analysis Tool Description
Code Coverage This displays how often each block of code was executed, and the percentage of code executed in each module.
Code Complexity This displays both McCabe and Oovaide complexity.
Duplicate Code All code is compared to find the number of lines that are similar to other places in the code.
Project Statistics This displays the number of files, classes, operations, etc.
Line Counting The number of code lines and comment lines are counted for each module.
Member Usage The usage of each class member is displayed.


Setting Up C++ Analysis Projects

Anlyzing projects allows viewing zone, class and sequence diagrams. It is also the first step towards building projects and running code coverage.

  1. Start the "oovaide" program
  2. Use File/New to create a new project
  3. The Project Settings dialog will appear that allows choosing the source root of the source files to analyze. The location can be specified for saving all of the project files for Oovaide. Files can be excluded from analysis. This can also be changed later.
  4. Select the Analysis/Settings menu item. Choose the "C++ Settings" tab to change the include paths and other compiler settings. Errors during compilation are stored in the project directory. If there are errors, change the compiler settings and restart analysis.See the Build section for more examples.
To open a previously saved project, select File/Open and specify the previously saved Oovaide project directory. The build user guide is at Oovaide Build Help

Setting Up Java Analysis Projects

A JDK must be installed. The JAVA_HOME environment variable must point to the JDK root. For example, JAVA_HOME="C:\Program Files\Java\jdk1.8.0_51".

To analyze java source code, follow the steps for analyzing C++, but don't set up any analysis settings.

Some current limitations are:

Component Diagrams

Component diagrams are similar to UML (Unified Modelling Language) component diagrams. A component diagram displays components such as static or shared libraries and executables. When the Comp tab is clicked, the component diagram for a project is generated automatically.

Any component that has the Component Type defined in the Build Settings dialog will be displayed. In addition, the components that are defined in the Analysis/Settings C++ Settings dialog using the External Project Packages will be displayed. The analysis will figure out the dependencies and the dependency arrows will also be generated automatically.
  1. The components for a project are displayed in the left pane in the "Comp" tab. The components list is a list of the source files for the project.
  2. After the Component Types have been specified in the Build/Settings dialog, and the analysis has been run, then clicking on any component in the components list will update the diagram and show the dependencies between the run-time components.
  3. The components can be moved by clicking and dragging the components.
  4. Right clicking on a component allows:
    1. Remove Component - Removes the component from the diagram
    2. Show Implicit Relations - Shows relations between all components
    3. Relayout - Repositions the components
    4. Restart - Adds all removed components.

Zone Diagrams

A zone diagram displays all classes in the project in a circle diagram where all classes are layed out on the circumference of the circle.  Any two classes that are related will have a line drawn between them.
  1. The zone diagram component (directory) list/tree allows selecting which components are displayed on the diagram.
  2. Right clicking on the component list allows:
    1. Hide All, Show All - Hiding or showing all components
    2. Hide Children, Show Children - Hiding or showing all components that are children of the selected component
    3. Map Path - This allows combining directories into a single directory for the graph. For example, mapping /usr/include to /inc-lib and /usr/lib to /inc-lib, will combine both directories into one component in the graph. Child components with unique names are listed separately.
  3. Right clicking on the graph allows:
    1. Go To Class - Displays the class diagram for the selected class
    2. View Source - Displays the source code for the selected class
    3. Show All Classes - Showing all classes or just showing components
    4. Show Function Relations - Shows classes as related if a class has a member function that uses another class.
    5. Show Dependencies - Displays an arrow at the end of a relationship. The arrow end is the end that is the supplier and the non-arrow end is the consumer.
    6. Zoom In/Out - Zoom the diagram

For more zone diagram information, see Zone Diagrams.

Class Diagrams

Class diagrams are similar to UML (Unified Modelling Language) class diagrams. They display the members of the classes and relations between classes.

  1. The classes for a project are displayed in the left pane in the Class tab. Left click on a class to display a diagram of related classes with standard relations.
  2. Right clicking on a class in the class list will display a popup menu that adds the selected class with standard relations. Adding a single class will not relayout the diagram.
  3. Left click on a class in the diagram and drag the cursor to the desired location to move a class.
Right clicking on a class in the diagram allows

Class Diagram Symbols

So what are circles and V shapes doing on the drawings? Don't worry, they can be turned off if desired. These extra Oov symbols are used to provide quick visibility into other relations that are not displayed on standard UML diagrams. The goal is to find and show as many relationships as possible on the diagram for quick understandability and verification of the code.

(See the screenshots to see examples.) The enhanced symbols are:

The other symbols are standard UML symbols.

Class Diagram Display Options

  1. Select the Analysis/Settings menu item.
  2. Choose the "Draw Options" tab and check or uncheck the various options. These options do not change how classes are added to the diagrams.

Portion Diagrams

Portion diagrams show the data members of a class, and show the operations that are related to each data member.  These diagrams make it easy to visualize a class's composition to allow for refactoring or for understandability.

For more portion diagram information, see Portion Diagrams.

Sequence Diagrams

Sequence or operation diagrams are similar to UML (Unified Modelling Language) sequence diagrams. They display the member functions of the classes, and some detail of the members and relations to members in other classes.

Sequence diagrams are only slightly modified from standard UML diagrams. The guard conditions are not shown on each arrow, but are instead shown on the lifeline blocks. This prevents duplication of the condition for each operation call, and is still very easy to read for someone that is used to UML.
  1. Selecting a class in the class list will change the operations in the Operations (Oper tab) list. Clicking on an operation will display the sequence diagram for the operation.
  2. Selecting an operation from the operation list will display the contents of the operation.
  3. Right clicking on the sequence diagram depends on whether a class or operation is clicked on. Right clicking allows:
    1. Go To Operation - Displays a new diagram for the different operation.
    2. Add Calls - Expands the selected call to show the child calls
    3. Add Callers - Shows the operations that call the selected operation.

Include Diagrams

Include diagrams show the relationships between the include files.

Editing SVG diagrams

  1. Use File/Export Drawing As to save an SVG file. An SVG file is a vector graph that most web browsers can display. Whichever drawing is displayed will be saved.
  2. Download Inkscape from inkscape.org
When using File/Export Drawing As, the file's default location will be to save to the project directory.

Complexity Analysis

Code complexity is a measure of complexity for each function.  The purpose of the measure is to help to determine the amount of testing required for various functions.  Higher numbers indicate that more testing must be performed.

  1. After the analysis has been performed, select Analysis/Complexity to update the complexity information for each source file.
For more complexity information, see C++ Complexity.

Member Usage Analysis

  1. After the analysis has been performed, select Analysis/Member Usage to save usage information about members.  This shows the number of member functions of a class that use each class member attribute.

Duplicate Code Analysis

  1. Turn on duplicate code analysis by adding -dups to the Analysis/Settings/C++ Settings/Analyze/Extra Build Arguments
  2. Delete any existing analysis directories in the Oovaide project using the clean menu item so that a complete analysis is run.
  3. Run Analysis/Analyze
  4. Run Analysis/Duplicates

For more information, see Duplicate Code.

Code Test Coverage System

  1. Running Coverage/Instrument will create an "oov-cov" directory that contains a copy of all source files and modifies them so that they include coverage counting software. It copies the oovaide build files so if the project was built previously, the new project files will automatically build the coverage project when the Coverage/Build menu is run.
  2. Running Coverage/Build will build the coverage project.
  3. Running the coverage project components will update coverage counts.
  4. Running Coverage/Statistics will output a coverage percentage file.
For more coverage information, see Test Coverage.

Build System

The build system is not required to view diagrams.

There must be a set of installed build tools such as clang or GNU. The oovBuilder manages the project source, and is an executable that can be run from the command line. It can be run from the build menu in the oovaide program.

Build Features


Build Quick Start

The examples are a quick way to understand some basic principles. See Examples.
The build user guide is at Oovaide Build Help
The build details are described in Oovaide Build Design.
Note that the Oovaide binary packages do not include a compiler for building.

The following steps can be followed:

The trunk/test/trunk-oovaide directorys show example files for building the oovaide project. This is a somewhat complex project since it uses both Gtk and Clang, and has multiple libraries and executables. Early versions of CLang on Windows required building CLang, and the complex library order for Clang was able to be determined by the build system.

Cross Compiling

The following example shows the use of Ubuntu for cross compiling to an ARM hard float platform. This requires that the gcc-arm-linux-gnueabihf package is installed using apt-get or synaptic:

Resolving Include Problems During Analysis

The Oovaide analysis will often produce usable output even when include files cannot be found, although this may result in missing classes, or methods in sequence diagrams.

Oovaide uses the OovCppParser to perform the analysis, and the OovCppParser uses CLang. Clang has hard coded paths compiled into the analysis binary. Compilers will only search for a certain set of include paths. See the include problems below for more information.

Oovaide produces analysis directories for each set of build arguments.  This is in case the classes may be different for debug or release, etc.

The analysis directories are not kept unique for the clang and GCC compilers. Build argument differences are used to make unique analysis directories. If they are using the same directory, and different include paths are needed, set an argument that is different so that different analysis directories are used.

Windows Include Problems

Things can be difficult especially on Windows since Oovaide by default uses CLang for analysis, and can use either CLang or the gnu compiler for builds. The gnu compiler is available from the MinGW, MinGW-builds or MinGW-W64 projects. The old MinGW-builds project has now been incorporated into MinGW-W64. MinGW-builds or MinGW-W64 is required to build Oovaide instead of mingw because it supports C++11 threading.

The gnu compiler will normally find include and library paths since the compiler searches paths relative to the g++ directory. The CLang compiler will find many mingw paths, but does not find paths for Mingw-W64.

Switching between the packages often requires nothing more than changing the path environment variable or setting the compiler name in the Oovaide Analysis/Settings/C++ Settings dialog.

CLang normally finds mingw by searching for default paths, but does not find mingw-w64. For this reason, mingw-w64 is defined as a package that can be included in the Analysis/Settings/ menu in the C++ Settings tab using the External Project Packages button.

So there are a few usage scenarios:


If the compiler cannot find a standard library file, then it isn't finding the file in its include directories. To view the CLang or GCC compiler include paths, use the -v option in the Oovaide Analysis/Settings/C++ Settings.

The typical location for mingw is in the \MinGW directory. CLang supports the following MinGW installations on Windows.

CLang Version
MinGW Versions Supported
CLang 3.4 4.5.0, 4.5.1, 4.5.2, 4.5.4, 4.6.0, 4.6.1, 4.6.2, 4.6.3, 4.7.0, 4.8.1
CLang 3.5 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.8.0, 4.8.1, 4.8.2


Linux Example

This is an old Linux example. The best method currently is to load the required packages in the Analysis/Settings/C++ Settings tab.
For Linux, the following arguments work to build all Oovaide components with the CLang compiler. These arguments will build the complete oovaide project on Linux when the component types are set in the components tab. This is how the arguments may look in the Analysis/Settings/C++ Settings dialog.
	-c
-std=c++0x -ER/usr/include/gtk-3.0
-ER/usr/include/glib-2.0 -I/usr/include/c++
-ER/usr/include/cairo -ER/usr/include/pango-1.0
-ER/usr/lib/x86_64-linux-gnu/glib-2.0 -ER/usr/include/gdk-pixbuf-2.0
-ER/usr/include/atk-1.0 -ER/usr/lib/x86_64-linux-gnu!libmcheck!libieee -ER/home/dave/software/oovaide/2.0/clang+llvm-3.2!libclang_rt -lnk-static-libstdc++
-lnk-Wl,-rpath=./
-lnk-rdynamic

Windows MFC Example

This example may compile with errors, but allows much of the analysis to occur correctly. Note that _M_IX86 cannot be used with the CLang compiler since it does not handle inline assembly. Much of the analysis still works even though the target is incorrect.

Base Build Arguments
-c
-x
c++
-fms-extensions
-fmsc-version=1500
-ferror-limit=3000
-D_M_IA64=1
-D_WIN32_WINNT=0x0501
-D_MSC_VER=1200
-D"WIN32"=1
-D="_WINDOWS"
-D_ALLOCA_S_MARKER_SIZE=8
-IC:\Program Files\Microsoft Visual Studio 9.0\VC\include
-IC:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include
-IC:\Program Files\Microsoft SDKs\Windows\v6.0A\include 

Windows GTK Example

This is an old Windows example. The best method currently is to load the required packages in the Analysis/Settings/C++ Settings tab. For Windows, the following arguments work to build all Oovaide components with the g++ compiler.

Base Build Arguments
-c
-ERC:/Program Files/GTK+-Bundle-3.6.4 -IC:/Program Files/LLVM/include
-lnk-LC:/Program Files/LLVM/lib -lnk-lpthread
-lnk-lpsapi
-lnk-limagehlp
-lnk-mwindows
-lnk-llibclang

Extra Analysis Arguments
-x
c++
-std=c++11
Extra Debug Arguments
-O0
-g3
-std=c++0x
Extra Release Arguments
-O3
-g3
-std=c++0x


For Windows, the arguments may look something like this when compiling with clang++ 3.2. The only problem is that clang 3.2 does not export symbols in the object files, so the link with GTK fails.
	-c
-std=c++0x
-ERC:\Program Files\GTK+-Bundle-3.6.1 -ERC:\Dave\Mine\software\oovaide\clang+llvm-3.2

Build Sequence

The detailed sequence of the build is:

Project Limitations

There are some limitations on projects. The basic rule is that a directory can be defined as a component and all source files that are contained in that directory or other child directories of that directory will be used to build the component. The include files can be in any child directory, and will be found automatically.

If multiple directories are used to build a component that are not under one directory, it is possible to create many static libraries. Oovaide will determine static library link order automatically.

The following directory structure will be used to describe projects that can be supported.

Some of the rules are:

If "Dir A" is defined as a component type other than Undefined, then it will use all source in "Dir A" and its children to build the component. OovAide searches down the tree until it finds a component, and then does not include anything under the directory that is defined as a component. Some examples are listed here:


There are also these limitations.
There are some problems using llvm/clang 3.2 on Windows or Linux. The build tool will attempt to use tools that are known to work. CLang 3.4 may not have these problems.

OovEdit

The OovEdit program is a simple text editor. It has the following features.
  1. C++ syntax highlighting using CLang
  2. Code completion using CLang
  3. Debugging using GDB
  4. Find/Replace
  5. Find in files
  6. Undo/Redo
  7. Copy/Paste
  8. Find forward or reverse, and case sensitive or insensitive