Static Analysis of Exception Handling in Ada

Size: px
Start display at page:

Download "Static Analysis of Exception Handling in Ada"

Transcription

1 SOFTWARE PRACTICE AND EXPERIENCE, VOL. 23(10), (OCTOBER 1993) Static Analysis of Exception Handling in Ada carl f. schaefer and gary n. bundy The MITRE Corporation, 7525 Colshire Drive, McLean, VA 22102, U.S.A. SUMMARY Since the signature of an Ada subprogram does not specify the set of exceptions that the subprogram can propagate, computing the set of exceptions that a subprogram may encounter is not a trivial task. This is a source of error in large Ada systems: for example, a subprogram may not be prepared to handle an exception propagated from another subprogram several layers lower in the call-tree. In a large system, the number of paths in exceptional processing is so great that it is unlikely that testing will uncover all errors in inter-procedural exception handling. Nor are compilers or code inspections likely to locate all such errors. Exception handling is an area where static analysis has a high potential payoff for systems with high reliability requirements. We discuss fundamental notions in computing exception propagation and describe an analysis tool that has proved to be effective in detecting inconsistencies in the exception-handling code of Ada applications. key words: Static analysis Exception handling Ada INTRODUCTION Ada has several powerful features whose goal is to facilitate the development of dependable computing systems. Among these is exception handling. Ada provides specific syntax for detecting, signaling, and responding to extraordinary situations, typically thought of as (but not limited to) situations in which an error has occurred. Unfortunately, the addition of exception handling code often increases the complexity of a system, particularly if the exception handling code does not follow strict guidelines governing the use and handling of exceptions. Although Ada s exception mechanism can facilitate the development of clear and correct code, undisciplined use can result in exceptional control flow paths similar to those created by nonlocal, dynamically-bound gotos. Thus exception handling code can itself be an abundant source of defects. 1,2 Defects are typically detected by code inspections or by testing. However, as Cui 3 points out, the exception handling portion of a system is often the most poorly tested. Perhaps this unfortunate situation reflects the view that the most frequently occurring paths should consume the bulk of the testing budget, inappropriate as this may be for a safety-critical system. Moreover, forcing certain exceptional paths may require elaborate test set-ups (consider, for example, what is required to force the software to detect a hardware error while the software is already responding to a /93/ $14.00 Received 15 October by John Wiley & Sons, Ltd. Revised 30 April 1993

2 1158 c. f. schaefer and g. n. bundy different error). In any case, testing of all exceptional paths, like testing of all nominal paths, is not practical. Inspection does have an advantage over testing: it is generally believed that the cost to fix a defect discovered earlier in the development cycle is lower than the cost to fix same defect discovered later in the development cycle. 4 However, because the propagation of exceptions can be so complex, detection of defects in exception handling code by inspection can be a labor-intensive and error-prone process. Shortcomings of both testing and code reviews are discussed by Parnas. 5 Automated static analysis is a useful complement to testing and code inspections. Because the analysis is automated, it does not require extensive manual effort on the part of the inspector, and because the analysis does not actually execute the code, all control flows can be analyzed. Adherence to a set of guidelines can be verified, and problems with the implementation can be identified and corrected during development, when they are less costly to fix. The output of a static analysis tool need not be absolutely unambiguous to be useful; if the analysis is not refined enough, the tool may cite false positives along with instances that are certainly defects. Even in such cases, the output of the analysis tool constitutes a defined set of red flags which can then be refined by manual techniques. We have found automated static analysis to be useful in identifying defects in the exception handling code of a large Ada system. The next section of this paper describes exception handling in Ada and develops certain notions useful in computing the propagation of exceptions. Following this, we describe a tool for analyzing exception handling in Ada code and discuss the use of the tool to detect violations of application-specific design and coding guidelines. EXCEPTION HANDLING IN ADA Overview Ada 6 provides a means by which a program can respond to the occurrence of some extraordinary situation (an exception) by abandoning the normal flow of control in favor of an alternative flow of control. When the extraordinary situation occurs, the appropriate exception is said to be raised; this initiates the alternative flow of control. Control is passed to a specially designated segment of code called a handler. After the code in a handler has executed, the normal flow of control is resumed. However, normal flow of control resumes from the point at which the handler terminates, not from the point at which the exception was originally raised. Thus, in Goodenough s terminology, Ada exceptions are escape exceptions. 7 Ada predefines certain exceptions; these correspond to extraordinary situations such as division by zero, an illegal array reference, dynamic storage exhaustion, an attempt to open a file that does not exist, and so forth. The Ada run-time system detects the corresponding exceptional situations and raises the appropriate predefined exception implicitly. In Figure 1, for example, if Y 1 X then the predefined exception Constraint Error will be raised on attempting to assign the value X + Y to Y, whose subtype is Positive, and control will be passed to the handler for Constraint Error, causing the message Constraint Error raised to be printed. Exception handlers may occur at the end of a subprogram (as will be explained below, there are other contexts in which exception handlers may occur), after the

3 static analysis of exception handling in ada 1159 Figure 1. Implicit raise of Constraint Error Figure 2. Programmer-defined exception reserved word exception. If procedure P did not have an exception handler for Constraint Error, then the Ada run-time system would search for the most recently activated subprogram on the dynamic call stack that did contain a handler for Constraint Error, and if such a handler were found, control would be passed to that handler. If no subprogram on the dynamic call stack contained a handler for Constraint Error, then the entire program would terminate. Propagation of Ada exceptions will be explained in more detail shortly. Ada also permits a programmer to define exceptions. Programmer-defined exceptions are raised explicitly with the raise statement. The raise statement may also be

4 1160 c. f. schaefer and g. n. bundy used to raise a predefined exception, but this is generally considered poor practice. 8 In Figure 2, procedure Delete Directory may raise the exception Directory Not Empty. In contrast to the previous example, Delete Directory does not contain a handler for Directory Not Empty; it is expected that a caller of Delete Directory will contain an appropriate handler. In general, a handler is part of a handler set; a given exception is caught (named) by at most one handler in any given handler set. Ada also allows the programmer to specify a catch-all handler (written when others), which catches every exception that is not caught by another handler in the handler set. Within a handler and within a block inside a handler, but nowhere else, the simple raise statement, consisting solely of the reserved word raise, is allowed; the effect of the simple raise statement is to reraise whatever exception caused control to be passed to the handler containing the simple raise statement. Figure 3 illustrates the simple raise statement and the when others handler. Computing the set of propagated exceptions We are interested in computing the set of exceptions that a code segment can propagate and in determining what exceptions a handler can propagate when it catches a given exception. For this, we need to develop several basic notions. First, we need a term for a construct whose execution, activation, or elaboration can occasion the raising of an exception; we will call such a construct a chunk. Secondly, we need a relation which specifies the paths along which propagation of exceptions is possible; this is the dynamic parent relation. Thirdly, we need a precise definition of what exceptions a given handler catches. Fourthly, we need a term for the union of all exceptions that can be raised in a chunk and all exceptions that can be propagated to a chunk; this is the encounters relation. Finally, to account for the meaning of the simple raise statement, we define the context of a chunk. With these Figure 3. Simple raise statement

5 static analysis of exception handling in ada 1161 notions, we can define the propagates relation and three relations that determine which exceptions a handler propagates when it catches a given exception: maps, passes, and stops. The Ada language reference manual 6 (ARM) has a term for a construct that can have exception handlers; such a construct is a frame. However, Ada does not have a term for a construct whose elaboration or execution can cause an exception to be raised. We use the term chunk for such a construct. More precisely, a chunk is one of the following: (a) the sequence of statements in a package body, subprogram body, task body or block statement (b) a package specification, a package body declarative part, subprogram declarative part, task body declarative part, block declarative part (c) an accept statement (d) a handler. In Figure 4, each of the boxed segments is a chunk. A1 and B1 are subprogram declarative parts. A2 and B2 are sequences of statements in subprogram bodies. A3, A4, B4, B5, B6, and B8 are handlers. B3 and B7 are sequences of statements in block statements. A handler set is a set of exception handlers associated statically with a chunk by the syntax rules of Ada. In Figure 4, the handler set {A3,A4} is associated with A2. Likewise, {B4} is associated with B3, {B5,B6} with B2, and {B8} with B7. If a chunk has no associated handlers, we speak of the null handler set. By the rules of Ada, the null handler set is semantically equivalent to the following handler set: exception when others = raise; The handler set associated with a package specification, the declarative part of a package body, a subprogram declarative part, a block statement declarative part, an accept statement, or a handler is always the null handler set. The handler set associated with one of the other kinds of chunk may be non-null. Catches is a relation between handlers and exceptions. A handler H catches an exception E explicitly if H names E. InFigure 4, A3 and B5 each catch Channel not available explicitly. A handler H that is a member of the handler set S catches an exception E implicitly if H is the when others handler and if there is no handler in S that catches E explicitly. In Figure 4, A4 and B6 each catch all exceptions other than Channel not available implicitly, whereas B4 and B8 each catch all exceptions implicitly. The actual propagation path of an exception is determined by the previous execution history of the program; however, it is possible to characterize statically the set of possible propagation paths covering all execution histories. For this purpose, we introduce the dynamic parent relation, which holds between chunks. The following cases define the dynamic parent relation: 1. A chunk declaring a package specification P is the (single) dynamic parent of P.

6 1162 c. f. schaefer and g. n. bundy Figure 4. Chunks

7 static analysis of exception handling in ada A chunk declaring a package body P is the (single) dynamic parent of the declarative part of P, the sequence of statements of P, and each handler in the handler set of the package body of P. 3. A chunk containing a call to subprogram S is the dynamic parent of the declarative part of S, the sequence of statements of S, and each handler in the handler set of S. 4. A chunk containing a block statement B is the (single) dynamic parent of the declarative part of B, the sequence of statements of B, and each handler in the handler set of B. 5. A chunk declaring a task object T, or creating a task object T by means of an allocator, is the (single) dynamic parent of the declarative part of T. 6. If a package specification declares a task object T, or creates a task object T by means of an allocator, then the sequence of statements of the package body (if this package body exists) is the (single) dynamic parent of the declarative part of T. 7. A chunk containing an entry call corresponding to an accept statement A is the dynamic parent of A. 8. A chunk (task body) containing an accept statement A is the dynamic parent of A. 9. Library package specifications and bodies, and the main subprogram, have no dynamic parent. In Figure 4, B2 is the dynamic parent of A1, A2, A3, and A4 since B2 contains a call to the subprogram Allocate channel. B2 is the dynamic parent of B3 and B4, since B3 is a block statement contained in B2 and B4 is in B3 s handler set. Likewise, B6 is the dynamic parent of B7 and B8, since B7 is a block statement contained in B6 and B8 is in B7 s handler set. To characterize the set of exceptions that can be active in a chunk, either by reason of having been propagated to the chunk or by reason of having been raised within the chunk, we introduce the encounters relation. If a chunk contains a simple raise statement, then the chunk is a handler or a block statement nested in a handler and the set of exceptions that is raised within the chunk depends on the exception that was caught by the handler. For this reason, encounters is a relation between (chunk, exception) pairs and exceptions, rather than simply a relation between chunks and exceptions. A (chunk, exception) pair (C,E ) encounters an exception E if (a) E is a predefined exception and the Ada run-time system could raise E when executing a statement in C, or (b) C contains a statement of the form raise E; or (c) C contains a simple raise statement ( raise; ) and E = E, or (d) C is the dynamic parent of some chunk C, and C propagates E (the relation propagates is defined below). A chunk that is not a handler and is not inside a handler cannot contain a simple raise statement. In this case, what (C,E ) encounters is not dependent on the context exception (E ). Where encounters is not dependent on the context exception, we may say (C,*) encounters E. In Figure 4, (A2,*) encounters Channel not available since it contains an explicit raise of this exception. Similarly, (A4,*), (B4,*), and (B8,*) encounter Fatal error since each of these chunks contains an explicit raise of this exception. (A3, Channel not available) encounters Channel not available since it

8 1164 c. f. schaefer and g. n. bundy catches this exception explicitly and contains a simple raise statement. Note that the fact that a handler catches an exception does not imply that the handler encounters the exception; in Figure 4, handler B8 catches all exceptions, but it encounters only Fatal error. The simple raise statement can occur immediately in a handler or in the sequence of statements of a block statement nested in a handler. The meaning of a simple raise statement is the intersection of the set of exceptions caught by the most closely enclosing handler and the set of exceptions encountered by the chunk the handler is associated with. To formalize this, we introduce a context of relation between chunks. If C is a chunk in which the simple raise statement is not permitted, then C is the context of itself. Otherwise, C is a handler or C is a sequence of statements in block statement enclosed directly or indirectly by a handler. If C is a handler, then there is a chunk C that is associated with the handler set that C is a member of, and this C is the context of C. IfCis the sequence of statements in a block statement inside a handler, then the context of the (unique) dynamic parent of C is also the context of C. InFigure 4, A2 is the context of A3 and A4; B2 is the context of B5, B6, and B7; B7 is the context of B8; and B3 is the context of B4. For chunks other than A3, A4, B4, B5, B6, B7, and B8, each chunk is its own context. We can now define the propagates relation. First, we give the simpler, special case that applies when chunk C is the context of itself. In this case, C propagates exception E if (a) (C,E) encounters E, and (b) there is no handler in the handler set associated with C that catches E. The more general formulation covers handlers and blocks within handlers, as well as other chunks. A chunk C propagates exception E if there is an exception E and a chunk C such that (a) C is the context of C, and (b) (C,E ) encounters E, and (c) (C,E ) encounters E, and (d) if C is a handler, then C catches E, and (e) there is no handler in the handler set associated with C that catches E. The special case given previously can be derived from the general formulation by letting C = C and E = E. As an illustration of the general formulation, consider that in Figure 4, chunk A3 propagates Channel not available since (a) A2 is the context of A3, and (b) (A2, Channel not available) encounters Channel not available (more generally, (A2,*) encounters Channel not available), and (c) A3 is a handler and A3 catches Channel not available, and (d) (A3,Channel not available) encounters Channel not available, and (e) there is no handler in the handler set associated with A3 (this is the null handler set) that catches Channel not available. It is sometimes convenient to speak of the set of exceptions propagated by a subprogram, including its declarative part, its sequence of statements, and its handlers. Speaking less precisely, we will say that a program unit U propagates the exception E if the declarative part of U propagates E, or the sequence of statements of U propagates E, or any of the handlers in the handler set of U propagates E.

9 static analysis of exception handling in ada 1165 There are three additional relations that are useful in characterizing the behavior of a handler. These are maps, passes, and stops. Maps is a relation between (handler, exception) pairs and exceptions; it characterizes the set of exceptions that a handler can propagate given that the handler catches a particular exception. The (handler, exception) pair (H,E ) maps to E if there is a chunk C such that (a) C is the context of H, and (b) (C,E ) encounters E, and (c) H catches E, and (d) (H,E ) encounters E (being a handler, H propagates what it encounters). Passes is a relation between handlers and exceptions. A handler passes an exception E if it can propagate E when it catches E. More precisely, H passes E if (H,E) maps to E; thus, passes is a subset of maps. Stops is a relation between handlers and exceptions. A handler stops an exception E if it propagates nothing when it catches E. More precisely, H stops E if there is a chunk C such that (a) C is the context of H, and (b) (C,E) encounters E, and (c) H catches E (d) there is no exception E such that (H,E) maps to E. Figure 5 illustrates the basic relations with a compact, though complex, example. The example assumes that the declarations of exceptions E1, E2, E3, and E4 are directly visible. We will sketch the reasoning behind the detailed assertions regarding the handler H4 in Figure 5. Since H4 calls procedure P1, H4 is the dynamic parent of C1, H1, and H2. As a result, since H1 propagates E1 and H2 propagates E3, (H4,*) encounters E1 and E3. In addition, (H4,*) encounters E4 since this exception is explicitly raised in the statements of H4. H4, being a handler and therefore having the null handler set, propagates everything it encounters; hence H4 propagates E1, E3, and E4. To see that (H4,E3) maps to E1, E3, and E4, consider that (a) C2 is the context of H4, and (b) (C2,E3) encounters E3 (more generally, (C2,*) encounters E3), and (c) H4 catches E3, and (d) (H4,E3) encounters E1, E3, and E4. Finally, since (H4,E3) maps to E1, E3, and E4, we may say that H4 passes E3. In addition to the annotations in Figure 5, we may say, less precisely, that procedure P1 propagates E1 and E3, and procedure P2 propagates E1, E3, and E4. With these definitions, it is fairly straightforward to implement algorithms for computing the set of all exceptions that a chunk propagates and all propagation paths. The main challenge is dealing with recursion; this is discussed below, under the heading Implementation details. ANALYSIS TOOL The goal of our analysis is to make it easier to identify defects in exception handling code. A code construct might be classified as a defect because it causes a program to behave incorrectly, or because it makes the program more difficult to maintain,

10 1166 c. f. schaefer and g. n. bundy Figure 5. An example of the basic relations or because it is a violation of a specific set of guidelines. Since computing exception propagation paths by manual methods is tedious and error-prone, the computation would seem ideally suited for automated analysis. However, the construction of such a static analysis tool is itself challenging. Ada has several features, including renaming declarations, operator-overloading, and direct visibility to declarations in external packages ( use-visibility ), that make the semantic analysis of Ada source a complicated task. An Ada compiler must, of course, determine the meaning of each identifier in an Ada program, and some compiler-vendors make this semantic information available through a program interface to the intermediate form produced by the compiler. We used the interface to the intermediate form produced by the Sun TM * Ada compiler. This intermediate form is a variant of DIANA (Descriptive Intermedi- * Sun is a registered trademark of Sun Microsystems, Inc.

11 static analysis of exception handling in ada 1167 ate Attributed Notation for Ada). 9 DIANA is high-level intermediate form; it does not reflect optimizing transformations, and, in general, it is possible to reconstruct the source by traversing the DIANA. However, the meaning of each identifier has been resolved in the DIANA. Although DIANA provides the semantic information needed to compute the relations needed in our analysis, it is not a particularly efficient representation. For the Ada applications we have been analyzing, one line of source text expands to roughly 160 bytes of DIANA. Multiple traversals of the DIANA would be too expensive, whereas packing the entire analysis into a single traversal would complicate the algorithms excessively. We therefore developed a pre-analysis step, in which the information pertinent to exception handling is extracted from the DIANA and stored in a more compact extracted form. For the application code we have analyzed, the extracted form is one-ninth the size of the full DIANA. Logically, the analysis falls into two parts: computation of the general relations described above (dynamic parent, catches, encounters, propagates, stops, maps, passes) and identification of violations of system-specific guidelines (examples of which are discussed below). Our analysis capability generally follows this division: the general relations are computed by compiled code that takes the extracted form as input and produces a number of human-readable files; the system-specific violations are derived from these files using UNIX * utilities (awk, grep, sort, and join). The full process (Figure 6) consists of five steps, the first four of which are automated: 1. Compilation: transforms Ada source into DIANA. 2. Pre-analysis: filters the DIANA, producing the extracted form that contains Figure 6. Analysis process * UNIX is a registered trademark of Unix System Laboratories, Inc.

12 1168 c. f. schaefer and g. n. bundy information pertinent to exception handling. If the source for a system is compiled into multiple libraries, the extracted forms for the multiple libraries are merged into one extracted form at the conclusion of the pre-analysis phase. 3. System-independent analysis: using information in the extracted form, computes relations that are generally useful in analysis of Ada exception handling, producing text files. 4. System-dependent analysis: using the relations in the text files, identifies violations of system-specific design guidelines. 5. Since the automated analysis may, in general, identify some false positives (locations in the code that are not actually defects), some manual verification of the tool outputs may be necessary. In any case, repair of the defects is not automated. Extracted form The extracted form is a directed graph. In general, node and attribute kinds in the extracted form have a close correspondence to DIANA nodes and attributes, but several simplifying transformations have been applied. In particular, DIANA sequences are transformed to sets in the extracted form and each of the following is collected into a single attribute: (a) all explicit raises in a set of statements (b) all calls made in a set of statements (c) all function calls made in a set of declarations. DIANA nodes and attributes not pertinent to an exception handling view have no correspondence in the extracted form. System-independent analysis The analysis tool generates text file representations of the encounters, catches, propagates, maps, passes, and stops relations (the tool computes the context of relation but does not produce a text file representation; to do so would be a trivial modification). In addition, several other text files are generated: 1. A list of each (chunk, exception) pair (C1,E1) such that C1 contains a raise statement that raises E1 (either explicitly or implicitly via the simple raise statement). 2. A list of each (chunk, chunk, exception) triple (C1,C2,E1) such that a declaration in C1 calls a function C2, and C2 propagates E1. This is the case in which E1 propagates from C2 through the declarative part C1. 3. A list of each (subprogram, exception) pair (S1,E1) such that (a) S1 propagates E1, and (b) S1 encounters E1, and (c) S1 does not raise E1, and (d) no block contained directly or indirectly in S1 raises E1, and (e) there is no handler in the handler set associated with S1 that contains an explicit raise of E1. This is the case in which C1 propagates E1 without there being an explicit raise of E1 in the text of C1.

13 static analysis of exception handling in ada A list of each (chunk, chunk, exception) pair (C1,C2,E1) such that C1 propagates E1,C2 calls C1, the declaration of E1 is visible to C1, and the declaration of E1 is not visible to C2. This is the case in which E1 is propagated out of scope. Finally, several text files containing information of a more general sort are produced: 1. A list of each (exception, exception) pair (E1,E2) such that E1 renames E2. 2. A file containing the name, internal identification number, and source location of each chunk and exception. 3. A call tree (the dynamic parent relation less pairs in which a chunk is the dynamic parent of a declarative part or of a handler). Simplifications The goal of our analysis was to identify portions of a program that are causes of incorrect program behavior or that violate design guidelines. However, we did not intend the results of the analysis to drive an automated correction of the software. This allowed us to make several assumptions that reduce the complexity of computation and the completeness of the results, without significantly diminishing the value of the analysis. The tool makes several compromises between completeness of analysis and ease of construction. On the one hand, the tool considers all raise statements in a chunk to be reachable; in this respect the tool is too stringent, since it may find non-existent problems. On the other hand, the tool does not identify all contexts in which an Ada-predefined exception could be raised; in this respect the tool is too lax, since it may fail to find some real defects. The tool does not evaluate static expressions and does not perform dataflow analysis. Furthermore, it treats a sequence of statements as a set of statements. As a result, the tool may assume that a certain chunk raises an exception even if the raise statement is not reachable. For example, a chunk containing the statement if X = X then raise E1; else raise E2; end if; is considered to raise E1 and E2, even though the raise of E2 is unreachable (assuming that X is not a function call with side-effects). Likewise, a chunk containing the sequence raise E1; raise E2; is also considered to raise E1 and E2, even though the raise of E2 is not reachable. Correctly identifying each potential raise of an Ada-predefined exception would require a sophisticated analysis such as that performed by the optimizer of an Ada compiler. Consider the Ada-predefined exception Constraint Error. The Ada run-time system will raise Constraint Error when there is an attempt to assign to a variable a value that is outside the range of values declared for the variable, when there is an attempt to index an array with a value that is outside the range of values declared for the index subtype of the array, when there is an attempt to dereference a null access value, and in several other circumstances. The effort required to identify

14 1170 c. f. schaefer and g. n. bundy possible raises of Constraint Error, Numeric Error and Tasking Error would far outweigh the added diagnostic value of the analysis tool. Possible raises of Storage Error, Program Error, and the IO exceptions (Status Error, Mode Error, Name Error, Use Error, Device Error, End Error, and Data Error) would not be as difficult to identify, and future versions of the analysis tool may do this. There is one special case in which the tool will add a raise of an Ada-predefined exception to the encounters relation. If a handler H catches an Ada-predefined exception E explicitly (e.g. when Constraint Error = ), and if H contains a simple raise statement, then the pair ((H,E), E) is considered to be a member of the encounters relation. It follows that if H catches Constraint Error explicitly and contains a simple raise statement, then H will propagate Constraint Error, even though there may be no explicit raise of Constraint Error anywhere in the program. The following example illustrates this: begin X:=Y*Z; exception when Constraint Error = Log Error; raise; end; -- Handler is assumed to raise Constraint Error The tool makes one additional simplifying assumption: it treats every others handler as reachable (more formally, for a chunk C that is the context of an others handler H, the tool assumes that there is some exception E such that C encounters E and H catches E). Thus for the following code: B1: begin X:=Y*Z; exception when others = raise Overflow; end; the tool will report that the handler (and, loosely speaking, the block B1) propagates Overflow. With respect to others handlers, the tool acts as if every chunk can encounter some unspecified exception, and this assumption partially corrects the tool s failure to consider implicit raises of Ada-predefined exceptions. Implementation details Two interesting issues arose in implementing the analysis tool. The first issue concerns the caching of computations. The definitions of encounters and propagates are mutually recursive. As a consequence, when the set of propagated exceptions has been computed for a chunk C, it is advantageous to save the result of that computation so that it can be used in computing the set of exceptions encountered by any dynamic parent of C. On the other hand, a certain amount of recomputation is unavoidable in computing the maps relation. If a handler, or a block statement

15 static analysis of exception handling in ada 1171 nested in a handler, contains a simple raise statement, then it is necessary to recompute the maps relation for each exception that is both caught by the handler and is encountered by the context of the handler. Our implementation saves the set of propagated exceptions for all chunks other than handlers and block statements; for handlers and block statements, the propagated exceptions are recomputed each time they are needed. The set of encountered exceptions, as opposed to the set of propagated exceptions, is always recomputed for all chunks. Since the extracted form provides ready access to the set of exceptions immediately raised in a chunk and the set of dynamic children of a chunk, this recomputation is not very complex. The second issue concerns recursion. If there is recursion in the dynamic parent relation (as there will be, for example, in the presence of recursive subprogram calls), then the implementation must find some way to terminate the mutually recursive computation of the encounters and propagates relations. Our implementation keeps a stack to mirror the current traversal through the dynamic parent relation. This stack allows the computation to detect recursion. Suppose the set of exceptions encountered by a chunk C1 is currently being computed; then C1 is the top of the stack (the element most recently added). Suppose that C1 is the dynamic parent of some chunk C0 and that the set of exceptions propagated by C0 has not yet been computed. Furthermore, suppose that C0 is already on the stack. Instead of pushing C0 on the stack a second time, our implementation caches the null set as the set of exceptions propagated by C0, marks as temporary all chunks on the stack from C1 to C0, and marks C0 for recomputation. When the processing of C1 is complete, its computed set of propagated exceptions is cached (provided it is not a handler or a block), and it is popped off the stack. For C1, the cached result is a partial result since the exceptions propagated from C0 have not yet been included. When a chunk that is marked for recomputation is popped off the stack, a second pass is initiated. When processing in the second pass reaches the point of recursion, the previously cached partial computation for C0 is available and is unioned with the set of exceptions encountered by C1. At the conclusion of the second pass, the set of propagated exceptions has been completely computed for the chunk that was marked for recomputation as well as for each chunk for which the marked chunk is directly or indirectly the dynamic parent. USE OF THE ANALYSIS TOOL The analysis tool is intended to be used in conjunction with a set of design and coding guidelines that provide an application-specific discipline to the use of exception handling. Typically, such guidelines would distinguish different classes of exceptions and would attempt to answer at least these questions for each class: 1. Where may an exception belonging to the class be raised? 2. How (implicitly or explicitly) may a handler catch an exception belonging to the class? 3. What action (stop, pass, or map to a different class of exception) may a handler take when it has caught an exception belonging to the class? The appropriate handling of a class of exceptions may depend on the context. For example, the guidelines may prescribe that a handler in the immediate context of a raise must pass an exception of medium severity while a handler at a higher level in the call tree must either stop the exception or map it to one of higher severity.

16 1172 c. f. schaefer and g. n. bundy We have run the analysis tool on more than one million lines of code. It has proved to be effective in detecting a range of violations of design and coding guidelines. Among the types of anomalies the tool has detected are the following: (a) An exception is propagated to a subprogram that is not capable of handling it, either because the declaration of the exception is not visible to the subprogram or because proper handling of the exception would require access to hidden implementation details. (b) An exception indicating fatal severity is stopped prematurely or is erroneously mapped to an exception of lower severity. (c) A handler explicitly catches an exception that its associated chunk cannot encounter (if nothing that the handler catches can be encountered by its associated chunk, then the entire handler is dead code). (d) An exception that, by design, is supposed to be handled explicitly, is passed implicitly through one or more layers of subprogram calls (either because it is not caught by any handler or because it is caught implicitly and propagated by the simple raise statement). Some errors that the tool detected were due to simple oversights and could be corrected with trivial fixes. For example, one application had the reasonable guideline that a severe exception should not be stopped except by a handler at the highest level in the call-tree. A handler violating this guideline might be fixed simply by inserting the simple raise statement. However, although the fix may in this instance be easy, detecting the defect in the first place may be very difficult without the assistance of automated analysis tools. Furthermore, if not corrected, such a defect could result in the system s continuing to execute in an undefined state. Other errors were more subtle. One subtle defect is the erroneous mapping of a more severe exception to a less severe exception. Many such mappings are due to unanticipated propagations of exceptions from subprograms called in handlers. Consider the handler, exception when Data Err = Log Error; Send alert; raise Data Err; end; At first glance, it would appear that the handler will always pass the exception Data Err. However, suppose that the procedure Send Alert can itself propagate the exception Msg Processing Failed. Then under certain conditions, the handler has the effect of mapping Data Err to Msg Processing Failed. If Msg Processing Failed is less severe than Data Err, then the handler would be considered erroneous. A possible fix for this problem is to nest the call to Send alert in its own block, as follows: exception when Data Err = Log Error; begin

17 static analysis of exception handling in ada 1173 Send Alert; exception when others = null; end; raise Data Err; end; Although this fix ensures that the outer handler passes the exception Data Err, it may not always be appropriate. If Send Alert propagates an exception whose severity is higher than the severity of Data Err, then the inner handler will potentially mask a severe exception to allow a less severe exception to be propagated. This example points out the importance of thoroughly understanding the behavior of subprograms that are called from handlers. Another subtle source of defects is the implicit passing of exceptions. Prohibiting subprograms from passing certain classes of exceptions implicitly generally makes programs more comprehensible. If this guideline is adhered to, then for any given subprogram, a programmer can determine all the exceptions that can be propagated to the subprogram simply by examining the text of immediately called subprograms. Consider three procedures P1, P2, and P3, where P1 calls P2 and P2 calls P3. Suppose that P3 raises the exception Invalid Msg, and that P1 and P2 (and the handlers in their handler sets) do not raise Invalid Msg. If P2 passes Invalid Msg implicitly (and is thereby inconsistent with the hypothesized design guidelines), then P1 may also pass Invalid Msg implicitly even though the programmer who codes P1 examines the text of all immediately called subprograms to determine which exceptions can be propagated to P1. Thus, there may be a cascade of errors resulting from one inconsistency with a guideline. If the programmer responsible for P2 ultimately fixes P2 by explicitly passing Invalid Msg or by mapping Invalid Msg to another exception, then the code for P1 may also have to be changed. On the other hand, if the fix is to stop Invalid Msg in P2, then the code of P1 need not be changed. CONCLUSION Ada s exception handling mechanism offers the programmer considerable help in constructing correct and intelligible programs. Perhaps its principal benefit is the clarity that results from separating code for normal processing from code for exceptional processing. It reduces the need for explicit checking of return codes on each subprogram call and effects the alternate flow of control without the need for deeply nested conditionals or, worse, explicit gotos. Nevertheless, a programmer must exercise care in designing and coding the exception handling of an Ada program, as with any powerful language feature. One aspect of Ada s exception handling mechanism, in particular, permits the unwary programmer to construct faulty and unintelligible programs: the signature of an Ada subprogram, while specifying the types and modes of its parameters, does not constrain the set of exceptions which the subprogram may propagate. Discussing exception handling from a general, language-independent point of view, Goodenough 7 argues that the set of exceptions that a subprogram can propagate should be part of the signature of the subprogram, and subprograms in CLU 10 are subject to this

18 1174 c. f. schaefer and g. n. bundy restriction. Nevertheless, the designers of Ada explicitly rejected this alternative on efficiency grounds, 11 and they may well have struck the correct compromise. However, it remains true that it can be remarkably difficult to predict the dynamic behavior of Ada programs under exceptional processing from an examination of the program text. Particularly difficult to analyze is the behavior of handlers which call subprograms that may themselves propagate exceptions. It is for this reason that static analysis tools have such a high potential payoff in verifying Ada exception handling code. In the case of the application code we have analyzed, the static analysis tool was able to detect inconsistencies which, having escaped the notice of code inspectors, could only have been detected with an unrealistic number of test cases. As noted above, a static analysis tool need not be an unfailing oracle to be valuable; the tool may identify a number of instances of a suspicious construct which may turn out, on further analysis, to be correct. Simply identifying a set of potential errors (we have used the term red flags ) is of significant value. acknowledgements Thanks to Diane Mularz and Shari Lawrence Pfleeger for suggestions that improved this paper, and to Chuck Howell for his many ideas on exception handling. REFERENCES 1. C. Howell and D. Mularz, Exception handling in large Ada systems, Washington Ada Symposium Proceedings, June 1991, pp C. Howell, D. Mularz and G. Bundy, Exception handling, or when bad things happen to good programs, 14th International Conference on Software Engineering Tutorial, May Qian Cui and John Gannon, Data-oriented exception handling, IEEE Trans. Software Engineering, 18, (5), (1992). 4. Michael E. Fagan, Advances in software inspections, IEEE Trans. Software Engineering, SE-12, (7), (1986). 5. David L. Parnas, A. John van Schouwen and Shu Po Kwan, Evaluation of safety-critical software, Communications of the ACM, 33, (6), (1990). 6. Reference Manual for the Ada Programming Language, ANSI/Military Standard MIL-STD-1815A-1983, U.S. Department of Defense, January J. B. Goodenough, Exception handling: issues and a proposed notation, Communications of the ACM, 18, (12), (1975). 8. Software Productivity Consortium, Ada Quality and Style, Van Nostrand Reinhold, G. Goos, W. A. Wulf, A. Evans, Jr. and K. J. Butler, DIANA: An Intermediate Language for Ada, Springer-Verlag, B. Liskov and A. Snyder, Exception handling in CLU, IEEE Trans. Software Engineering, 5, (6), (1979). 11. J. D. Ichbiah et al., Rationale for the design of the Ada programming language, SIGPLAN Notices, 14, (6), Part B, (1979).

Data Abstraction and Hierarchy

Data Abstraction and Hierarchy Data Abstraction and Hierarchy * This research was supported by the NEC Professorship of Software Science and Engineering. Barbara Liskov Affiliation: MIT Laboratory for Computer Science Cambridge, MA,

More information

Adapting C++ Exception Handling to an Extended COM Exception Model

Adapting C++ Exception Handling to an Extended COM Exception Model Adapting C++ Exception Handling to an Extended COM Exception Model Bjørn Egil Hansen DNV AS, DT 990 Risk Management Software Palace House, 3 Cathedral Street, London SE1 9DE, UK [email protected]

More information

Introducing Formal Methods. Software Engineering and Formal Methods

Introducing Formal Methods. Software Engineering and Formal Methods Introducing Formal Methods Formal Methods for Software Specification and Analysis: An Overview 1 Software Engineering and Formal Methods Every Software engineering methodology is based on a recommended

More information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

Intrusion Detection via Static Analysis

Intrusion Detection via Static Analysis Intrusion Detection via Static Analysis IEEE Symposium on Security & Privacy 01 David Wagner Drew Dean Presented by Yongjian Hu Outline Introduction Motivation Models Trivial model Callgraph model Abstract

More information

Component visualization methods for large legacy software in C/C++

Component visualization methods for large legacy software in C/C++ Annales Mathematicae et Informaticae 44 (2015) pp. 23 33 http://ami.ektf.hu Component visualization methods for large legacy software in C/C++ Máté Cserép a, Dániel Krupp b a Eötvös Loránd University [email protected]

More information

[Refer Slide Time: 05:10]

[Refer Slide Time: 05:10] Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

More information

Software Testing & Analysis (F22ST3): Static Analysis Techniques 2. Andrew Ireland

Software Testing & Analysis (F22ST3): Static Analysis Techniques 2. Andrew Ireland Software Testing & Analysis (F22ST3) Static Analysis Techniques Andrew Ireland School of Mathematical and Computer Science Heriot-Watt University Edinburgh Software Testing & Analysis (F22ST3): Static

More information

Enforcing Data Quality Rules for a Synchronized VM Log Audit Environment Using Transformation Mapping Techniques

Enforcing Data Quality Rules for a Synchronized VM Log Audit Environment Using Transformation Mapping Techniques Enforcing Data Quality Rules for a Synchronized VM Log Audit Environment Using Transformation Mapping Techniques Sean Thorpe 1, Indrajit Ray 2, and Tyrone Grandison 3 1 Faculty of Engineering and Computing,

More information

A very short history of networking

A very short history of networking A New vision for network architecture David Clark M.I.T. Laboratory for Computer Science September, 2002 V3.0 Abstract This is a proposal for a long-term program in network research, consistent with the

More information

1 The Java Virtual Machine

1 The Java Virtual Machine 1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This

More information

Certification Authorities Software Team (CAST) Position Paper CAST-13

Certification Authorities Software Team (CAST) Position Paper CAST-13 Certification Authorities Software Team (CAST) Position Paper CAST-13 Automatic Code Generation Tools Development Assurance Completed June 2002 NOTE: This position paper has been coordinated among the

More information

Keywords: Regression testing, database applications, and impact analysis. Abstract. 1 Introduction

Keywords: Regression testing, database applications, and impact analysis. Abstract. 1 Introduction Regression Testing of Database Applications Bassel Daou, Ramzi A. Haraty, Nash at Mansour Lebanese American University P.O. Box 13-5053 Beirut, Lebanon Email: rharaty, [email protected] Keywords: Regression

More information

Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur

Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur Module 10 Coding and Testing Lesson 23 Code Review Specific Instructional Objectives At the end of this lesson the student would be able to: Identify the necessity of coding standards. Differentiate between

More information

KNOWLEDGE FACTORING USING NORMALIZATION THEORY

KNOWLEDGE FACTORING USING NORMALIZATION THEORY KNOWLEDGE FACTORING USING NORMALIZATION THEORY J. VANTHIENEN M. SNOECK Katholieke Universiteit Leuven Department of Applied Economic Sciences Dekenstraat 2, 3000 Leuven (Belgium) tel. (+32) 16 28 58 09

More information

Semantic Errors in SQL Queries: A Quite Complete List

Semantic Errors in SQL Queries: A Quite Complete List Semantic Errors in SQL Queries: A Quite Complete List Christian Goldberg, Stefan Brass Martin-Luther-Universität Halle-Wittenberg {goldberg,brass}@informatik.uni-halle.de Abstract We investigate classes

More information

Handling Exceptions. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total

Handling Exceptions. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Handling Exceptions Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Objectives After completing this lesson, you should be able to do the following: Define PL/SQL exceptions

More information

Coverity White Paper. Effective Management of Static Analysis Vulnerabilities and Defects

Coverity White Paper. Effective Management of Static Analysis Vulnerabilities and Defects Effective Management of Static Analysis Vulnerabilities and Defects Introduction According to a recent industry study, companies are increasingly expanding their development testing efforts to lower their

More information

Handling PL/SQL Errors

Handling PL/SQL Errors 7 Handling PL/SQL Errors There is nothing more exhilarating than to be shot at without result. Winston Churchill Run-time errors arise from design faults, coding mistakes, hardware failures, and many other

More information

Best Practices for Verification, Validation, and Test in Model- Based Design

Best Practices for Verification, Validation, and Test in Model- Based Design 2008-01-1469 Best Practices for Verification, Validation, and in Model- Based Design Copyright 2008 The MathWorks, Inc. Brett Murphy, Amory Wakefield, and Jon Friedman The MathWorks, Inc. ABSTRACT Model-Based

More information

Checking Access to Protected Members in the Java Virtual Machine

Checking Access to Protected Members in the Java Virtual Machine Checking Access to Protected Members in the Java Virtual Machine Alessandro Coglio Kestrel Institute 3260 Hillview Avenue, Palo Alto, CA 94304, USA Ph. +1-650-493-6871 Fax +1-650-424-1807 http://www.kestrel.edu/

More information

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE... 4. By using the RETE Algorithm... 5. Benefits of RETE Algorithm...

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE... 4. By using the RETE Algorithm... 5. Benefits of RETE Algorithm... 1 Table of Contents BUSINESS RULES CONCEPTS... 2 BUSINESS RULES... 2 RULE INFERENCE CONCEPT... 2 BASIC BUSINESS RULES CONCEPT... 3 BUSINESS RULE ENGINE ARCHITECTURE... 4 BUSINESS RULE ENGINE ARCHITECTURE...

More information

Random vs. Structure-Based Testing of Answer-Set Programs: An Experimental Comparison

Random vs. Structure-Based Testing of Answer-Set Programs: An Experimental Comparison Random vs. Structure-Based Testing of Answer-Set Programs: An Experimental Comparison Tomi Janhunen 1, Ilkka Niemelä 1, Johannes Oetsch 2, Jörg Pührer 2, and Hans Tompits 2 1 Aalto University, Department

More information

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters Interpreters and virtual machines Michel Schinz 2007 03 23 Interpreters Interpreters Why interpreters? An interpreter is a program that executes another program, represented as some kind of data-structure.

More information

CA Data Protection. Content Provider Development Guide. Release 15.0

CA Data Protection. Content Provider Development Guide. Release 15.0 CA Data Protection Content Provider Development Guide Release 15.0 This Documentation, which includes embedded help systems and electronically distributed materials (hereinafter referred to as the Documentation

More information

What Is Specific in Load Testing?

What Is Specific in Load Testing? What Is Specific in Load Testing? Testing of multi-user applications under realistic and stress loads is really the only way to ensure appropriate performance and reliability in production. Load testing

More information

File Management. Chapter 12

File Management. Chapter 12 Chapter 12 File Management File is the basic element of most of the applications, since the input to an application, as well as its output, is usually a file. They also typically outlive the execution

More information

Comprehensive Static Analysis Using Polyspace Products. A Solution to Today s Embedded Software Verification Challenges WHITE PAPER

Comprehensive Static Analysis Using Polyspace Products. A Solution to Today s Embedded Software Verification Challenges WHITE PAPER Comprehensive Static Analysis Using Polyspace Products A Solution to Today s Embedded Software Verification Challenges WHITE PAPER Introduction Verification of embedded software is a difficult task, made

More information

The Trip Scheduling Problem

The Trip Scheduling Problem The Trip Scheduling Problem Claudia Archetti Department of Quantitative Methods, University of Brescia Contrada Santa Chiara 50, 25122 Brescia, Italy Martin Savelsbergh School of Industrial and Systems

More information

Meeting DO-178B Software Verification Guidelines with Coverity Integrity Center

Meeting DO-178B Software Verification Guidelines with Coverity Integrity Center Meeting DO-178B Software Verification Guidelines with Coverity Integrity Center May, 2009 Thomas Schultz Director of Product Strategy, Coverity, Inc. Executive Summary Development organizations that create

More information

Compare & Adjust How to Guide for Compare & Adjust in SAP Solution Manager Application Lifecycle Management

Compare & Adjust How to Guide for Compare & Adjust in SAP Solution Manager Application Lifecycle Management Compare & Adjust How to Guide for Compare & Adjust in SAP Solution Manager Application Lifecycle Management www.sap.com TABLE OF CONTENTS COPYRIGHT... 3 1.0 Motivation... 4 2.0 Method and Prerequisites...

More information

New Generation of Software Development

New Generation of Software Development New Generation of Software Development Terry Hon University of British Columbia 201-2366 Main Mall Vancouver B.C. V6T 1Z4 [email protected] ABSTRACT In this paper, I present a picture of what software development

More information

A framework for creating custom rules for static analysis tools

A framework for creating custom rules for static analysis tools A framework for creating custom rules for static analysis tools Eric Dalci John Steven Cigital Inc. 21351 Ridgetop Circle, Suite 400 Dulles VA 20166 (703) 404-9293 edalci,[email protected] Abstract Code

More information

Data Structure with C

Data Structure with C Subject: Data Structure with C Topic : Tree Tree A tree is a set of nodes that either:is empty or has a designated node, called the root, from which hierarchically descend zero or more subtrees, which

More information

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification Introduction Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification Advanced Topics in Software Engineering 1 Concurrent Programs Characterized by

More information

Volume I, Section 4 Table of Contents

Volume I, Section 4 Table of Contents Volume I, Section 4 Table of Contents 4 Software Standards...4-1 4.1 Scope...4-1 4.1.1 Software Sources...4-2 4.1.2 Location and Control of Software and Hardware on Which it Operates...4-2 4.1.3 Exclusions...4-3

More information

Verification and Validation of Software Components and Component Based Software Systems

Verification and Validation of Software Components and Component Based Software Systems Chapter 5 29 Verification and Validation of Software Components and Component Based Christina Wallin Industrial Information Technology Software Engineering Processes ABB Corporate Research [email protected]

More information

Outline. 1 Denitions. 2 Principles. 4 Implementation and Evaluation. 5 Debugging. 6 References

Outline. 1 Denitions. 2 Principles. 4 Implementation and Evaluation. 5 Debugging. 6 References Outline Computer Science 331 Introduction to Testing of Programs Mike Jacobson Department of Computer Science University of Calgary Lecture #3-4 1 Denitions 2 3 4 Implementation and Evaluation 5 Debugging

More information

Data Integrator. Pervasive Software, Inc. 12365-B Riata Trace Parkway Austin, Texas 78727 USA

Data Integrator. Pervasive Software, Inc. 12365-B Riata Trace Parkway Austin, Texas 78727 USA Data Integrator Event Management Guide Pervasive Software, Inc. 12365-B Riata Trace Parkway Austin, Texas 78727 USA Telephone: 888.296.5969 or 512.231.6000 Fax: 512.231.6010 Email: [email protected]

More information

On the Relation between Design Contracts and Errors: A Software Development Strategy

On the Relation between Design Contracts and Errors: A Software Development Strategy On the Relation between Design Contracts and Errors: A Software Development Strategy Eivind J. Nordby, Martin Blom, Anna Brunstrom Computer Science, Karlstad University SE-651 88 Karlstad, Sweden {Eivind.Nordby,

More information

Handling Exceptions. Copyright 2008, Oracle. All rights reserved.

Handling Exceptions. Copyright 2008, Oracle. All rights reserved. Handling Exceptions Handling Exceptions What Will I Learn? In this lesson, you will learn to: Describe several advantages of including exception handling code in PL/SQL Describe the purpose of an EXCEPTION

More information

Verifying Semantic of System Composition for an Aspect-Oriented Approach

Verifying Semantic of System Composition for an Aspect-Oriented Approach 2012 International Conference on System Engineering and Modeling (ICSEM 2012) IPCSIT vol. 34 (2012) (2012) IACSIT Press, Singapore Verifying Semantic of System Composition for an Aspect-Oriented Approach

More information

PL/SQL Overview. Basic Structure and Syntax of PL/SQL

PL/SQL Overview. Basic Structure and Syntax of PL/SQL PL/SQL Overview PL/SQL is Procedural Language extension to SQL. It is loosely based on Ada (a variant of Pascal developed for the US Dept of Defense). PL/SQL was first released in ١٩٩٢ as an optional extension

More information

Handling Exceptions. Schedule: Timing Topic. 45 minutes Lecture 20 minutes Practice 65 minutes Total

Handling Exceptions. Schedule: Timing Topic. 45 minutes Lecture 20 minutes Practice 65 minutes Total 23 Handling Exceptions Copyright Oracle Corporation, 1999. All rights reserved. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Objectives After completing this lesson, you

More information

Chapter 5 Names, Bindings, Type Checking, and Scopes

Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named

More information

Handling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1

Handling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1 Handling Exceptions Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1 Objectives After completing this lesson, you should be able to do the following: Define PL/SQL

More information

Specification and Analysis of Contracts Lecture 1 Introduction

Specification and Analysis of Contracts Lecture 1 Introduction Specification and Analysis of Contracts Lecture 1 Introduction Gerardo Schneider [email protected] http://folk.uio.no/gerardo/ Department of Informatics, University of Oslo SEFM School, Oct. 27 - Nov.

More information

Testing LTL Formula Translation into Büchi Automata

Testing LTL Formula Translation into Büchi Automata Testing LTL Formula Translation into Büchi Automata Heikki Tauriainen and Keijo Heljanko Helsinki University of Technology, Laboratory for Theoretical Computer Science, P. O. Box 5400, FIN-02015 HUT, Finland

More information

Processing Requirements by Software Configuration Management

Processing Requirements by Software Configuration Management Processing Requirements by Software Configuration Management Ivica Crnkovic 1, Peter Funk 1, Magnus Larsson 2 1 Mälardalen University, Department of Computer Engineering, S-721 23 Västerås, Sweden {ivica.crnkovic,

More information

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led

More information

A Formal Model of Program Dependences and Its Implications for Software Testing, Debugging, and Maintenance

A Formal Model of Program Dependences and Its Implications for Software Testing, Debugging, and Maintenance A Formal Model of Program Dependences and Its Implications for Software Testing, Debugging, and Maintenance Andy Podgurski Lori A. Clarke Computer Engineering & Science Department Case Western Reserve

More information

EMBEDDED SOFTWARE DEVELOPMENT: COMPONENTS AND CONTRACTS

EMBEDDED SOFTWARE DEVELOPMENT: COMPONENTS AND CONTRACTS EMBEDDED SOFTWARE DEVELOPMENT: COMPONENTS AND CONTRACTS David URTING, Stefan VAN BAELEN, Tom HOLVOET and Yolande BERBERS {David.Urting, Stefan.VanBaelen, Tom.Holvoet, Yolande.Berbers}@cs.kuleuven.ac.be

More information

Software testing. Objectives

Software testing. Objectives Software testing cmsc435-1 Objectives To discuss the distinctions between validation testing and defect testing To describe the principles of system and component testing To describe strategies for generating

More information

Requirements engineering

Requirements engineering Learning Unit 2 Requirements engineering Contents Introduction............................................... 21 2.1 Important concepts........................................ 21 2.1.1 Stakeholders and

More information

MapReduce. MapReduce and SQL Injections. CS 3200 Final Lecture. Introduction. MapReduce. Programming Model. Example

MapReduce. MapReduce and SQL Injections. CS 3200 Final Lecture. Introduction. MapReduce. Programming Model. Example MapReduce MapReduce and SQL Injections CS 3200 Final Lecture Jeffrey Dean and Sanjay Ghemawat. MapReduce: Simplified Data Processing on Large Clusters. OSDI'04: Sixth Symposium on Operating System Design

More information

GENERIC and GIMPLE: A New Tree Representation for Entire Functions

GENERIC and GIMPLE: A New Tree Representation for Entire Functions GENERIC and GIMPLE: A New Tree Representation for Entire Functions Jason Merrill Red Hat, Inc. [email protected] 1 Abstract The tree SSA project requires a tree representation of functions for the optimizers

More information

Oracle Service Bus Examples and Tutorials

Oracle Service Bus Examples and Tutorials March 2011 Contents 1 Oracle Service Bus Examples... 2 2 Introduction to the Oracle Service Bus Tutorials... 5 3 Getting Started with the Oracle Service Bus Tutorials... 12 4 Tutorial 1. Routing a Loan

More information

Basic Testing Concepts and Terminology

Basic Testing Concepts and Terminology T-76.5613 Software Testing and Quality Assurance Lecture 2, 13.9.2006 Basic Testing Concepts and Terminology Juha Itkonen SoberIT Contents Realities and principles of Testing terminology and basic concepts

More information

Lumousoft Visual Programming Language and its IDE

Lumousoft Visual Programming Language and its IDE Lumousoft Visual Programming Language and its IDE Xianliang Lu Lumousoft Inc. Waterloo Ontario Canada Abstract - This paper presents a new high-level graphical programming language and its IDE (Integration

More information

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio. Organization of Programming Languages CS320/520N Razvan C. Bunescu School of Electrical Engineering and Computer Science [email protected] Names, Bindings, and Scopes A name is a symbolic identifier used

More information

Static Analysis of Dynamic Properties - Automatic Program Verification to Prove the Absence of Dynamic Runtime Errors

Static Analysis of Dynamic Properties - Automatic Program Verification to Prove the Absence of Dynamic Runtime Errors Static Analysis of Dynamic Properties - Automatic Program Verification to Prove the Absence of Dynamic Runtime Errors Klaus Wissing PolySpace Technologies GmbH Argelsrieder Feld 22 82234 Wessling-Oberpfaffenhofen

More information

Human-Readable BPMN Diagrams

Human-Readable BPMN Diagrams Human-Readable BPMN Diagrams Refactoring OMG s E-Mail Voting Example Thomas Allweyer V 1.1 1 The E-Mail Voting Process Model The Object Management Group (OMG) has published a useful non-normative document

More information

Security Issues for the Semantic Web

Security Issues for the Semantic Web Security Issues for the Semantic Web Dr. Bhavani Thuraisingham Program Director Data and Applications Security The National Science Foundation Arlington, VA On leave from The MITRE Corporation Bedford,

More information

Modeling Guidelines Manual

Modeling Guidelines Manual Modeling Guidelines Manual [Insert company name here] July 2014 Author: John Doe [email protected] Page 1 of 22 Table of Contents 1. Introduction... 3 2. Business Process Management (BPM)... 4 2.1.

More information

Building a Data Quality Scorecard for Operational Data Governance

Building a Data Quality Scorecard for Operational Data Governance Building a Data Quality Scorecard for Operational Data Governance A White Paper by David Loshin WHITE PAPER Table of Contents Introduction.... 1 Establishing Business Objectives.... 1 Business Drivers...

More information

Oracle Solaris Studio Code Analyzer

Oracle Solaris Studio Code Analyzer Oracle Solaris Studio Code Analyzer The Oracle Solaris Studio Code Analyzer ensures application reliability and security by detecting application vulnerabilities, including memory leaks and memory access

More information

Do you know? "7 Practices" for a Reliable Requirements Management. by Software Process Engineering Inc. translated by Sparx Systems Japan Co., Ltd.

Do you know? 7 Practices for a Reliable Requirements Management. by Software Process Engineering Inc. translated by Sparx Systems Japan Co., Ltd. Do you know? "7 Practices" for a Reliable Requirements Management by Software Process Engineering Inc. translated by Sparx Systems Japan Co., Ltd. In this white paper, we focus on the "Requirements Management,"

More information

How To Improve Software Quality

How To Improve Software Quality Software Qualities Quality Assurance Maintainer Go Documentation Readable Ce Go Design Functionality Ease of use Ease of learning User Reliability Correctness Efficiency Low Cost Portability Increased

More information

Secure Software Programming and Vulnerability Analysis

Secure Software Programming and Vulnerability Analysis Secure Software Programming and Vulnerability Analysis Christopher Kruegel [email protected] http://www.auto.tuwien.ac.at/~chris Testing and Source Code Auditing Secure Software Programming 2 Overview

More information

Concepts and terminology in the Simula Programming Language

Concepts and terminology in the Simula Programming Language Concepts and terminology in the Simula Programming Language An introduction for new readers of Simula literature Stein Krogdahl Department of Informatics University of Oslo, Norway April 2010 Introduction

More information

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program CS 2112 Lecture 27 Interpreters, compilers, and the Java Virtual Machine 1 May 2012 Lecturer: Andrew Myers 1 Interpreters vs. compilers There are two strategies for obtaining runnable code from a program

More information

Test Coverage Criteria for Autonomous Mobile Systems based on Coloured Petri Nets

Test Coverage Criteria for Autonomous Mobile Systems based on Coloured Petri Nets 9th Symposium on Formal Methods for Automation and Safety in Railway and Automotive Systems Institut für Verkehrssicherheit und Automatisierungstechnik, TU Braunschweig, 2012 FORMS/FORMAT 2012 (http://www.forms-format.de)

More information

Different Approaches to White Box Testing Technique for Finding Errors

Different Approaches to White Box Testing Technique for Finding Errors Different Approaches to White Box Testing Technique for Finding Errors Mohd. Ehmer Khan Department of Information Technology Al Musanna College of Technology, Sultanate of Oman [email protected] Abstract

More information

Formal Software Testing. Terri Grenda, CSTE IV&V Testing Solutions, LLC www.ivvts.com

Formal Software Testing. Terri Grenda, CSTE IV&V Testing Solutions, LLC www.ivvts.com Formal Software Testing Terri Grenda, CSTE IV&V Testing Solutions, LLC www.ivvts.com Scope of Testing Find defects early Remove defects prior to production Identify Risks Unbiased opinion When Should Testing

More information

A terminology model approach for defining and managing statistical metadata

A terminology model approach for defining and managing statistical metadata A terminology model approach for defining and managing statistical metadata Comments to : R. Karge (49) 30-6576 2791 mail [email protected] Content 1 Introduction... 4 2 Knowledge presentation...

More information

THE IMPACT OF INHERITANCE ON SECURITY IN OBJECT-ORIENTED DATABASE SYSTEMS

THE IMPACT OF INHERITANCE ON SECURITY IN OBJECT-ORIENTED DATABASE SYSTEMS THE IMPACT OF INHERITANCE ON SECURITY IN OBJECT-ORIENTED DATABASE SYSTEMS David L. Spooner Computer Science Department Rensselaer Polytechnic Institute Troy, New York 12180 The object-oriented programming

More information

each college c i C has a capacity q i - the maximum number of students it will admit

each college c i C has a capacity q i - the maximum number of students it will admit n colleges in a set C, m applicants in a set A, where m is much larger than n. each college c i C has a capacity q i - the maximum number of students it will admit each college c i has a strict order i

More information

Try-Catch FAQ. Version 2015.1 11 February 2015. InterSystems Corporation 1 Memorial Drive Cambridge MA 02142 www.intersystems.com

Try-Catch FAQ. Version 2015.1 11 February 2015. InterSystems Corporation 1 Memorial Drive Cambridge MA 02142 www.intersystems.com Try-Catch FAQ Version 2015.1 11 February 2015 InterSystems Corporation 1 Memorial Drive Cambridge MA 02142 www.intersystems.com Try-Catch FAQ Caché Version 2015.1 11 February 2015 Copyright 2015 InterSystems

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Part 2: Data Structures PD Dr. rer. nat. habil. Ralf-Peter Mundani Computation in Engineering (CiE) Summer Term 2016 Overview general linked lists stacks queues trees 2 2

More information

DATA STRUCTURES USING C

DATA STRUCTURES USING C DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

More information

programming languages, programming language standards and compiler validation

programming languages, programming language standards and compiler validation Software Quality Issues when choosing a Programming Language C.J.Burgess Department of Computer Science, University of Bristol, Bristol, BS8 1TR, England Abstract For high quality software, an important

More information

Structural Detection of Deadlocks in Business Process Models

Structural Detection of Deadlocks in Business Process Models Structural Detection of Deadlocks in Business Process Models Ahmed Awad and Frank Puhlmann Business Process Technology Group Hasso Plattner Institut University of Potsdam, Germany (ahmed.awad,frank.puhlmann)@hpi.uni-potsdam.de

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

The Student-Project Allocation Problem

The Student-Project Allocation Problem The Student-Project Allocation Problem David J. Abraham, Robert W. Irving, and David F. Manlove Department of Computing Science, University of Glasgow, Glasgow G12 8QQ, UK Email: {dabraham,rwi,davidm}@dcs.gla.ac.uk.

More information

Adversary Modelling 1

Adversary Modelling 1 Adversary Modelling 1 Evaluating the Feasibility of a Symbolic Adversary Model on Smart Transport Ticketing Systems Authors Arthur Sheung Chi Chan, MSc (Royal Holloway, 2014) Keith Mayes, ISG, Royal Holloway

More information

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Active database systems. Triggers. Triggers. Active database systems.

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Active database systems. Triggers. Triggers. Active database systems. Active database systems Database Management Systems Traditional DBMS operation is passive Queries and updates are explicitly requested by users The knowledge of processes operating on data is typically

More information

Determination of the normalization level of database schemas through equivalence classes of attributes

Determination of the normalization level of database schemas through equivalence classes of attributes Computer Science Journal of Moldova, vol.17, no.2(50), 2009 Determination of the normalization level of database schemas through equivalence classes of attributes Cotelea Vitalie Abstract In this paper,

More information

Introduction to Software Paradigms & Procedural Programming Paradigm

Introduction to Software Paradigms & Procedural Programming Paradigm Introduction & Procedural Programming Sample Courseware Introduction to Software Paradigms & Procedural Programming Paradigm This Lesson introduces main terminology to be used in the whole course. Thus,

More information

A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:

A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and: Binary Search Trees 1 The general binary tree shown in the previous chapter is not terribly useful in practice. The chief use of binary trees is for providing rapid access to data (indexing, if you will)

More information

Optimizations. Optimization Safety. Optimization Safety. Control Flow Graphs. Code transformations to improve program

Optimizations. Optimization Safety. Optimization Safety. Control Flow Graphs. Code transformations to improve program Optimizations Code transformations to improve program Mainly: improve execution time Also: reduce program size Control low Graphs Can be done at high level or low level E.g., constant folding Optimizations

More information

Quotes from Object-Oriented Software Construction

Quotes from Object-Oriented Software Construction Quotes from Object-Oriented Software Construction Bertrand Meyer Prentice-Hall, 1988 Preface, p. xiv We study the object-oriented approach as a set of principles, methods and tools which can be instrumental

More information

131-1. Adding New Level in KDD to Make the Web Usage Mining More Efficient. Abstract. 1. Introduction [1]. 1/10

131-1. Adding New Level in KDD to Make the Web Usage Mining More Efficient. Abstract. 1. Introduction [1]. 1/10 1/10 131-1 Adding New Level in KDD to Make the Web Usage Mining More Efficient Mohammad Ala a AL_Hamami PHD Student, Lecturer m_ah_1@yahoocom Soukaena Hassan Hashem PHD Student, Lecturer soukaena_hassan@yahoocom

More information

Handling PL/SQL Errors

Handling PL/SQL Errors Handling PL/SQL Errors In PL/SQL, a warning or error condition is called an exception. Exceptions can be internally defined (by the run-time system) or user defined. Examples of internally defined exceptions

More information

Towards Software Configuration Management for Test-Driven Development

Towards Software Configuration Management for Test-Driven Development Towards Software Configuration Management for Test-Driven Development Tammo Freese OFFIS, Escherweg 2, 26121 Oldenburg, Germany [email protected] Abstract. Test-Driven Development is a technique where

More information

Novel Data Extraction Language for Structured Log Analysis

Novel Data Extraction Language for Structured Log Analysis Novel Data Extraction Language for Structured Log Analysis P.W.D.C. Jayathilake 99X Technology, Sri Lanka. ABSTRACT This paper presents the implementation of a new log data extraction language. Theoretical

More information

UNIVERSITY OF WATERLOO Software Engineering. Analysis of Different High-Level Interface Options for the Automation Messaging Tool

UNIVERSITY OF WATERLOO Software Engineering. Analysis of Different High-Level Interface Options for the Automation Messaging Tool UNIVERSITY OF WATERLOO Software Engineering Analysis of Different High-Level Interface Options for the Automation Messaging Tool Deloitte Inc. Toronto, ON M5K 1B9 Prepared By Matthew Stephan Student ID:

More information

Software Engineering Techniques

Software Engineering Techniques Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary

More information