# Presentation: 704947

## Software Interface Analysis Tool for C/C++ (SIAT C++)A Static Code Analysis / Understanding Tool forVerification & Validation and Systems Assurance

- NASA Software IV&V Facility
- 100 University Drive
- Fairmont, WV  26554

- Phone:  304-367-8258
- Fax:  304-367-8221
- Email:  mark.suder@titan.com

- This project was funded in part by a Center Software Initiative for the NASA Software Independent Verification and Validation Facility

- Mark Suder
- Senior Systems Engineer
- IV&V Tools and Technologies Group
- Titan Systems Corporation
- Civil Government Services Group

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Hi, my name is Mark Suder and I am going to present a tool that is being developed by Titan Systems Corporation for NASA at the NASA Software IV&V Facility in Fairmont, WV.

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Breaker page.

## Why is SIAT C++ Significant?

- Provides an engineering code analysis tool with no client side licensing costs (analyst’s web browser is the client)
- Allows analysts to perform analysis of:
- Dataflow
- Dependencies
- Control flow
- Error Handling
- Etc.
- Focused on IV&V / System Assurance needs, not software development needs

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Stress that the only requirement of the user’s machine is a web browser.
Assists in code analysis
We are building a tool to help IV&V / SA analyst’s to more easily comprehend and analyze developed code in order to find problems, questionable practices, etc.

## Why is SIAT C++ Significant?

- IV&V / SA maintain control of the tool so that specialized IV&V / SA process improvement extensions can be quickly incorporated
- Can be tailored to satisfy new IV&V / SA needs
- Provides an IV&V analyst knowledge base
- Integrates code analysis capabilities not known to exist in any single COTS product

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
As best practices for using the tool or for other concepts that could be integrated into the tool are determined, we can modify the tool to support them.  For example, the ability to add analysis notes to a particular line in a source file and then return to that line and note.  This will support collaboration by analysts, team knowledge retention, and issue tracking.
Few tools do dataflow.  None known also have a web interface and no client side licensing/cost/requirements.  Analysis notes will be a feature unique to SIAT.

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Breaker page.

## What Benefits does SIAT C++ Offer?

- Code analysis / sustaining engineering / external interface analysis productivity multiplier
- Helps quickly focus analysis
- Example:
- 100 KLOC system – trying to verify that several variables  are set correctly
- Question:  What data influences these parameters?
- SIAT Answer:  Data flow will show you!!
- Analyst does not have to waste time looking at unrelated items

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Productivity multiplier.  Stop wasting time using grep or find to locate all instances of some symbol in the code (and then having to filter unrelated matches).

## What Benefits does SIAT C++ Offer?

- Improve code analysis / sustaining engineering / external interface analysis quality
- Automates error prone tasks
- Eliminates human error by producing complete result sets with no unrelated results
- Allows analyst to add notes to source code lines to track comments / issues / ideas
- In the 100 KLOC system example above
- Tool insures complete analysis
- Analyst is not left wondering if they found all instances

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Quality enhancer.  Let’s automate what we can so that we won’t make inadvertent human errors.

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Breaker page.

## What does SIAT C++ do?

- Performs static code analysis of code written in the C or C++ programming languages
- That is, what can we find out about the code without running it?
- How can we summarize what we find so that the code analyst’s job is easier?
- Presents the results based on requests by the analyst through their web browser

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Analyzes C and C++ source code.
Analysis is static.
Analyst interface is just a web browser.

## SIAT Renders Source Code as DHTML

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
All symbols (filenames, macros, functions, variables, types) are hyperlinked – either jump to definition of what they reference or bring up menu of analysis that can be performed on the symbol.
Syntactic/semantic coloring:
Blue is keywords and filenames
Purple is preprocessor statements
Brown is functions/methods
Yellow is variables
Red is types
Green is punctuation
Black is constants
CTOR = constructor for the object is called
DTOR = destructor for the object is called

## SIAT Shows Data Flow

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Note:  This slide is animated – left picture always exists, then arrow appears, then right picture appears.
Data flow example:
Suppose we want to determine what variables can affect the value of the data member origx of the class Shape.
Clicking on origx in the source code view brings up a pop-up menu from which we can select “Show Data Flow Graph”.
This causes a new page to appear with the data flow graph for origx shown.  In this case, we are only showing the textual version of the graph and are only showing a part of the “Who Assigns To Me” graph.  Note that the file, line, and column location where the effect occurs is shown and hyperlinked to that location in the source view page.  There is also a “Who I Affect” graph and these graphs are both shown in a graphical (box and arrow) form as well.

## SIAT Shows Dependency Data

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Note:  This slide is animated – left picture always exists, then arrow appears, then right picture appears.
Dependency example:
Suppose we want to determine what files are required by the file compound.h (For example, compound.h contains a definition of the class CompoundShape.  What classes does CompoundShape depend on?  They must be defined in one of the files compound.h is dependent on.)
Clicking on compound.h in the source code view brings up a pop-up menu from which we can select “Show Dependency Graph”.
This causes a new page to appear with the dependency graph for compound.h shown.  In this case, we are only showing the graphical version of the graph and are only showing a part of the “Who I Depend On” graph.  Note that the boxes in the diagram are hyperlinked.  Clicking on them will bring up the appropriate header file in the source view page.  There is also a “Who Depends On Me” graph and these graphs are both shown in a textual (indentation replacing the arrows to show dependency) form as well.

## SIAT Shows Error Handling

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Note:  This slide is animated – left picture always exists, then arrow appears, then right picture appears.
Error handling example:
Suppose we want to determine what try statements occur in the source code.
Clicking on Find -> Find Construct -> Try in the menu bar of a SIAT web page will cause SIAT to go locate all the try statements and cause a new page to appear with the results.
This new page will list all of the try statements in the source code.  The list describes the file, line, and column location of the try statement and provides a hyperlink (“try”) to take you to that location in the source code.

## SIAT Shows Call Graphs

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Note:  This slide is animated – left picture always exists, then arrow appears, then right picture appears.
Call graph example:
Suppose we want to determine what functions the main function of the program calls.
Clicking on main in the source code view brings up a pop-up menu from which we can select “Show Call Graph”.
This causes a new page to appear with the call graph for main shown.  In this case, we are only showing the textual version of the graph and are only showing a part of the “Call Graph” graph.  Note that the called function is shown and hyperlinked to its definition in the source view page.  There is also a “Caller” graph and these graphs are both shown in a graphical (box and arrow) form as well.

## SIAT Hyperlinks Symbol Reference to Definition

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Note:  This slide is animated – left picture always exists, then arrow appears, then right picture appears.
In this example, the variable c is being declared to be of type Canvas.  But what is the type Canvas?  This reference to the type Canvas is a hyperlink.  Clicking on the hyperlink causes the definition of Canvas to be brought up in the source view page.

## SIAT Shows Symbol References

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Note:  This slide is animated – left picture always exists, then arrow appears, then right picture appears.
Symbol references example:
Suppose we want to determine where the class type Canvas is referenced in the source code.
Clicking on Canvas in the source code view brings up a pop-up menu from which we can select “Find References” and then the “All” submenu option.  This causes a new page to appear with a list of all places where Canvas is referenced to be listed.  This list describes the file, line, and column locations of each reference to Canvas and provides a hyperlink (“referenced”) to take you to that location in the source code.

## SIAT Tracks Analyst Notes

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Note:  This slide is animated – top left picture always exists, then left arrow appears, then bottom picture appears, then right arrow appears, then top right picture appears.
Analyst Notes example:
Suppose we have previously attached notes or bookmarks to certain lines in the source files.
Clicking on Bookmarks in the Menu Bar of any page will bring up a new window that lists all the analyst notes or bookmarks that have been previously attached.  Hovering over a particular analyst note or bookmark will show more information about it in the bottom half of the page, for example: Name, Library, Description, and Source Text.
Clicking on a particular analyst note or bookmark will then causes the particular file and line to be brought up in the source view page.
An analyst note can be deleted by clicking on the red X next to it.  An analyst note can be edited by clicking on the pencil and paper icon next to it.
Note that analyst notes or bookmarks are originally created by clicking on a hyperlinked line number in the source view page.

## What does SIAT C++ do?

- And more... Summary:
- Graphs
- Data flow, type hierarchy, function call, file dependency
- Cross reference results
- Symbol references, symbol usage, symbol modification, symbol declarations, symbol definition
- Find
- Strings, regular expressions – in all source, code only, comments only
- All constructs – class, struct, base class, derived class, union, pointer, try, throw, catch

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Graphs – Covered all except type hierarchy (inheritance)
Cross reference results – Symbol usage and modification are the same as all references, except only the usages or modifications (respectively) of the symbol are displayed.  Symbol declarations is also a menu option and will show all locations where the particular symbol is declared (there can only be one definition, but there can be multiple declarations).
Find – Only covered try constructs.  The other constructs work the same.  Strings and regular expressions (pattern matching) are similar to finds/searches in many other tools. 

## What does SIAT C++ do?

- More coming (Version 2.1)... Summary:
- Shared analyst notes
- Sharing the knowledge base
- Team collaboration
- Threaded discussion using shared analyst notes
- Discussion of comments and findings
- Preserved for later review

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Even more collaboration!!

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

## Who is using SIAT C++?

**Who is using SIAT C++?**

- Usage of SIAT C++ on IV&V Projects – GFY 2002

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

## How Does It Do That?

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

## Host Platform Requirements

- Server (SIAT C++ Host Machine)
- Sun server running Solaris 2.5.1 or higher
- Netscape Enterprise Server 3.5 or higher
- Client (Software Analyst’s Host Machine)
- Desktop Machine with network connection
- Netscape Navigator 4.5+
- Internet Explorer 5+

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Main point:  An analyst using SIAT C++ ONLY needs to have a network connection and a web browser.
Also, the server is a Sun Solaris server with the NES web server.

## Client / Server System Architecture

- Server
- SIAT C++ Analyzer
- Front End Compiler Executable
- Custom Perl/UNIX shell scripts
- SIAT C++ Engine
- One session/process per analyst
- Custom C code application
- Netscape Enterprise Server
- COTS Web Server
- DSM - Custom C code plug-in (for session management)
- Client
- Web Brower
- Netscape Navigator 4.5+
- Internet Explorer 5+

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
The SIAT C++ Analyzer is run ahead of time when the code being analyzed is “installed”.
All other parts are run when the analyst is actually analyzing the code.

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Breaker page.

## Usage Constraints/Limitations/etc.

- Can only process C/C++ code
- Code being processed must be syntactically correct with respect to the current standards
- Symbol declarations/definitions _can_ be absent (missing header files)

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
There is an Ada code version as well, but they are two separate tools.
The compiler front end can recover from some syntax errors, but the section of code with the error will not have the correct hyper linking/syntax coloring.
Header files can be missing – this makes it easier to analyze some sets of code.  However, there is some information loss – multiple references to a symbol which is not declared will not be understood to reference the same symbol.  There is a tradeoff here.

## Accessing SIAT C++

- New users
- Get approval from the appropriate NASA project manager for source code access – sign non-disclosure agreement if necessary
- Determine and coordinate funding mechanism to fund setting up new user access (a couple of man hours)
- Notify IV&V Tools and Technologies team of authentication information (current: IP address; future: username/password)
- Coordinate with IV&V Tools and Technologies team and appropriate Fairmont SIAT C++ server/network administrators to get firewall authentication access

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

## Accessing SIAT C++

- New projects
- Get approval from NASA personnel controlling SIAT C++ server to install a new project
- Determine and coordinate funding mechanism to fund installation of new project (a man week or so of effort)
- Provide project source code to IV&V Tools and Technologies team
- Be available to answer questions regarding parsing/configuring project source code in SIAT C++
- Plan ahead – work with IV&V Tools and Technologies team with respect to when installation can be completed
- See “New users” section if you don’t currently have access to SIAT C++

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

## Point of Contact

- Randy Hefner
- Project Manager
- IV&V Tools and Technologies Group
- Titan Systems Corporation
- Civil Government Services Group
- NASA Software IV&V Facility
- 100 University Drive
- Fairmont, WV  26554

- Phone:  304-368-2244
- Fax:  304-534-3671
- randy.hefner@titan.com

- Office of Safety and Mission Assurance - Software Assurance Symposium

- September 4-6, 2002

**Notes:**
Randy Hefner is the manager of the group I work for.