Fault analysis device, program, and fault analysis method
The defect analysis device and method trace execution paths using program logs and symbolic execution to identify and correct non-reproducible software defects, enhancing analysis efficiency and reducing delays and costs.
Patent Information
- Application Number
- JP2020143591
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2020-08-27
- Publication Date
- 2024-09-12
- Estimated Expiration
- 2040-08-27
AI Technical Summary
Existing methods struggle to identify and analyze the cause of non-reproducible defects in software programs, which can lead to significant delays and costs due to their rarity and difficulty in reproduction.
A defect analysis device and method that utilizes program execution logs to set a starting point for analysis, performs backward symbolic execution to trace execution paths, and uses an SMT solver to calculate input parameter values that satisfy path conditions, enabling identification of execution paths where defects occur.
Enables efficient identification of execution paths and conditions leading to defects, facilitating quicker analysis and correction of software issues, reducing delays and costs associated with non-reproducible defects.
Smart Images

Figure 0007549992000005 
Figure 0007549992000009 
Figure 0007549992000002
Abstract
Description
[Technical field]
[0001] The present invention relates to a defect analysis device, a program, and a defect analysis method for assisting in the analysis of defects in a software program. [Background technology]
[0002] In software development, software (programs, software programs) behaving differently from the specifications or in a way that the developer did not expect is called a defect, and it is desirable to correct and eliminate all defects before releasing the software. Testing is a common method for detecting defects. In testing, inputs and outputs that are specified in the specifications or expected by the developer are created as test cases, and it is confirmed whether the program returns the correct output for the input. If the output differs from the input, or an exception (fault) occurs and the program does not work, it is determined that there is a defect (a defect has occurred). If a defect is found, the developer analyzes which part of the software performed an unexpected process, identifies the cause, and modifies the program logic so that the appropriate input and output is performed.
[0003] Large and complex programs require many test cases. In detail, covering all statements (lines / steps), branches, and branch conditions of a program requires a huge number of test cases, which is not realistic. In a control program that calculates output from input, the program may process most inputs correctly, but may process incorrectly under very rare conditions. Such a defect is called an irreproducible defect, and it is difficult to identify the rare conditions under which the defect occurs.
[0004] If a non-reproducible defect is found just before shipment, analyzing the defect will take a very long time, and shipment may be postponed. Furthermore, if a non-reproducible defect is found after shipment, there are few clues to the cause, making cause analysis extremely difficult. If there is a certain probability of a defect occurring, it may become necessary to recall the product or to correct the product. Shipping delays, product recalls, and recalls damage user trust and are extremely costly, so they should be avoided as much as possible.
[0005] Patent Document 1 describes a method for evaluating fault propagation in a software component in the event of a failure, by determining which output will not satisfy the specifications in response to an input that violates the specifications, in a software component for which input and output specifications are defined. [Prior art documents] [Patent documents]
[0006] [Patent Document 1] JP 2012-128727 A Summary of the Invention [Problem to be solved by the invention]
[0007] The technique described in Patent Document 1 can evaluate the behavior of a software component when an abnormal input is given, but cannot analyze the cause of a defect that causes an abnormal output for a normal input. The present invention has been made in consideration of the above background, and has an object to provide a defect analysis device, a program, and a defect analysis method that make it possible to identify an execution path in which a defect contained in a program occurs. [Means for solving the problem]
[0008] In order to solve the above-mentioned problems, a fault analysis device according to the present invention is a fault analysis device for a program that includes an execution log of the program as an input, the fault analysis device including an analysis start point acquisition unit that acquires a statement of the program in which an exception has occurred from the execution log as an analysis start point, and a function that directly or indirectly calls a function including the analysis start point. One or more functions selected from as an analysis end point; and a symbolic execution engine that performs backward symbolic execution from the analysis start point to the analysis end point and outputs an execution path. Effect of the Invention
[0009] According to the present invention, it is possible to provide a defect analysis device, a program, and a defect analysis method that enable identification of an execution path in which a defect contained in a program occurs. [Brief description of the drawings]
[0010] [Figure 1] 1 is a diagram showing an input, an output, and an overall configuration of a failure analysis device according to an embodiment of the present invention; [Diagram 2] 3 is a diagram for explaining an execution path and a path condition according to the embodiment; FIG. [Diagram 3] FIG. 2 is a diagram illustrating a configuration of a screen of the defect analysis device according to the present embodiment. [Figure 4] FIG. 2 is a diagram illustrating the configuration of an execution path display screen according to the embodiment. [Diagram 5] 4 is a flowchart of a defect analysis process according to the embodiment. [Figure 6] 13 is a diagram for explaining an execution path and a path condition according to a modified example of the embodiment. FIG. [Figure 7] FIG. 13 is a diagram showing the configuration of a screen of a defect analysis device according to a modified example of the present embodiment. [Figure 8] 13 is a flowchart (1) of a defect analysis process according to a modified example of the present embodiment. [Figure 9] 13 is a flowchart (2) of the defect analysis process according to the modified example of the embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0011] A fault analysis device in a mode (embodiment) for carrying out the present invention will be described below. The input to the fault analysis device includes the source code of the program and the execution log of the program. The execution log includes functions (methods) called during execution. When an exception (e.g., division by zero) occurs during execution, the execution log ends with the call of the function where the exception occurred (records the program stop). The defect analysis device sets the program statement (line / step of source code) including a division operation in the function where the exception occurred from the execution log as the analysis start point. In addition, the device inquires of the user (developer) and sets a function that directly or indirectly calls the function including the analysis start point as the analysis end point.
[0012] The fault analysis device performs backward symbolic execution, which is the opposite direction to normal program execution, from the analysis start point to the analysis end point. During backward symbolic execution, the fault analysis device records the execution path and path conditions. An execution path is a path (sequence of statements / lines / steps) in a program that connects the analysis end point and the analysis start point, and processing proceeds along the execution path. The execution path also includes function calls. A path condition is a condition for a variable that causes an exception (for example, division by zero). Variables include local variables within a function and input parameters of the function. By referring to the execution path and path conditions, the user can understand how the exception (fault) occurs and can use this information to consider how to fix the fault. As a result, the fault analysis device can support the user in analyzing faults.
[0013] The defect analysis device uses an SMT solver (Satisfiability Modulo Theories Solver) to calculate the input parameter values of the function that is the analysis end point that satisfies the path conditions. By performing a test using these values as input, the user can check whether the modified program works correctly.
[0014] <Configuration of defect analysis device> 1 is a diagram showing the input, output, and overall configuration of a failure analysis device 100 according to this embodiment. The failure analysis device 100 includes a control unit 110, a storage unit 120, and an input / output unit 180. The input / output unit 180 includes user interfaces such as a display, a keyboard, a mouse, etc. The input / output unit 180 may further include a communication interface and a device for reading and writing data from and to a recording medium.
[0015] The storage unit 120 is composed of a RAM (Random Access Memory), a ROM (Read Only Memory), an SSD (Solid State Drive), etc. The storage unit 120 stores a program 121 and a function call relationship database 130 (referred to as a function call relationship DB (Database) in FIG. 1). The program 121 is a program for causing a computer to function as the fault analysis device 100, and includes a description of the processing procedure of the fault analysis process (see FIG. 5 described later). The function call relationship database 130 stores data indicating the relationship of which function calls which other function, in other words, a call relationship graph (a graph of a control flow expressing the call relationship between functions). Before describing the control unit 110, the inputs and outputs of the failure analysis device 100 will be described.
[0016] <Failure analysis device input> The inputs of the fault analysis device 100 include source code 210, a program execution log 220, and a program specification 230. The source code 210 is the source code of a function (method) constituting the software program to be analyzed. The program specification 230 describes the name of the function, and the names, types, and ranges of the input parameter values and return values of the function.
[0017] The program execution log 220 (execution log) contains a record of function calls made during program execution. In addition to the names (identification information) of the functions called, the program execution log 220 may also contain input parameter values at the time of the call and return values upon return from the call. The program execution log 220 may also contain exceptions that occurred during program execution. Exceptions include division by zero and violations of input parameter values or return values described in the program specification 230 (values outside the range of the specification).
[0018] <Output from defect analysis device> The output of the fault analysis device 100 includes an execution path 240 and an input parameter value 250. The execution path 240 is a path in the program where a fault occurs (a series of statements / lines / steps that are processed sequentially in the source code 210). One end of the execution path 240 is a statement / line / step where an exception (fault) related to the fault occurs, and is referred to as an analysis start point or simply as a start point. The analysis start point is, for example, a statement including a division operation that results in a division by zero. The other end of the execution path 240 is a function that directly or indirectly calls the function including the analysis start point, and is referred to as an analysis end point or an entry point. The analysis end point may be a function including the start point. An input parameter value 250 is an input parameter value of the entry point function when a malfunction occurs.
[0019] <Configuration of the control unit of the defect analysis device> The control unit 110 is composed of a CPU (Central Processing Unit), and includes a call relationship generation unit 111, an analysis start point acquisition unit 112, an analysis end point acquisition unit 113, a symbolic execution engine 114, and an SMT solver 115. The call relationship generating unit 111 obtains the function call relationships from the source code 210 and stores them in the function call relationship database 130 .
[0020] The analysis starting point acquisition unit 112 acquires the analysis starting point by analyzing the program execution log 220. The procedure for acquiring the analysis starting point will be described later in detail. The analysis end point acquisition unit 113 (entry point acquisition unit) acquires functions that call the function including the analysis start point from the function call relationship database 130, and displays them as entry point candidates on a display provided in the input / output unit 180. The user (developer) selects one or more entry points from the candidates. The analysis end point acquisition unit 113 sets the selected function as the analysis end point (entry point).
[0021] The symbolic execution engine 114 generates an execution path 240 and path conditions. The path conditions are conditions on variables (local variables and input parameters) for the execution of the program to be analyzed to follow the execution path 240. Details of the execution path 240 and path conditions will be described later. Details of the symbolic execution engine are described in the following literature: Peter Dinges and Gul Agha, "Targeted Test Input Generation Using Symbolic Concrete Backward Execution". The SMT solver 115 (the solver) generates input parameter values 250 that satisfy the path conditions. The SMT solver is described in the following publication: Leonardo de Moura and Nikolaj Bjorner, "Z3: An Efficient SMT Solver".
[0022] <Execution path and path conditions> FIG. 2 is a diagram for explaining execution paths and path conditions according to this embodiment. FIG. 2 includes source code 210 of three functions, function baz10, function bar20, and function foo30. Function baz10 calls function bar20, which calls function foo30. The explanation will continue on the assumption that a division by zero exception occurs in function foo30, and function baz10 is specified as the entry point. In this case, program execution log 220 includes records of calls to function baz10, function bar20, and function foo30, and ends with a record of the occurrence of division by zero.
[0023] By analyzing the program execution log 220, the analysis starting point acquisition unit 112 detects that a division by zero exception has occurred in function foo30. Since line 3 of function foo is the only statement / line that contains a division operation, the analysis starting point acquisition unit 112 sets the start point to line 3 of function foo30. A path condition is a condition / constraint under which an exception occurs. The path condition 32 on line 3 of function foo30, which is the starting point of the analysis, is "b=0".
[0024] Symbolic execution engine 114 starts at a start point and searches through the program (source code 210) in the opposite direction to normal (forward) execution (also referred to as reverse symbolic execution) until it reaches an entry point. If there are multiple entry points, symbolic execution engine 114 searches until it reaches one of the entry points. 2, the symbolic execution engine 114 starts searching from line 3 of function foo30 and reaches line 1 (the first line). The execution path at this point is from line 3 to line 1 of function foo30. The path condition 31 on line 1 remains "b=0".
[0025] The symbolic execution engine 114 determines that the function foo30 has been called with the second input parameter b being 0, and searches for a statement that calls the function foo30. In the case of FIG. 2, the statement that calls the function foo30 is line 3 of the function bar20, and the symbolic execution engine 114 continues the search from that line. The path condition 22 in this line is "ab=0" where the second input parameter is 0. The execution path at this point is line 3 to line 1 of the function foo30, and line 3 of the function bar20. Also, the path conditions at this point are "b=0" in the function foo30 and "ab=0" in the function bar20. Note that the functions baz10, bar20, and foo30 each have variables a, b, and c with the same name, but these are local variables of each function and are different variables.
[0026] Symbolic execution engine 114 starts searching from line 3 of function bar20 and reaches line 1. The execution path at this point is line 3 to line 1 of function foo30 and line 3 to line 1 of function bar20. Path condition 21 on line 1 is "a=b", which is equivalent to path condition 22 "ab=0". Symbolic execution engine 114 determines that function bar20 has been called with the same value for the first parameter and the second input parameter, and searches for a statement that calls function bar20. In the case of FIG. 2, the statement that calls function bar20 is line 3 of function baz10, and symbolic execution engine 114 continues the search from that line. Path condition 12 in this line is "a=b." The execution path at this point is line 3 to line 1 of function foo30, line 3 to line 1 of function bar20, and line 3 of function baz10. Also, the path conditions at this point are "b=0" in function foo30, "ab=0" in function bar20, and "a=b" in function baz10.
[0027] Symbolic execution engine 114 starts the search from line 3 of function baz10 and reaches line 1. Since function baz10 is the analysis end point, the search ends here. The execution paths at this point are line 3 to line 1 of function foo30, line 3 to line 1 of function bar20, and line 3 to line 1 of function baz10. Also, the path conditions at this point are "b=0" in function foo30, "ab=0" in function bar20, and "a=b" in function baz10. The path condition includes a condition for the input parameter value of the entry point (analysis end point). The SMT solver 115 solves the path condition and calculates the input parameter value 250 of the function baz10, which is the entry point, that satisfies the path condition, for example, a=0 and b=0.
[0028] Finally, the symbolic execution engine 114 displays the execution path on a display provided in the input / output unit 180. The user can understand how and under what conditions the processing progresses in the program, causing a problem. This in turn enables the user to find problems and correct the program. The SMT solver 115 provides input parameter values 250 (input values of the entry point (analysis end point) that satisfy the path conditions), and the user can use these values to test the corrected program.
[0029] In the above description, the function foo30 and the function bar20 each have one caller statement. If there are multiple callers, the search continues from each caller. For example, assume that the function bazA (not shown) calls the function bar20 as bar(d+1, d-2) on line 5. The symbolic execution engine 114 searches up to line 5 of the function bazA to find the path condition. In this case, since the first parameter and the second parameter, which are the path condition of the function bar20, are equal, "d+1=d-2" becomes the path condition. However, since such a condition is not satisfied, the symbolic execution engine 114 stops the search from line 5 of the function bazA and continues the search for another caller.
[0030] If multiple callers are searched and each of them reaches the entry point, the symbolic execution engine 114 may record the execution path and path condition of each. In such a case, there will be multiple execution paths and path conditions. In other words, it will be found that an exception occurs at the same location (analysis start point) under different conditions.
[0031] If a conditional branch occurs during the search, the symbolic execution engine 114 adds the branch condition to the path conditions. For example, assume that line 3 of function foo30 is "if (x<=y) c=a / b;". In this case, the path conditions are "b=0" and "x<=y". When multiple analysis end points are specified, when there are multiple callers of a function, or when there is a conditional branch, the search may reach multiple analysis end points, execution paths, and path conditions.
[0032] <User Interface> 3 is a configuration diagram of a screen 400 of the failure analysis device 100 according to this embodiment. Arranged in the center of the left and right of the screen 400, from top to bottom, are an analysis start point information display area 411, an analysis end point information display area 412, and an analysis result information display area 413. When analysis start point acquisition unit 112 sets an analysis start point, the name of the function including the analysis start point, the line number of the analysis start point, the condition under which an exception occurs, and the like are displayed in analysis start point information display area 411. For example, if a division by zero exception occurs and there are multiple division operations, there will be multiple candidates for the analysis start point. In such a case, information display area 411 displays a message urging the user to select one of the multiple analysis start point candidates. The user presses "Specify" button 421 to select one analysis start point from a screen (not shown) that displays the analysis start point candidates. Analysis start point acquisition unit 112 sets the selected analysis start point candidate as the analysis start point.
[0033] Immediately after startup of fault analysis device 100 (before the fault analysis process shown in FIG. 5 described below), a message prompting the selection of an analysis end point (entry point) is displayed in analysis end point information display area 412. The user presses "Specify" button 422 to select one or more analysis end points from a screen (not shown) that displays analysis end point candidates (functions that include a start point, and functions that directly or indirectly call said functions). Analysis end point acquisition unit 113 sets the selected analysis end point candidate as the analysis end point and displays it in information display area 412. If multiple analysis end points are selected, multiple analysis end points are displayed in information display area 412.
[0034] When the "Start analysis" button 423 is pressed, the symbol execution engine 114 searches for an execution path, and the analysis end point reached and the path conditions related to the input parameters of the analysis end point are displayed in the analysis result information display area 413. If there are multiple analysis end points or path conditions related to multiple input parameters, the multiple analysis end points and path conditions are displayed in the information display area 413. When the "Display execution path" button 424 is pressed, an execution path display screen 430 (see FIG. 4 described later) is displayed.
[0035] FIG. 4 is a configuration diagram of an execution path display screen 430 according to this embodiment. The execution path display screen 430 displays source codes of functions baz10, bar20, and foo30 through which the execution path passes. In the source codes of functions baz10, bar20, and foo30, statements that are execution paths 431, 432, and 433 are displayed in inverted form. In addition, the statement at the analysis start point is displayed as a program comment with "start point," and the statement at the entry point is displayed as an "end point." In addition, path conditions are displayed as program comments corresponding to the statements. By checking the execution path that shows the program flow and the path conditions that are the conditions for the occurrence of a defect in the execution path, the user (developer) can understand the cause of the defect, which in turn makes it easier to consider how to correct the source code. In FIG. 4, the start point, end point, and path conditions are displayed in the form of program comments, but other formats may be used as long as the correspondence with statements / lines can be understood.
[0036] <Failure analysis processing> FIG. 5 is a flowchart of the defect analysis process according to this embodiment. In step S11, the control unit 110 reads the source code 210, the program execution log 220, and the program specification 230, which are inputs. In step S12, the call relationship generating unit 111 extracts function call relationships from the read source code 210 and stores them in the function call relationship database .
[0037] In step S13, analysis start point acquisition unit 112 acquires and sets the analysis start point from program execution log 220. If there are multiple candidates for the analysis start point, they are acquired by inquiring of the user (see "Specify" button 421 in FIG. 3). In step S14, the analysis end point acquisition unit 113 inquires of the user and acquires and sets the analysis end point (entry point). In step S15, symbolic execution engine 114 starts a search (backward symbolic execution) from the analysis start point. In detail, symbolic execution engine 114 performs symbolic execution backward toward the first line of the function.
[0038] In step S16, the symbolic execution engine 114 records the execution path and the path conditions. In step S17, if the statement / line currently being searched is the first line of the analysis end point (entry point) (step S17→YES), the symbol execution engine 114 proceeds to step S18, and if it is not the first line of the analysis end point (step S17→NO), the symbol execution engine 114 proceeds to step S19. In step S18, the symbolic execution engine 114 displays the results of the search (reverse symbolic execution) (see the analysis result information display area 413 shown in FIG. 3).
[0039] In step S19, the symbolic execution engine 114 identifies the caller of the function. In step S20, the symbolic execution engine 114 continues the search from the caller of the function (backward symbolic execution toward the first line of the function) and returns to step S16. In step S19, if multiple callers of the function are identified, the search continues from each caller. Also, if a path condition is not satisfied during the search, the search is terminated.
[0040] <Features of the defect analysis device> The fault analysis device 100 identifies a statement / line where a fault-related exception (fault) occurs from the program execution log 220 and sets it as the analysis start point. If the analysis start point cannot be identified, the fault analysis device 100 presents candidates for the analysis start point to the user and sets the selected candidate as the analysis start point. The fault analysis device 100 searches the program in the opposite direction to the normal execution direction (reverse symbol execution) from the analysis start point to the analysis end point (entry point) specified by the user, and identifies and outputs the execution path 240 and the path condition.
[0041] By referring to the execution path 240, the user can understand how the process progresses and under what conditions in the program, causing the problem. This will enable the user to find the problem and correct the program. Furthermore, the user will be able to test the corrected program using the input parameter value 250 of the entry point that satisfies the path condition.
[0042] <<Variations>> In the above embodiment, the fault analysis device 100 searches for an input parameter value of an entry point that satisfies a path condition after completing a search (backward symbolic execution). The fault analysis device 100 may solve a path condition or detect an exception (fault) by taking into consideration the range of the input parameter value and the return value described in the program specification 230.
[0043] FIG. 6 is a diagram for explaining an execution path and a path condition according to a modified example of this embodiment. FIG. 6 includes source code 210 of two functions, function foobar40 and function qux50. Function foobar40 calls function qux50. In program specification 230, the range of the first parameter of function foobar40 is 1 to 5, the range of the second input parameter is 0 to 5, and the range of the return value is 1 to less than 10 (see analysis end point information display area 412 in FIG. 7 described later). In the following, the explanation will be continued on the assumption that an abnormality in the return value occurs in function foobar40 and function foobar40 is specified as the entry point. In this case, program execution log 220 includes a record of the call of function foobar40, a record of the call of function qux50, and a record of an exception (abnormality) related to the return value of function foobar40.
[0044] By analyzing program execution log 220, analysis starting point acquisition unit 112 detects that a return value exception has occurred in function foobar40. Since line 4 of function foobar40 is the only statement / line that returns to the caller, analysis starting point acquisition unit 112 sets the start point to line 4 of function foobar40. Since the range of the return value of the function foobar40 is 1 or more and less than 10, the analysis starting point acquisition unit 112 sets, for example, "c=10" as the path condition 43 of line 4. The analysis starting point acquisition unit 112 may set the path condition 43 by inquiring of the user.
[0045] The symbolic execution engine 114 starts at a starting point and searches through the program in the opposite direction to normal (forward) execution until it reaches an entry point. 6, symbolic execution engine 114 starts the search from line 3 of function foobar40, and reaches the call of function qux50 on line 3. The execution path at this point is from line 4 to line 3 of function foobar40. The symbolic execution engine 114 determines that the return value of function qux50 is 10 and searches for the statement to return to the caller of function qux50. In the case of Figure 6, the statements to return to the caller are lines 3 and 5. The symbolic execution engine 114 continues the search from each of lines 3 and 5.
[0046] The path condition at line 3 is "y = 10". Also, the condition for branching to line 3 at line 2 is "x < y". Therefore, the path condition 52 when the execution path is from line 3 to line 1 is "y = 10" and "x < y", resulting in "y = 10" and "x < 10" (described as "y = 10 & x < 10" in Figure 6). Similarly for line 5, the path condition 53 when the execution path is from line 5, line 3 to line 1 is "x = 10" and "y <= 10" (described as "x = 10 & y <= 10" in Figure 6).
[0047] Thus, the path condition 51 at line 1 of function qux50 is "y = 10 & x < 10" or "x = 10 & y <= 10" (described as "(y = 10 & x < 10)|(x = 10 & y <= 10)" in Figure 6). The symbolic execution engine 114 returns to line 3 of function foobar40, applies the path condition 51 to the variables of function foobar40, and the path condition 42 becomes "(a - b = 10 & a + b < 10)|(a + b = 10 & a - b <= 10)". The symbolic execution engine 114 continues the search further and reaches the first line of function foobar40 which is the entry point, obtaining "(a - b = 10 & a + b < 10)|(a + b = 10 & a - b <= 10)" for the path condition 41.
[0048] The SMT solver 115 solves the path condition in conjunction with the input parameter specifications of the function foobar 40. The input parameter specifications are that the first parameter a is 1 to 5, and the second parameter b is 0 to 5. By solving the path condition 41 in conjunction with this condition, the SMT solver 115 obtains "a=5" and "b=5". Next, the symbolic execution engine 114 uses these values to perform (forward) symbolic execution from the entry point to the analysis start point, and obtains the first path condition 43, "c=10".
[0049] 7 is a configuration diagram of a screen 400A of the defect analysis device 100 according to a modified example of this embodiment. The differences from the screen 400 (see FIG. 3) will be described below. The entry point information displayed in the analysis end point information display area 412 includes the specifications of the input parameters and return value. In addition to the entry point input parameter value 250, the analysis result information display area 413 displays the variable value of the start point when the function that is the entry point is called with this value.
[0050] In the above modification, the variable value "c=10" is set as the path condition 43 at the starting point, but this is not limiting. For example, a condition "c<1|c>=10" that is outside the range of return values in the specifications may be set. However, if the path condition is a condition rather than a numerical value, the symbolic execution engine 114 and SMT solver 115 that process the condition may slow down or may even become unable to process.
[0051] Fig. 8 is a flowchart (1) of a defect analysis process according to a modified example of this embodiment, and Fig. 9 is a flowchart (2) of a defect analysis process according to a modified example of this embodiment. Steps S31 to S39 are respectively similar to steps S11 to S17, S19, and S20 in Fig. 5. However, in step S37, if the statement / line currently being searched is the first line of the analysis end point (entry point) (step S37→YES), the symbol execution engine 114 proceeds to step S40 in Fig. 9.
[0052] In step S40, the SMT solver 115 solves the path conditions and finds input parameter values at which a malfunction occurs. In detail, the SMT solver 115 finds input parameter values 250 that satisfy the path conditions at the entry points and the conditions (specifications) related to the range of input parameter values of the function that is the entry point. In step S41, symbolic execution engine 114 performs forward symbolic execution from the entry point with the input parameter values determined in step S40.
[0053] In step S42, the symbolic execution engine 114 records the execution path and the variable values. In step S43, symbolic execution engine 114 proceeds to step S44 if the statement / line currently performing forward symbolic execution is the analysis start point (step S43→YES), and proceeds to step S45 if it is not the analysis start point (step S43→NO). In step S44, the symbolic execution engine 114 displays the results of the forward symbolic execution (see the analysis result information display area 413 shown in FIG. 7).
[0054] In step S45, the symbolic execution engine 114 identifies the function to be called in the function call. In step S46, symbolic execution engine 114 continues forward symbolic execution in the calling function with the input parameter values at the time of the call, and returns to step S42.
[0055] <<Variation: Exception>> In the above embodiment and modified examples, the exceptions are division by zero and input parameter values and return values that contradict the descriptions in program specification 230. Exceptions are not limited to program specification 230, and may include a call of a library function that contradicts the input parameter specifications of a library function called from a program (source code 210) and a return from a call of a library function that contradicts the return value specifications of the library function.
[0056] Other variations Although several embodiments of the present invention have been described above, these embodiments are merely illustrative and do not limit the technical scope of the present invention. For example, in the above-described embodiment, the analysis start point acquisition unit 112 detects an exception occurrence from the program execution log and sets the start point, but it is also possible to inquire of the user and acquire the start point and the exception (path condition) at the start point. If the program execution log does not record the occurrence of an exception, the user (developer) estimates the location of the exception occurrence from the last recorded function call and sets the start point.
[0057] The present invention can take various other embodiments, and furthermore, various modifications such as omissions and substitutions can be made without departing from the gist of the present invention. These embodiments and modifications are included in the scope and gist of the invention described in this specification, etc., and are included in the scope of the invention described in the claims and their equivalents. [Explanation of symbols]
[0058] 100 Failure analysis equipment 111 Call Relationship Generation Unit 112 Analysis starting point acquisition part 113 Analysis end point acquisition part 114 Symbolic Execution Engine 115 SMT Solver (Solver) 210 Source Code (Program) 220 Program Execution Log (Execution Log) 230 Program Specifications 240 Execution Path 250 Input Parameter Values 11,12,21,22,31,32,41,42,43,51,52,53 Path conditions 411 Information display area (information display area for analysis starting point) 412 Information display area (analysis end point information display area) 413 Information display area (Analysis result information display area) 431,432,433 Execution path
Claims
1. A program defect analysis device including an input of an execution log of a program, an analysis start point acquisition unit that acquires, from the execution log, a statement of the program in which the exception occurred as an analysis start point; an analysis end point acquisition unit that acquires, as an analysis end point, one or more functions selected from among functions that directly or indirectly call the function including the analysis start point; a symbolic execution engine that performs backward symbolic execution from the analysis start point to the analysis end point and outputs an execution path; A defect analysis device comprising:
2. The analysis start point acquisition unit When the statement in the program in which the exception occurred cannot be identified as one, a statement selected from among a plurality of statements in which the exception occurs is acquired as the analysis starting point.
2. The failure analysis device according to claim 1,
3. The above exceptions are: 0 subtraction, a function call with a value that is outside the range of input parameter values for the function described in the program specification of the program; a return from a function call with a value that is outside the range of function return values described in the program specification of said program; A function call with a value that is outside the range of input parameter values of a library function that is called by the program; and A return from a function call with a value outside the range of return values of a library function that the program calls Contains any of the following:
2. The failure analysis device according to claim 1,
4. Solver is also equipped, The symbolic execution engine calculates a path condition under which the exception occurs; The solver outputs a condition for an input parameter value of the function that is the analysis end point and satisfies the path condition, or outputs an input parameter value of the function that is the analysis end point and satisfies the path condition.
2. The failure analysis device according to claim 1,
5. Solver is also equipped, The symbolic execution engine calculates a path condition under which the exception occurs; The solver outputs input parameter values of a function that is the analysis end point that satisfies the path condition; The symbolic execution engine performs forward symbolic execution from the invocation of the analysis end point to the analysis start point with the input parameter values output by the solver, and outputs variable values at the analysis start point.
2. The failure analysis device according to claim 1,
6. A program for causing a computer to function as the defect analysis device according to any one of claims 1 to 5.
7. A method for analyzing a program defect including an input containing an execution log of the program, comprising: obtaining a statement of the program in which the exception occurred from the execution log as a starting point for analysis; acquiring, as an analysis end point, one or more functions selected from among functions that directly or indirectly call the function including the analysis start point; performing backward symbolic execution from the analysis start point to the analysis end point and outputting an execution path; A failure analysis method to perform.
Citation Information
Patent Citations
Reliability evaluation method and apparatus for software component
JP2012128727A
Software change program, software change device, and software change method
JP2016018253A
