In processing an external function for which source code is not available, such as an application program interface (API), a model is used to evaluate whether the external function is properly invoked. An error potentially resulting from improper invocation of the external function and at least one condition that will result in the potential error are identified. The model is created to test for the condition that will result in the potential error. When the condition is found, generation of an error message is triggered. The model is associated with a source code analyzer such that when the source code is analyzed by the source code analyzer, the model is applied to evaluate invocation of the external function. The potential error and conditions that result in the error, such as input/output parameter errors and dependency errors, may be derived from documentation describing the operation of the external function or API.
|
1. A method for analyzing invocation of an external function for which function source code implementation is not available, comprising the steps of:
(a) identifying at least one potential error resulting from improper invocation of the external function by source code calling the external function;
(b) identifying at least one condition upon invocation of the external function that will result in the potential error;
(c) creating a model of the external function for which source code is not available to test for the at least one condition that results in the potential error;
(d) associating the model with a source code analyzer such that when the source code which calls the external function is analyzed by the source code analyzer, the model is applied to evaluate invocation of the external function;
(e) generating an error message upon finding the at least one condition upon invocation of the external function;
wherein the model is created using a plurality of primitives usable to test for the at least one condition that results in the potential error; and
wherein the source code analyzer includes a model repository configured to store the model created, such that the source code analyzer can access the model upon evaluating source code and identifying a reference to the external function.
6. A system for analyzing invocation of an external function for which function source code implementation is not available, the system comprising:
(a) at least one user input device;
(b) a display;
(c) a processor in communication with the input device and the display; and
(d) a memory in communication with the processor, the memory storing data and machine instructions that cause the processor to carry out a plurality of functions, including:
(i) deriving rules to evaluate the invocation and operation of any application programming interface (API) signatures;
(ii) including the derived rules with source code which comprises at least one invocation of an external function for which function source code implementation is not available;
(iii) identifying at least one potential error resulting from improper invocation of the external function by source code calling the external function;
(iv) identifying at least one condition upon invocation of the external function that will result in the potential error;
(v) creating a model of the external function to test for the at least one condition that results in the potential error;
(vi) associating the model with a source code analyzer such that when the source code which calls the external function is analyzed by the source code analyzer, the model is applied to evaluate invocation of the external function; and
(vii) generating an error message upon finding the at least one condition upon invocation of the external function;
wherein the model is created using a plurality of primitives usable to test for the at least one condition that results in the potential error; and
wherein the source code analyzer includes a model repository configured to store the model created, such that the source code analyzer can access the model upon evaluating source code and identifying a reference to the external function.
3. The method of
4. The method of
(a) an incorrect input type of an input parameter acceptable to the application program interface;
(b) an incorrect input content range of the input parameter acceptable to the application program interface;
(c) an incorrect output type for an output parameter generatable by the application program interface;
(d) an incorrect output content range of the output parameter generatable by the application program interface;
(e) a failure to invoke a prerequisite function that must be invoked prior to invocation of the external function; and
(f) a failure to invoke a post-requisite function that must be invoked after the invocation of the external function.
5. A memory medium having machine executable instructions stored for carrying out the steps of
8. The system of
9. The system of
(a) an incorrect input type of an input parameter acceptable to the application program interface;
(b) an incorrect input content range of the input parameter acceptable to the application program interface;
(c) an incorrect output type for an output parameter generatable by the application program interface;
(d) an incorrect output content range of the output parameter generatable by the application program interface;
(e) a failure to invoke a prerequisite function that must be invoked prior to invocation of the external function; and
(f) a failure to invoke a post-requisite function that must be invoked after the invocation of the external function.
|
The present invention generally pertains to computer software development, and more specifically, to a method and system for improving evaluation of computer source code to detect programming errors.
The ever-improving price-performance of microprocessors, random-access memory (RAM), and storage systems over the past decade has affected how computer software is developed. In the past, when hardware resources were more expensive, source code often was written in assembly language. Writing code in a low-level language was more time-consuming for developers, but resulted in somewhat more efficient and compact code. However, as a result of the improving price-performance of processors, memory, and storage, increasingly more programming is performed in high level languages, such as C/C++, Visual Basic, and others, to minimize the cost of software development.
Better tools for software developers have been created that make software creation more efficient and productive and take further advantage of the improved computing systems that are available. For example, static source code analysis tools help software developers to identify errors by deducing possible behavior of the source code. Some static source code analysis tools compile the code to identify syntax defects that the conventional compiler may not have detected that result in violation of programming language rules. Some static source code analysis tools do not include a compiler but, instead, intercept the output of an external compiler, parse the compiled code and analyze it. Once the static source code analysis tools have evaluated the source code for possible syntax errors, the representation of the source code generated by the code analyzer further allows the code to be evaluated for semantic problems by the simulator. Thus, static source code analysis tools help to detect syntax errors that may not have been detected by a compiler, as well as semantic errors that would not be detected by a compiler.
Static source code analyzers are tremendously helpful to software developers both in that they assist software developers in identifying problems that might interfere with compiling of the source code, or even if the source code compiles without incident, might cause the software to fail in operation. Static source code analyzers do not replace testing to determine if the resulting software functions as intended. However, by presenting developers with error messages 126 including correlations to specific lines 132 in source code 122, static source code analyzers allow developers to quickly address potential syntactic and semantic problems in their source code.
The accuracy of static source code analyzers depends on their ability to interpret the source code presented. As a result, some errors in the source code might be missed. In addition, if the static source code analyzer incorrectly interprets the source code being analyzed, false positives may be generated when the source code being evaluated is correct. Unfortunately, the occurrence of false positives amounts to noise that obscures error messages indicating actual errors in the source code. As a result, an actual error in the software code being analyzed may be overlooked by the software developer.
Other tools that are very helpful to software developers are software developer kits. Software developer kits are typically created for specific operating systems, such as Microsoft WINDOWS™, or computing or game platforms, such as the Microsoft XBOX™, to make software development easier by enabling access to previously-created software tools. These software development kits may include source code for prewritten routines that perform common functions likely to be included by developers in their code. By providing convenient access to such software routines, developers need not waste time rewriting common routines that already have been created.
Software development kits also may include application program interfaces or application programming interfaces (APIs) that can be accessed in the operating environment for which the developer is creating software. APIs can be used to invoke services to generate graphics, generate sounds, and any number of other functions. In addition, APIs that invoke differently implemented but functionally comparable services can be used to provide source code software portability between different platforms for which the source code can be compiled. Perhaps most significantly, APIs are useful for providing an interface between high level language source code and lower level utilities that operate more directly with the hardware devices of the operating environment.
APIs are often distributed separately or as part of a software development kit, in a collection of binary libraries. Typically, the source code used to create the APIs are not distributed or otherwise made available to developers. The source code is not made available to protect various proprietary concerns of the developers of the operating environment. However, even though the source code implementation of the API is not made available, documentation or other information may be made available with the software development kit that explains the operation of the API, the proper syntax for invoking the API, arguments to be passed to the API, and characteristics of values returned by the API.
Unfortunately, submitting source code that invokes one or more APIs to a static source code analyzer may result in the generation of a number of errors. As described above, a source code analyzer is only accurate to the extent that it is configured to understand the source code. Thus, a static source code analyzer may be unable to analyze an API signature, because the static source code analyzer is only presented with the API signature and cannot access the source code implementation of the API.
As shown in the prior art example of
Without access to the source code implementation of the API, the static source code analyzer cannot determine what effect the API might have, for example, on arguments passed to the API. As a result, static source code analyzer 108c may generate an error message with regard to a problem with a variable when, in fact, that problem is actually related to the API. As a result, inclusion of API signatures in source code may result in a great deal of false positive error messages or noise being generated by the source code analyzer that may, unfortunately, divert attention away from actual true error messages. In addition, because the source code analyzer may not be able to evaluate an API call or it effects, the source code analyzer will not be able to detect errors resulting from such an API call. The API may perform an operation on an argument that was passed to it that will result in an illegal operation at some subsequent point in the source code. Thus, if the source code analyzer is incapable of evaluating the operation of the API, the source code analyzer may fail to detect related errors in the source code.
It would therefore be desirable to provide a method and system that is able to evaluate API calls, even without having access to the source code implementation of the API.
Accordingly, one advantage of the present invention is that it provides a method and a system for evaluating external function calls, such as API calls, even when the source code implementation of the external function call is not available. Typical, known source code analyzers ignore external function calls and as a result, may miss errors in the invocation of the external function, or flag false positives when in fact, the error detected was resolved by the external function call. Because the source code for the external function is not available, the function source code itself cannot be incorporated into source code and analyzed. However, because the function source code is not made available, the provider of the external function may provide documentation or other information describing operation of the external function. This documentation enables a software developer to understand what parameters are passed to the external function, what parameters are output by the external function, what are prerequisite functions on which the API depends, as well as other important information. From this descriptive information, a model can be developed to insure that the API is properly invoked. A set of primitives included with the static source code analyzer according to an embodiment of the present invention provides a user with a way to model the function of the API so that the static source code analyzer can evaluate the behavior and effect of API calls.
One aspect of the present invention is thus directed to a method for analyzing invocation of an external function for which function source code implementation is not available. At least one potential error resulting from an improper invocation of the external function by source code is identified, and at least one condition that will result in the potential error is identified. A model of the external function is employed that is useful to test for the at least one condition resulting in the potential error, and which is able to initiate generation of an error message when the condition is found. The model is associated with a source code analyzer such that, when the source code is analyzed by the source code analyzer, the model is applied to evaluate invocation or operation of the external function.
The external function may include an API. Identifying the at least one condition that will result in the potential error is made based on information describing operation of the external function. The condition may include an incorrect input type of an input parameter acceptable to the application program interface, or an incorrect input content range of the input parameter acceptable to the API. Similarly, the condition may include an incorrect output for an output parameter generatable by the API, or an incorrect output content range of the output parameter generatable by the API. The condition also may include a failure to invoke a prerequisite function that must be invoked prior to the invocation of the external function, or a failure to invoke a post-requisite function that must be invoked after the invocation of the external function.
The model may be created using a plurality of primitives usable to test for the at least one condition that results in the potential error. The source code analyzer includes a model repository configured to store the model created, such that the source code analyzer can access the model upon evaluating source code and identifying a reference to the external function.
The foregoing aspects and many of the attendant advantages of this invention will become more readily appreciated as the same becomes better understood by reference to the following detailed description, when taken in conjunction with the accompanying drawings, wherein:
Exemplary Computing System for Implementing Present Invention
With reference to
A number of program modules may be stored on the hard disk, magnetic disk 229, optical disk 231, ROM 224, or RAM 225, including an operating system 235, one or more application programs 236, other program modules 237, and program data 238. A user may enter commands and information in PC 220 and provide control input through input devices, such as a keyboard 240 and a pointing device 242 that communicate with system bus 223 via I/O device interface 246. Pointing device 242 may include a mouse, stylus, wireless remote control, or other pointer, but in connection with the present invention, such conventional pointing devices may be omitted, since the user can employ the interactive display for input and control. As used hereinafter, the term “mouse” is intended to encompass virtually any pointing device that is useful for controlling the position of a cursor on the screen. One or more audio input/output devices 243, including headsets, speakers, and microphones, also engage personal computer 220 via I/O device interface 246. Still further input devices (not shown) may include a joystick, haptic joystick, yoke, foot pedals, game pad, satellite dish, scanner, or the like. These and other input/output (I/O) devices are often connected to processing unit 221 through an I/O interface 246 that is coupled to the system bus 223. The term I/O interface is intended to encompass each interface specifically used for a serial port, a parallel port, a game port, a keyboard port, and/or a universal serial bus (USB). A monitor 247 is connected to system bus 223 via an appropriate interface, such as a video adapter 248. It will be appreciated that PCs are often coupled to other peripheral output devices (not shown), such as speakers (through a sound card or other audio interface—not shown) and printers.
PC 220 can also operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 249. Remote computer 249 may be another PC, a server (which is typically generally configured much like PC 220a), a router, a network PC, a peer device, or a satellite or other common network node, and typically includes many or all of the elements described above in connection with PC 220a, although only an external memory storage device 250 has been illustrated in
When used in a LAN networking environment, PC 220 is connected to LAN 251 through a network interface or adapter 253. When used in a WAN networking environment, PC 220 typically includes a modem 254, or other means such as a cable modem, Digital Subscriber Line (DSL) interface, or an Integrated Service Digital Network (ISDN) interface for establishing communications over WAN 252, such as the Internet. Modem 254, which may be internal or external, is connected to the system bus 223 or coupled to the bus via I/O device interface 246, i.e., through a serial port. In a networked environment, program modules, or portions thereof, used by PC 220 may be stored in the remote memory storage device. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used, such as wireless communication and wide band network links.
Source Code Analyzer Adapted to Evaluate APIs
As described above, conventionally, appending the designation “extern” or a similar identifier to a declaration of an API signature indicates that the expression representing the API invokes an external routine for which the source code implementation is not available. As is understood in the art, the “extern” designation communicates to the compiler not to attempt to resolve any subsequent invocation of the external routine. The linker will be responsible for locating the object code of the invoked function, and resolving the code implementation of the external function at a binary level after compiling. In addition, the “extern” designation communicates to a conventional static source code analyzer not to attempt to semantically analyze the designated external function. Nonetheless, the static source code analyzer may evaluate the syntax of subsequent external function calls to ensure that invocations of the external function comport with the syntax of the function as specified.
According to embodiments of the present invention, potential API signatures 352 identified are submitted to API simulator 360. API simulator 360 evaluates potential API signatures 352 to determine if the syntax is correct, if proper arguments are passed to the API, if the arguments passed are of the appropriate type, and to otherwise evaluate API signatures 352 for the presence of coding errors. A determination of whether API signatures 352 are of the correct form is communicated by API simulator 360 to simulator 308. Using the information provided by API simulator 360, simulator 308 generates error messages in error report 310 for API signatures 352 that include errors. Conversely, false positives that may have been flagged as errors by simulator 308 due to its lack of familiarity with API signatures 352 are not reported as errors in error report 310.
It will be appreciated that if the source code implementation of an API is available to the software developer, the software developer can incorporate the API source code implementation in software developer's source code 302 for simulator 308 to evaluate, along with the rest of source code 302. However, as described above, generally APIs are provided only in their object code form in binary libraries that enable the APIs to be linked with other object code modules compiled from source code 302. Beneficially, embodiments of the present invention do not require the provider of the API to supply the API's source code implementation.
Instead, for each API signature that is contemplated, expected, or desired to be used with source code 302, API simulator 360 includes a model for the evaluation of each API signature. For example, models may be developed for a group of APIs identified as the most likely to be called. As a result, most noise that would otherwise be included in error report 310 due to false positives can be eliminated without having to include models of every API that might be called.
API simulator 360 includes models derived from information preferably provided by the API developer in SDK and/or API documentation 380 that is made available to software developers. Generally, SDK/API documentation 380 describes the functioning of the API, indicates the arguments to be provided to the API, what form of values are required or usable by the API, and other functional characteristics of the API. SDK/API documentation 380 is used to model APIs using API primitives 370. API primitives 370 include a set of routines packaged in a modeling library associated with the simulator that can be employed by a user to model the function of an API, so that API simulator 360 can evaluate the effect of an API invoked by the source code. Use of API primitives 370 is described further below.
Thus, using API primitives 370 and reviewing SDK/API documentation 380, even without access to the API source code, some rules can be derived to evaluate invocation and/or operation of API signature(s) 352 that may be included in source code 302 submitted to static source code analyzer 300. These rules are included in API simulator 360 and can be applied to potential API signatures 352 that are identified. The identified API signatures are then evaluated to determine if they use the appropriate syntax, pass appropriate arguments to the API, and otherwise adhere to the rules of the API, to evaluate whether the API signatures in source code 302 are valid. If API simulator 360 is applied to determine if API signature(s) 352 identified in the source code are implemented correctly, no error messages will be reported in error report 310. On the other hand, if the mistake is made in invoking the API in source code 302, API simulator 360 conveys this error message to simulator 308. Thus, simulator 308 can include appropriate error messages regarding API signatures that were identified in source code 302, in error report 310.
Preferably, API simulator 360 not only evaluates the standalone syntax and signature structure of the indication of the API, but also is configured to communicate to simulator 308 whether API signatures included in source code 302 resolve other potential errors in source code 302 detected by simulator 308. As a simple example, the API may evaluate an argument passed to the API and truncate or round its value beyond certain limits to acceptable values. Accordingly, if simulator 308 detects that a particular value is out of bounds, based on source code 302, simulator 308 can query API simulator 360 to determine if an API resolves the potential error. If so, no error message will be reported in error report 310, further reducing the incidence of false positive error messages.
In addition, API models included in the API simulator may include dependency rules. For example, it is possible that before an API is called, an argument passed to the API must be initialized, or another API or some other function on which an API depends must be invoked. API simulator 360 can include that dependency rule, so that an error will be generated by static source code analyzer 300 if the dependent function is not invoked before the API is invoked. Similarly, if it is necessary that an API invoke another function or API after it is called, API simulator 360 also can include that rule to generate an error if the function or API is not called as required.
As described above, many APIs are provided in binary libraries, and the source code used to implement the APIs is not made available to software developers that will use them. Embodiments of the present invention model identify expected APIs based on documentation provided with APIs or SDKs to enable static source code analyzer 300 to substantively evaluate API calls, as further described below.
It will be appreciated that, although static source code analyzer 300 depicts input processor 304 as causing standard programming instructions and API signature(s) 352 to be processed independently, simulator 308 and API simulator 360 preferably work cooperatively to evaluate whether APIs have been invoked properly and whether the APIs function properly with the source code.
Conventional Static Source Code Analyzer's Treatment of an Exemplary API
For purposes of illustration, an exemplary API is presented that receives two arguments and returns a success/failure value. Before the API is called, the memory block pointed to by the second parameter is not initialized. The API performs some operations on the memory block pointed to by the second parameter. However, if the first parameter fails to meet a certain condition, the functions will not be performed on the memory block pointed to by the second parameter and in fact the memory will not even be initialized. Accordingly, if failure to initialize the memory block is a problem, that problem will not be detected by a conventional static source code analyzer operable to evaluate the effect of the API.
More specifically, the exemplary API uses the following API signature and source code implementation:
#define SOME_VALUE 10
bool SomeFunctionAPI(int a, int* b)
{
if(a > 0) {
*b = SOME_VALUE * a;
// additional code not disclosed to developers
.
.
.
// additional code not disclosed to developers
return true;
}
return false;
}
Whatever actions are performed by the “additional code,” the memory block to which b points is only initialized and acted upon if the first parameter, a, is greater than zero.
Further assume that the API is referenced by source code that a user desires to submit for static source code analysis:
extern bool SomeFunctionAPI(int z, int* x)
typedef signed int INT;
typedef void VOID;
VOID main( )
{
INT q, x, y, z;
SOME_KNOWN_FUNCTION(q);
SomeFunctionAPI(z, &x);
y = 1/x;
}
The static source code analyzer does not have access to the source code implementation of SomeFunctionAPI. Accordingly, a conventional static source code analyzer may analyze the syntax used to invoke SomeFunctionAPI, but, without access to the source code implementation, will not evaluate the semantics of the API call.
A potential problem arises in the line of source code following the API call, y=1/x. A conventional static source code analyzer without access to the source code implementation of the API is not able to determine what value of x may be returned by the API. In examining the source code implementation of the API, x will be initialized if z is greater than zero, but x will not be initialized if z has a value less than or equal to zero. Variable x is not otherwise initialized by the source code invoking the API. Thus, if x is not initialized, the expression y=1/x will result in division by an uninitialized variable. On the other hand, if z is greater than or equal to zero, x is initialized and set to a nonzero value, thus expression y=1/x will yield a defined, acceptable result. Furthermore, even if z were not initialized, it is not possible to predict the result of the API on the value of x, even with access to the source code implementation.
Some conventional simulators may make assumptions about x. Hypothetically, for example, a static source code analyzer may assume that x is initialized. On the other hand, the static source code analyzer may also be configured to assume that, if x is not initialized by the source code invoking the API, x will not be initialized by the API. Similarly hypothetically, the static source code analyzer may assume that the value of x returned by the API is zero or is not equal to zero. In any case, the static source code analyzer can only guess at the value of x because a conventional static source code analyzer is not able to determine what value of x may be returned by the API.
As a result, because the value of x cannot be determined by a conventional static source code analyzer, the y=1/x expression presents a problem. Depending on what assumptions are made by the conventional static source code analyzer, the static source code analyzer may fail to detect errors, generate false error messages, or yield an appropriate response purely by happenstance, as further described below.
Exemplary API Modeled According to an Embodiment of the Present Invention
Even without the API developer disclosing the source code implementation of the API, according to embodiments of the present invention, the static source code analyzer is adapted to correctly identify potential errors in source code.
Static source code analyzers typically use state objects to track the state of program elements and variables. Thus, for example, in the preceding example of the routine invoking the API, if a function for which the source code implementation is known is invoked that affects the value of x, a state object could be used to track the value of x to determine whether division by x in the statement y=1/x yields a valid result. Recognizing the known syntax and rules of the source code, state machines may be used, for example, to determine whether a primitive such as an unsigned integer is used in a manner consistent with the primitive being an unsigned integer.
According to embodiments of the present invention, a user can study the documentation describing the API and, using API primitives 370 (
Considering the exemplary API, assume that API documentation provides the following information:
SYNTAX:
bool SomeFunctionAPI(int A, int* pB)
FUNCTION:
DEPENDENCIES:
LIMITATIONS:
As previously described in connection with
Using the preceding API documentation, the API SomeFunctionAPI may be modeled using a number of exemplary API primitives having specified primitive signatures and functions. For example, syntax and functional descriptions are provided for four API primitives that can be used to model the function of an API based on what is known about the API from the API or SDK documentation even without access to the source code implementation:
Using the some of the API primitives, based on information about the API derivable from the API documentation, the API SomeFunctionAPI may be modeled to facilitate a more accurate evaluation of the source code by the static source code analyzer:
bool SomeFunctionAPI(int a, int* b)
{
CheckIntegerIsInitialized(a);
CheckIntegerBoundsGreaterEqual(a, 1, INT_MAX);
CheckPointerIsValid (b);
ReturnIntegerValueGreaterThan(&b, 0);
}
Thus, when the simulator identifies a call to SomeFunctionAPI, the simulator API searches a repository of models checked by the static source code simulator. Upon finding the model for SomeFunctionAPI, accesses the model to assist in evaluating behavior of the source code, including the behavior of the APIs represented by a model in the repository of models. Accordingly, as further described below, the static source code analyzer is able to identify semantic errors related to the use of APIs that might be missed, as well as to reduce noise and false positive error messages that might be generated by a static source code analyzer not able to access the source code implementations of APIs invoked by the source code.
Graphical Description of State Object Representing Potential Model of an API
State object 500 includes a state 502 to evaluate the syntax of the API call. Because the API is designated as an external function by declaring it using “extern” syntax, a conventional static source code analyzer will recognize that the “extern” syntax invokes a module for which source code is not available and will ignore the remaining syntax of the expression. Accordingly, state 502 augments the static source code analyzer to enable it to determine if the defined syntax of the API call is used. State 502 may include a plurality of states sequentially tested to determine if a series of required arguments are supplied. If not, at a state 504 a syntax error is generated that will be included in the error report produced by the static source code analyzer. On the other hand, if the syntax is correct, or once a syntax error is generated at state 504, state object 500 advances to a state 506.
At state 506, it is determined if the dependency conditions of the API are met. If not, at a state 508, a dependency error is generated that is included in the error report produced by the static source code analyzer. A dependency error may exist, for example, if the API is to be invoked only after another API has been called or some other function must be performed, as specified in the API documentation. A plurality of dependency checking states 506 may be included, each of which evaluates a particular dependency. If the dependencies have been met or once a dependency error is generated at state 508, state object 500 advances to a state 510.
At state 510, it is determined if the first variable is greater than zero. If not, at a state 512, the second variable is not flagged as having been initialized or processed. On the other hand, if it is determined at state 510 that the first variable is greater than zero, at a state 514, the second variable is flagged as having been initialized and processed.
State object 500 operates in concert with other state objects employed by the static source code analyzer. Thus, for example, when x is defined, a state object is created for it by the static source code analyzer. Because x has not been initialized, its state object indicates that it has not been initialized. Without some understanding of the functioning of the API, the static source code analyzer may assume that the API either never initializes the [out] variables, thus resulting in a false positive, or always initializes the [out] variables, thereby overlooking a potential problem. Thus, modeling the API in the present invention ensures that better and more accurate information is provided to a user.
Static Source Code Analysis of Code Invoking Exemplary API
On one hand, a static source code analyzer 600 that does not model the API as shown in
However, without the benefit of an API model, static source code analyzer 600a will generate a similar same error message even when x is initialized, as shown in
Neither the result of
Alternatively, as shown in
However, without static source code analyzer 700 being configured to analyze the API, this assumption could be wrong. As shown in
In contrast, using embodiments of the present invention in which a static source code analyzer 800 models the API, the problems described above are avoided. As shown in
Furthermore, as shown in
Process of Static Source Code Analysis Using an API Model
On the other hand, if it is determined at decision step 916 that an API model is available, or if it had previously been determined at decision step 910 that the source code element was a standard source code element, at a decision step 920, it is determined if an error is detected in the source code element. If so, an appropriate error message is generated at a step 922. On the other hand, if no error is detected at decision step 920, or once appropriate messages have been generated at steps 914, 908 team, or 922, flow diagram 900 proceeds to a decision step 924. At decision step 924, it is determined if all of the source code elements have been simulated. If not, at a step 926, the next source code element to be evaluated is identified, and the next source code element is evaluated at step 908. Alternatively, once it is determined at decision step 924 that all the source code elements have been simulated, at a step 928, a report is generated including all error messages generated in the preceding steps. Static source code analysis ends at a step 930.
Although the present invention has been described in connection with the preferred form of practicing it and modifications thereto, those of ordinary skill in the art will understand that many other modifications can be made to the present invention within the scope of the claims that follow. Accordingly, it is not intended that the scope of the invention in any way be limited by the above description, but instead be determined entirely by reference to the claims that follow.
Patent | Priority | Assignee | Title |
10275334, | Feb 06 2017 | Codepops Inc. | Beginner-friendly system for identifying bugs in computer code |
10310959, | Nov 07 2017 | Bank of America Corporation | Pre-deployment validation system using intelligent databases |
10380008, | Mar 07 2013 | Microsoft Technology Licensing, LLC | Identifying implicit assumptions associated with a software product |
10592397, | Feb 16 2018 | Accenture Global Services Limited | Representing a test execution of a software application using extended reality |
10866803, | Feb 12 2019 | Red Hat, Inc. | Generating interaction libraries |
11249877, | Mar 14 2013 | BLACK DUCK SOFTWARE, INC | Techniques for traversing representations of source code |
11307961, | Mar 14 2013 | BLACK DUCK SOFTWARE, INC | Techniques for traversing representations of source code |
11748238, | May 28 2021 | International Business Machines Corporation | Model-based biased random system test through rest API |
11928051, | May 28 2021 | International Business Machines Corporation | Test space sampling for model-based biased random system test through rest API |
12169714, | May 25 2022 | CROWDSTRIKE, INC | Techniques for code isolation in static analysis of applications using application framework |
8627297, | Jul 02 2007 | Seimens Aktiengesellschaft | Method for evaluating at least one characteristic value |
8745578, | Dec 04 2011 | International Business Machines Corporation | Eliminating false-positive reports resulting from static analysis of computer software |
8978020, | May 14 2010 | SAP SE | Generating reusable test components out of remote application programming interface |
9015685, | Mar 01 2013 | International Business Machines Corporation | Code analysis for simulation efficiency improvement |
9069574, | Mar 01 2013 | International Business Machines Corporation | Code analysis for simulation efficiency improvement |
9219719, | Sep 21 2012 | GOOGLE LLC | Automatic dynamic vetting of browser extensions and web applications |
9372785, | Mar 07 2013 | Microsoft Technology Licensing, LLC | Identifying implicit assumptions associated with a software product |
9762598, | Sep 21 2012 | GOOGLE LLC | Automatic dynamic vetting of browser extensions and web applications |
ER3523, | |||
ER8136, |
Patent | Priority | Assignee | Title |
5283856, | Oct 04 1991 | Banyan Systems Incorporated | Event-driven rule-based messaging system |
5692122, | Mar 30 1993 | International Business Machines Corporation | Generation of random conversation testcases |
6085029, | May 09 1995 | Parasoft Corporation | Method using a computer for automatically instrumenting a computer program for dynamic debugging |
6154876, | Aug 10 1994 | Microsoft Technology Licensing, LLC | Analysis of the effect of program execution of calling components with data variable checkpointing and resource allocation analysis |
6289502, | Sep 26 1997 | Massachusetts Institute of Technology | Model-based software design and validation |
6523169, | Dec 04 1996 | Siemens Aktiengesellschaft | Method for testing system components of an object-oriented program |
6880153, | Nov 21 2000 | VALTRUS INNOVATIONS LIMITED | Method and apparatus for varying the level of correctness checks executed when performing correctness checks opportunistically using spare instruction slots |
6883166, | Nov 21 2000 | HEWLETT-PACKARD DEVELOPMENT COMPANY L P | Method and apparatus for performing correctness checks opportunistically |
6993751, | May 14 2001 | Microsoft Technology Licensing, LLC | Placing exception throwing instructions in compiled code |
20060026570, | |||
20070157182, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Feb 21 2005 | JUBRAN, MARWAN E | Microsoft Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 015802 | /0387 | |
Feb 22 2005 | Microsoft Corporation | (assignment on the face of the patent) | / | |||
Oct 14 2014 | Microsoft Corporation | Microsoft Technology Licensing, LLC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 034766 | /0001 |
Date | Maintenance Fee Events |
May 27 2009 | ASPN: Payor Number Assigned. |
Jan 28 2013 | REM: Maintenance Fee Reminder Mailed. |
Jun 16 2013 | EXP: Patent Expired for Failure to Pay Maintenance Fees. |
Date | Maintenance Schedule |
Jun 16 2012 | 4 years fee payment window open |
Dec 16 2012 | 6 months grace period start (w surcharge) |
Jun 16 2013 | patent expiry (for year 4) |
Jun 16 2015 | 2 years to revive unintentionally abandoned end. (for year 4) |
Jun 16 2016 | 8 years fee payment window open |
Dec 16 2016 | 6 months grace period start (w surcharge) |
Jun 16 2017 | patent expiry (for year 8) |
Jun 16 2019 | 2 years to revive unintentionally abandoned end. (for year 8) |
Jun 16 2020 | 12 years fee payment window open |
Dec 16 2020 | 6 months grace period start (w surcharge) |
Jun 16 2021 | patent expiry (for year 12) |
Jun 16 2023 | 2 years to revive unintentionally abandoned end. (for year 12) |