Blog

Latest Build – 733

July 29th, 2014

Latest Changes:

(Build b733) – 26 Jul 2014

CODECHECK

  • Added MISRA 2008 rule 7-1-1 and All Check unmodifiedVariablesShallBeConst.upl.
  • Added both strict and fuzzy versions of MISRA 2008 rule 6-6-4 and All Check noMoreThanOneBreakOrGoto.upl.

GENERAL

  • Added an option to the Entity filter to show function parameters.
  • Scheduled Activities Updated to include the option of running every X minutes. Added a suppression option for the message box and made sure that Rescan Watched Directories is a schedule activity and added the specifics (files added/removed) in the scheduled activities log.

GRAPHS

  • Fixed memory leak in graph export to Visio XML for nodes containing multiple lines.

STRICT_PARSER

  • Improved support for record template specializations. Previously they were represented as re-declarations of the specialized template. Now they are represented as distinct entities with a new ‘specialize’ reference back to the specialized template.

VISUALSTUDIO

  • Fix additional problem with processing MSVC 2013 user macros.

                                                            Build Notes

                                                            Grab it at www.getunderstand.com

                                                            Perforce User Tool

                                                            February 20th, 2014

                                                            User Andrzej has shared his User Tools for performing Version Control operations in Understand. Similar to our posts on using SVN and CVS commands in Understand.

                                                            To install just go to Tools->User Tools->Import

                                                            Thanks Andzej!

                                                            Download

                                                            Windows 8.1 Supported

                                                            November 18th, 2013

                                                            We finished our official testing this morning and are happy to announce support for Windows 8.1. Our testing was done with Understand 3.1 build 694 – however earlier builds of Understand will probably work just fine.

                                                            Jenkins Plugin

                                                            August 23rd, 2013

                                                            One of our partners has written a report plugin to integrate with Jenkins. They have asked us not to post the code online, but if you are interested and your maintenance is current, let us know and we can send you the plugin. – support@scitools.com

                                                            jenkins

                                                             

                                                            Here are some notes/details about the plugin from one of our customers:

                                                             

                                                            The plugin gives you a GUI front end to pick some options

                                                            jenkins1.jpg

                                                            Path to source works for workspace relative
                                                            Path to configuration works for absolute (good if sharing a config across multiple jobs)

                                                            ———————————
                                                            When the job runs, there are a few lines in console (so you know something happened):
                                                            [workspace] $ cmd.exe /C und create -db foo_cc.udb -languages c++
                                                            [workspace] $ cmd.exe /C und add src/ foo_cc.udb
                                                            Files added: 1
                                                            [workspace] $ cmd.exe /C und analyze foo_cc.udb
                                                            Files Added: 0
                                                            Files Removed: 0
                                                              C++
                                                                Analyze
                                                                  .jenkins\jobs\foo\workspace\src\src\tbd.cpp
                                                            Analyze Completed (Errors:0 Warnings:0)
                                                            [workspace] $ cmd.exe /C und codecheck -htmlsnippets Z:\Tools\Jenkins\Understand\CodecheckConfiguration.ini build_2014-01-09_11-22-53/codecheckReport foo_cc.udb
                                                            Begin Analysis: Thursday, January 09, 2014 11:23:17 AM
                                                            End Analysis: Thursday, January 09, 2014 11:23:17 AM
                                                            Analysis Summary:
                                                            Files: 1
                                                            Checks: 113
                                                            Violations Found: 0
                                                            Violations Ignored: 0
                                                            Violations Remaining: 0
                                                            ———————————


                                                            When its done, it creates a dir in the workspace:
                                                            URL : jenkins:/view/All/job/foo/build_2014-01-09_11-22-53/codecheckReport/

                                                            Jenkins2.jpg

                                                            There may be no obvious strategy for priority banding the CodeCheck results.  CodeCheck would have to support something for the plugin/parser to key off of.  
                                                            In the past I’ve notionally mapped things like MISRA required/recommended/advisory to HIGH/NORMAL/LOW respectively.   Its less obvious for other checker tree’s.
                                                            You basically need to write your own script (Jenkins -> Manage Jenkins -> Configure System -> Compiler Warnings)
                                                            that parses the .csv and make the data visible to the warnings plugin to get any kind of additional integration.

                                                            Jenkins3.jpg

                                                            I named this "Understand.CodeCheck" since I have sometimes made another pattern to look for analysis log issues
                                                            (e.g. perl issues in Understand, or include path issues in .udb setup)
                                                            And then use that in the job config

                                                             

                                                            Jenkins4.jpg

                                                            you can use a $BUILD variable to get just the latest report in the pattern.  This is why in my script I keep the latest in the workspace, and use the artifact mechanism to preserve per build results….
                                                            To be able to get a report for each build/job

                                                            Jenkins5.jpg

                                                            API Tutorials

                                                            April 24th, 2013

                                                            Diving into the API documentation can be a little overwhelming, so here is a collection of tutorials to get you started.

                                                            Batch Graph Generator

                                                            March 7th, 2013

                                                            The Understand APIs provide a lot of options for automating tedious tasks. I wrote an Interactive Report plugin to automate generating different Understand graphs. For example, this is useful if you need to save the control flow graphs of all functions in a project, or document the Declaration graphs for all classes.

                                                            The plugin also generates an html file to quickly navigate the generated graphs:

                                                            image

                                                            The options dialog lets you pick which graph you want to generate, what format you want the files saved in, and where to save them. You can also specify advanced options that correspond to the options available on the graphs right click menu in the GUI

                                                            image

                                                            You can grab the Batch Graph Generator in the Interactive Reports section of our GUI Plugins Page. You’ll also find installation instructions there. Enjoy!

                                                            Announcing Understand 3.1

                                                            January 3rd, 2013

                                                            With build 642 we’ve added an awesome new feature called Background Parse. It is designed to let you get right to work on your project as soon as Understand opens, instead of needing to wait for the parse. Right away you’ll have access to the Project Browser and Editor windows, and as soon as the parse is finished, everything else will be available.

                                                            Other features added since the release of Understand 3.0:

                                                            Added build system monitoring with buildspy
                                                            Added support for Windows 8
                                                            Improved project building capability
                                                            Improved Visio Export
                                                            Added ability to annotate code

                                                            Creating Accurate C/C++ Projects

                                                            October 30th, 2012

                                                            Last year I posted about Improving Project Accuracy for C/C++ projects. Since then, we have released several new features that make it easier to get accurate project definitions.

                                                            Why do I care?

                                                            The more information Understand has about include paths and macro configuration, the more closely your Understand project will match your compiled code. In most cases, Understand does a great job of parsing the code and figuring out what goes where, but sometimes there are things you don’t expect in your project.

                                                            Some symptoms the project configuration may need to be improved:

                                                            1. Chunks of inactive (pink) code that should be getting parsed but are not:

                                                            image

                                                            2. The same entity shows up multiple times, with some of those definitions unresolved(gray)

                                                            imageimage

                                                            3. Missing entities in graphs

                                                            image

                                                            Strict or Fuzzy Parsing

                                                            image

                                                            Understand now let’s you chose between two different types of parsing when creating C/C++ projects. The fuzzy parse is not as accurate but is great if the code doesn’t compile or for making an initial pass of the project with Understand. The strict parser requires that the include paths and macros be setup correctly, as outlined below, but in return will provide a very accurate parse. Objective-C and Objective-C++ both require the strict parser. Also if your project makes heavy use of C++ or Overloaded functions you will want to use the Strict Parser.

                                                            image

                                                            Choose Compiler Options

                                                            It’s important to double check the Compiler Options and make sure they are set correctly. By configuring the right Compiler details, many Macros, Pragmas and Include Paths are automatically added to the project and increase the accuracy. These settings are accessed under Project->Configure Project->C++ or C++(Strict)

                                                            image

                                                            Automatically Set Includes and Macros

                                                            Depending on your build system, Understand may be able to extrapolate the Include and Macro information automatically.

                                                            Visual Studio

                                                            If you use Visual Studio, you can specify the Visual Studio solution or project files directly and Understand will gather all the information from them.  Those files can be specified during the Project Creation wizard or in Project->Configure Project->Visual Studio.

                                                            GCC/G++

                                                            If your project builds with GCC or G++, you can use the new Buildspy feature to hook into the build system and gather the correct data for the Understand project.  More details on configuring Buildspy here, or there is a video here to get you started.

                                                            CMake

                                                            If your team uses the cross-platform build system, CMake, follow the directions here to create an Understand project as it compiles.

                                                            Import a log file

                                                            If your compiler can generate a log file, it can be imported into an understand project via the command line tool und.  A log file is recognized by the extension “log” and has two available switches.
                                                            -cc        specifies the c compiler
                                                            -cxx       specifies the c++ compiler

                                                            So the command to create a new project, import the log file and analyze it would be:

                                                            > und create -languages C++ add mybuildlogfile.log -cc /usr/gcc -cxx /usr/g++ analyze myUnderstandProj.udb

                                                             

                                                            Manually Setting Includes and Macros

                                                            If your project doesn’t support any of the above options, you can manually configure the Includes and Macros for the project. We’ve added a couple of new tools to identify the missing bits and make this process more intuitive.

                                                            Missing Includes

                                                            Missing include directories can be added in Project->Configure Project->C++->Includes. The new “Search” button opens a dialog that let’s you quickly identify where the missing search files are and add those directories to the include paths for your project.

                                                            image

                                                            Missing Macros

                                                            Similarly, Missing Macros can be added via Project->Configure Project->C++->Macros.  The new “Undefined Macros” button opens a dialog that will let you quickly identify macros that may be missing from the project and you can specify their definitions.

                                                            image

                                                            Overrides

                                                            In some cases, individual files or directories have their own macros and include paths that are different from other parts of the project. These can be specified by going to the file or folder in question in Project->Configure Project->Files. Right click on it, and select Configure override settings. From that dialog you can add the specifics.

                                                            image

                                                            Conclusion

                                                            Understand does a great job of parsing projects “out of the box” but if the project is more complex, there are a lot of options for adding more detail to the project configuration and ending up with a perfect analysis.

                                                            Windows 8 Fully Supported

                                                            October 29th, 2012

                                                            For those that like to live on the bleeding edge, we have tested Understand 3.0 with Windows 8 and they are fully compatible. You can grab the latest build of Understand here.

                                                            Buildspy – For gcc/g++ Users

                                                            July 20th, 2012

                                                            We have added a new feature to this weekend’s build (623) of Understand called Buildspy that allows gcc/g++ users to create an Understand project during the build. Buildspy picks up files, includes, and macros from the compiler so you don’t have to enter them manually. This can save time and improve project accuracy.

                                                            To use Buildspy, you first need to change your compiler from gcc/g++ to gccwrapper/g++wrapper in your makefile or build system. Alternatively, it is possible to override these settings from the command line without having to touch the Makefile using a command like:

                                                            buildspy –db example.udb –cmd “make <additional_Make_Options>”

                                                            buildspy

                                                            You may also need to add the /SciTools/bin/linux32/buildspy directory to your path.Then, starting with a clean build, run:

                                                            buildspy –db path/name.udb –cmd <command to compile project>

                                                            For example:

                                                            image

                                                            This allows Buildspy to receive information from gccwrapper/g++wrapper to build a complete project. The wrappers will then call the corresponding compiler. To change the compiler edit the Buildspy.ini file located at $HOME/.config/SciTools on Linux systems and $HOME/Library/Preferences on Mac.

                                                            image

                                                            The wrappers will work with any compiler that has gcc-like syntax. To finish, simply open the project in Understand and Analyze All. Those tedious includes and macros are now set.

                                                            Cygwin/Windows Users

                                                            We have added support for Buildspy on Windows using Cygwin as of build 633. However, when the buildspy command results in this error:

                                                            gcc – Process failed to start: Access is denied.

                                                            extra setup is required.  Cygwin uses a symlink to access the gcc executable and the actual name of the executable is required in the configuration file.  Trace the symlink until the executable is found in order to get the actual name.  In my case, the executable was named gcc-3.

                                                            gccSymLink

                                                            On Windows, the configuration file is located in C:\Users\<USERNAME>\AppData\Roaming\SciTools and is called Buildspy.ini.  Open the Buildspy.ini file and change the compiler name appropriately.

                                                            buildpyINI

                                                            Once this is done, Buildspy should work as expected.

                                                            Any feedback on this new feature is welcome and appreciated.

                                                             

                                                            Comments are closed on this post but I want to post some helpful feedback from one of our customers using Buildspy (12/6/13):

                                                             

                                                            I thank SciTools for creating buildspy. I have successfully created a project that appears to be accurate for an embedded Linux kernel.

                                                            The steps below allow a consistent approach for a couple different build items. I believe this embedded Linux build could be done more like the description on SciTools web page but some of my other builds worked better using the steps below. I am providing the steps I took in case they will be of use to you or others:

                                                            Created arm-poky-linux-gnueabi-gcc and arm-poky-linux-gnueabi-cpp from gccwrapper and g++wrapper in /opt/Understand/bin/linux64/bu
                                                            ildspy. The arm-poky-linux-gnueabi-gcc wrapper script contents are:
                                                            #!/bin/bash
                                                            export LD_LIBRARY_PATH=/opt/Understan
                                                            d/bin/linux64/buildspy
                                                            ${LD_LIBRARY_PATH}/gccwrapper.
                                                            bin “$@”

                                                            The arm-poky-linux-gnueabi-cpp wrapper script contents are:

                                                            #!/bin/bash

                                                            export LD_LIBRARY_PATH=/opt/Understand-3.1/bin/linux64
                                                            ${LD_LIBRARY_PATH}/buildspy/g+
                                                            +wrapper.bin “$@”

                                                            Appended “.” to the cross-development environment arm-poky-linux-gnueabi-gcc and arm-poky-linux-gnueabi-cpp in the Yocto ./build/tmp/sysroots/x86_64-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi directory.

                                                            Created ~/.config/SciTools/Buildspy.ini with these contents:
                                                            [General]
                                                            ccCompiler=arm-poky-linux-gnueabi-gcc.
                                                            cxxCompiler=arm-poky-linux-gnueabi-g++.

                                                            sourced the Yocto cross-development environment setup script:
                                                            source ./oe*env
                                                            bitbake -c devshell virtual/kernel

                                                            Before running buildspy in the cross-development environment shell, changed the user name in /opt/Understand/conf/license/users.txt to root. Afterwards, restore it to the normal user.

                                                            In the cross-development environment development shell:
                                                            export STIHOME=/opt/Understand
                                                            export PATH=/opt/Understand/bin/linux64/buildspy:${PATH}
                                                            buildspy -db ../../../../../../_kernel.orig.udb -cmd ‘make -B -k -j 4 zImage CC=”arm-poky-linux-gnueabi-gcc  -mno-thumb-interwork -marm” LD=”arm-poky-linux-gnueabi-ld.bfd “‘

                                                            Remember to restore the username in /opt/Understand/conf/license/users.txt and restore the original executable names in the Yocto ./build/tmp/sysroots/x86_64-linux/usr/bin/armv7a-vfp-neon-po

                                                            ky-linux-gnueabi directory.