Technology Industry
Industry: Email Alert RSS FeedThe SoftBench static analysis database
Hewlett-Packard Journal, Feb, 1997 by Robert C. Bethke
The SoftBench static analysis database, Static.sadb, is a repository for generic program semantic information. Within SoftBench the database supports the static analyzer along with graphical editing and rule-based program checking. The data model is relatively general and currently supports C , C, FORTRAN, Pascal, and Ada.
The database also serves as a product and can be customized by the user. Its compiler interface and tool interface are documented and allow the integration of other languages and compilers and the use of custom analysis tools.
The Data Model
Most RecentTechnology Articles
The underlying data is a set of persistent C objects. These objects serve to model the semantics of the program. The underlying persistent objects are isolated by the compiler interface and the tool interface. The isolation has important implications for allowing a variety of compiler integrations and provides flexibility in changing the underlying data management without affecting either the compilers or the tools.
Many of the persistent objects are language-generic (language-insensitive) and are intended to model all similar constructs. For example, a Struct object is used to model C structures and Pascal records. A Function object is used to model functions and procedures in all languages. In some cases, it is necessary to have language-specific objects because the semantics are too specific to apply to other languages. Examples of language-specific objects are C Class objects and Ada Module objects.
Each persistent object is assigned a unique object identifier known as a handle. Given an object's handle, it is possible to query the object by means of methods for relevant information such as its name, list of references, and so on. All associations among the persistent objects are maintained by these handles. For example, the association from a Variable object to its typedef object is maintained by the Variable's having the handle of its typedef as an attribute. One-to-many associations are maintained as a set of handles. For example, a File object will have a set of handles to associate all other source files included by it.
To illustrate associations, consider the following C code:
typedef struct S lint x; int y;} SType;
Stype var;
The associations among the semantic objects in this code fragment are shown in Fig. 1.
[Figure 1 ILLUSTRATION OMITTED]
Container objects are used to model scoping and binding and to organize the semantic objects for efficient updating and navigation. Each container has a set of handles for all objects contained in it and each object contained has the handle of its container. Examples of container objects are Files, Functions, and Classes. A File contains the program constructs defined in that source file, a Function contains its parameters and blocks, and a Class contains its members. For example, Fig. 2 shows the object containment for the following C class definition:
Class cls {
public:
cls (int x) {mem=x;}
private:
int mem;
};
The compiler interface is procedural in style and is intended to be easily added to most compilers. The interface is structured around the creation of objects and the establishment of associations and containment relationships among the objects.
The Tool Interface
From the tool perspective the database supports concurrency control to the extent of allowing multiple readers and one writer. A reader can have up to 256 databases open for reading. The reader must structure queries within a transaction and is allowed to leave the database open while it is being modified by a writer. The reader is notified of a change to the database via a callback when starting a transaction. Nested transactions are not supported.
The tool interface is a class library that reflects the underlying object model. Each persistent object is presented as a handle. Internally, each handle is mapped into a pointer to the real persistent object. All information pertaining to the object is made available via methods. Navigation among objects is supported by methods that return a handle or an iterator over a set of handles. For example, the following is a partial definition of the Symbol class.
class Symbol {
public:
Symbol(PerHandle symbolhandle);
Symbol();
~Symbol();
// Name, kind and attributes of the symbol.
char *Name() const;
PerKind Rind() const;
Attributes Attrib() const;
// Enclosing scopes of the symbol.
DBboolean EnclosingFile(File &file) const;
DBboolean EnclosingBlock(Block &block)
const;
// Iterator to all reference lists for this
// Symbol.
ITERATOR(RefList) RefLists() const;
protected:
PerHandle SymbolHandle;
};
The global SymbolTable is the root for all navigation. This object provides navigation and hashed searching to all globally scoped symbols. The following code segment illustrates how to access all globally scoped functions from the global SymbolTable.
CXO UnpluggedSmart Business interviews on BNET
Brought to you by CBS MoneyWatch.com
- Best- and Worst-Paid College Degrees
- 6 Things You Should Never Do on Twitter or Facebook
- How Much Sleep Do You Really Need?
- 6 Big Myths about Gas Mileage
Most Recent Technology Articles
- INTERVIEW WITH BEN BUTTERS, DIRECTOR OF EUROPEAN AFFAIRS AT EUROCHAMBRES : "A PERFECT ROAD MAP FOR EU CLUSTERS DOES NOT EXIST".
- AGENDA.(Brief article)(Conference notes)
- FIGHT AGAINST INTERNET PIRACY.
- INTERNET : AUTHORS' SOCIETIES URGE ACTION AGAINST PIRACY.
- TELECOMMUNICATIONS : BUSINESSEUROPE HOSTILE TO FURTHER CONTRACTUAL OBLIGATIONS.(Brief article)
Most Recent Technology Publications
Most Popular Technology Articles
- BizRate to monitor in-store customer satisfaction for Office Depot stores - Market Intelligence
- Speed control of separately excited DC motor
- What is precision air conditioning and why is it necessary?
- Effects of creative, educational drama activities on developing oral skills in primary school children
- 3G: naughty or nice? PhoneErotica.com generates over 300 million hits per month, and rings up more minutes of use per month than MSN



