Faulty part identifying program, faulty part identifying device, and faulty part identifying method
By inserting additional instructions to track memory content changes, the location of invalid data in a program is identified, simplifying data error correction and supporting program operation verification.
Patent Information
- Application Number
- JP2021057186
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-03-30
- Publication Date
- 2024-10-17
- Estimated Expiration
- 2041-03-30
AI Technical Summary
Existing programming languages lack effective mechanisms to identify the location of invalid data within a program, making it difficult to locate and correct data errors that cause unintended execution results.
Inserting additional instructions before and after data-modifying instructions in a program to track the history of memory content changes, allowing the identification of the location where invalid data is set by analyzing generated history information.
Enables efficient identification of invalid data locations, facilitating program operation verification and correction.
Smart Images

Figure 0007568934000001 
Figure 0007568934000002 
Figure 0007568934000003
Abstract
Description
[Technical field]
[0001] The present invention relates to a fraud portion identifying program, a fraud portion identifying device, and a fraud portion identifying method. [Background technology]
[0002] If a program contains data in a format that the programming language does not expect, when the program is executed, abnormal processing will occur and the execution result will be different from what the developer intended. In the following, such abnormal processing will be called a data error, and the data that caused it will be called invalid data.
[0003] Some programming languages have mechanisms for detecting data errors. For example, NetCOBOL provides a function that, when a program is executed under certain settings, checks the format of the target data before processing it, and reports an error if the data is invalid. This prevents invalid data from being processed and resulting in unintended execution results.
[0004] However, in the case of data errors, the point in the program where the incorrect data is processed may be far away from the point where the incorrect data was set. For this reason, even if a data error can be caught by inspection, it is not easy to determine where in the program the incorrect data that caused the error is located, and it may be difficult to verify the operation of the program. [Prior art documents] [Patent documents]
[0005] [Patent Document 1] Japanese Patent Application Publication No. 06-214825 Summary of the Invention [Problem to be solved by the invention]
[0006] According to one aspect, an object of the present invention is to support program operation verification. [Means for solving the problem]
[0007] According to one aspect, there is provided a program for identifying an incorrect portion, the program including a first instruction for changing the contents of a memory area based on data, a second instruction for acquiring the contents of the memory area is inserted before and after the first instruction, and the program into which the second instruction has been inserted is executed to generate history information indicating the history of each of the contents acquired by the second instructions, and a program for identifying, based on the history information, the location where the data that causes an error when the program is executed is set. Effect of the Invention
[0008] According to one aspect, it is possible to assist in program operation verification. [Brief description of the drawings]
[0009] [Figure 1] FIG. 1 is a schematic diagram showing an example of a process performed by the fraud part identifying device according to the first embodiment. [Diagram 2] FIG. 2 is a schematic diagram of the fraud location identifying device according to the first embodiment when executing an executable program. [Diagram 3] FIG. 3 is a schematic diagram showing a specific example of a source program. [Figure 4] FIG. 4 is a schematic diagram of the process performed by the fraud part identifying device according to the first embodiment. [Diagram 5] FIG. 5 is a schematic diagram of history information according to the first embodiment. [Figure 6] FIG. 6 is a schematic diagram of a message in the first embodiment. [Figure 7] FIG. 7 is a functional configuration diagram of the fraud portion identifying device according to the first embodiment. [Figure 8]FIG. 8(a) is a flowchart of the fraud portion identifying method according to the first embodiment, and FIG. 8(b) is a flowchart of the identifying process according to the first embodiment. [Figure 9] FIG. 9(a) is a schematic diagram of history information generated by the fraud part identifying device according to the first embodiment, and FIG. 9(b) is a schematic diagram of history information generated by a generating unit according to the second embodiment. [Figure 10] FIG. 10(a) is a schematic diagram of a third source program to be compiled by the fraudulent part identification device of the third embodiment, FIG. 10(b) is a schematic diagram of a third section of an executable program obtained by compiling the third source program by the fraudulent part identification device of the second embodiment, and FIG. 10(c) is a schematic diagram of history information generated by the fraudulent part identification device of the third embodiment by executing the executable program. [Figure 11] FIG. 11 is a schematic diagram of a source program compiled by the fraud part identifying device according to the third embodiment. [Figure 12] FIG. 12 is a schematic diagram of a fourth section of an executable program obtained by compiling a fourth source program by the fraud portion identifying device according to the third embodiment. [Figure 13] FIG. 13 is a schematic diagram showing the contents of a memory and a storage device included in the fraud part identifying device according to the third embodiment. [Figure 14] FIG. 14 is a schematic diagram of history information immediately before a data error occurs when the fifth source program calls the fourth source program for the second time in the third embodiment. [Figure 15] FIG. 15 is a schematic diagram of history information immediately after a data error occurs when the fifth source program calls the fourth source program for the second time in the third embodiment. [Figure 16] FIG. 16 is a hardware configuration diagram of the fraud part identifying device according to the first and second embodiments. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0010] (First embodiment) FIG. 1 is a schematic diagram showing an example of a process performed by the fraud part identifying device according to the first embodiment.
[0011] The fraud location identifying device 1 is a computer such as a server or a PC (Personal Computer), and generates an executable program 4 from a source program 3 using a compiler 2. The executable program 4 is a binary file that can be executed by the fraud location identifying device 1.
[0012] Although there is no particular limitation on the programming language used to write the source program 3, the following description will be given taking COBOL as an example of the programming language.
[0013] The source program 3 may be divided into multiple parts. Here, it is assumed that the source program 3 is divided into a first source program 3a with an ID of "PROG-A" and a second source program 3b with an ID of "PROG-B". The ID is an identifier that uniquely identifies each of the source programs 3a and 3b within the source program 3.
[0014] In this case, the executable program 4 has a first section 4a that performs processing corresponding to the first source program 3a, and a second section 4b that performs processing corresponding to the second source program 3b.
[0015] If illegal data not anticipated by the programming language is written in the source program 3, a data error occurs when the executable program 4 is executed. In this embodiment, in order to identify the location in the source program 3 where the illegal data that causes the data error is written, the illegal location identification device 1 inserts an instruction 4x into the executable program at the time of compilation.
[0016] For example, when an executable program 4 includes an instruction 7 that changes the contents of a storage area 5 in memory based on data 6, such as a MOVE instruction, the fraud location identifying device 1 inserts an instruction 4x before and after the instruction 7. The instruction 4x inserted before the instruction 7 is an instruction for obtaining the contents of the storage area 5 before the execution of the instruction 7 and the position of the statement corresponding to the instruction 7 in the source program 3. The instruction 4x inserted after the instruction 7 obtains the contents of the storage area 5 after the execution of the instruction 7 and the position of the statement corresponding to the instruction 7 in the source program 3.
[0017] FIG. 2 is a schematic diagram of the fraud location identifying device 1 when executing an executable program 4. As shown in FIG.
[0018] As shown in Fig. 2, when executing the executable program 4, the fraud part identifying device 1 calls the runtime 8. The runtime 8 is a program that checks the format of the data 6 (see Fig. 1) to determine whether the data 6 is fraudulent. If the check determines that the data is fraudulent, the runtime 8 outputs an error 9.
[0019] Furthermore, when the fraud location identification device 1 executes the executable program 4, an instruction 4x (see FIG. 1) acquires the contents of the memory area 5 and the position of the statement corresponding to the instruction 7 in the source program 3. The fraud location identification device 1 generates history information 10 indicating the history of the contents and positions of the memory area 5 thus acquired. Then, by referring to the history information 10, the fraud location identification device 1 identifies the location in the source program 3 where the fraudulent data 6 was set.
[0020] Next, the process of the fraud location device 1 will be further described with reference to a specific example of the source program 3.
[0021] Fig. 3 is a schematic diagram showing a specific example of a source program 3. In Fig. 3, the file name of the first source program 3a is "a.cob" and the file name of the second source program 3b is "b.cob." These source programs 3a and 3b perform the following processes.
[0022] First, the statement "01 WK-RECORD." on line 000011 of the first source program 3a is a statement that defines the structure "WK-RECORD". The statements "02 WK-ITEM-1 PIC S9(4)" on line 000012 and "02 WK-ITEM-2 PIC S9(4)" on line 000013 are statements that define the members of the structure "WK-RECORD". Note that the "(4)" at the end of these statements indicates that the size of the member is 4 bytes. Therefore, the total size of "WK-RECORD" is 8 bytes.
[0023] Also, the statement on line 000100, "MOVE INPUT-RECORD TO WK-RECORD," stores the data "INPUT-RECORD" in "WK-RECORD," a storage area in memory. This "WK-RECORD" is the same as the structure defined on line 000011.
[0024] And the statement on line 000200, "CALL "PROG-B" USING WK-ITEM-2.", calls the second source program 3b using the member "WK-ITEM-2" of the structure "WK-RECORD" as an argument. In this case, the address of "WK-ITEM-2" is passed to the second source program 3b.
[0025] On the other hand, the statement "01 PARAM-NUM PIC S9(4)" on line 000011 of the second source program 3b defines "PARAM-NUM" which receives the argument. In this case, the address of "WK-ITEM-2" passed as the argument becomes the address of "PARAM-NUM".
[0026] And "ADD 1 TO PARAM-NUM." on line 000300 is a statement that adds "1" to the data stored in "PARAM-NUM." In executable program 4, the command corresponding to this "ADD 1 TO PARAM-NUM." is an ADD command that changes the contents of the area in memory corresponding to "PARAM-NUM" based on the data "1."
[0027] In the following, we will assume that the COBOL specifications do not allow "-0" to be specified as the target of an ADD statement. In this case, "-0" is invalid data. Let us also assume that the data stored in "PARAM-NUM" in "ADD 1 TO PARAM-NUM." on line 000300 is "-0".
[0028] The process performed by the fraud part identifying device 1 in this case will be described with reference to Fig. 4. Fig. 4 is a schematic diagram of the process performed by the fraud part identifying device 1.
[0029] First, the fraud location identifying device 1 acquires the source program 3 (step P1). Note that the source program 3 is divided into a first source program 3a and a second source program 3b, but for simplicity, only the first source program 3a is shown in FIG.
[0030] Next, the fraud location identifying device 1 accepts input of a command 13 via a command line (step P2). "cobol" in the command 13 is an instruction to compile a source program 3 with a COBOL compiler 2. The option "-D1" indicates an instruction to insert the above-mentioned instruction 4x during compilation. "a.cob" is the file name of the source program to be compiled.
[0031] Next, the fraud portion identifying device 1 compiles the first source program 3a with the file name "a.cob" to generate a first section of the executable program 4 (step P3).
[0032] In the first section 4a, the above-mentioned command 4x is inserted before and after command 7, which corresponds to the sentence "MOVE INPUT-RECORD TO WK-RECORD." Note that command 7 is an example of a first command, and command 4x is an example of a second command.
[0033] The instruction 4x inserted before instruction 7 is an instruction to obtain the contents of "WK-RECORD" before the contents of "WK-RECORD" were changed by instruction 7. The instruction 4x also obtains the line number (000100) of the statement "MOVE INPUT-RECORD TO WK-RECORD." corresponding to instruction 7 as the position of that statement in the first source program 3a.
[0034] Moreover, instruction 4x inserted after instruction 7 is an instruction to obtain the contents of "WK-RECORD" after the contents of "WK-RECORD" have been changed by instruction 7. Instruction 4x obtains the line number (000100) of the statement "MOVE INPUT-RECORD TO WK-RECORD." corresponding to instruction 7 as the position of that statement in the first source program 3a.
[0035] In the same manner, the fraud portion identifying device 1 generates a second section 4b of the executable program 4 by compiling a second source program 3b having a file name "b.cob".
[0036] Next, the fraud portion identifying device 1 executes the executable program 4 to generate the history information 10 (step P4).
[0037] 5 is a schematic diagram of the history information 10. The history information 10 is information in which information acquired by the instruction 4x is arranged in the order in which the instruction 4x is executed. In this example, the history information 10 is arranged in chronological order with each of the following items associated with each other: "#serial number", "source file", "line", "event type", "address", "size", and "content".
[0038] "#serial number" is a value indicating the order in which each of the multiple instructions 4x was executed. In the following, each line of the history information 10 that is uniquely identified by "#serial number" will be referred to as a log.
[0039] "Source file" is the file name of source program 3 in which instruction 4x is written. "Line" is the line number indicating the position in source program 3 where the statement corresponding to instruction 7 is written.
[0040] "Event type" is information indicating whether instruction 4x was executed before or after instruction 7 was executed. Here, "before execution" indicates that instruction 4x was executed before instruction 7 was executed, and "after execution" indicates that instruction 4x was executed after instruction 7 was executed.
[0041] "Address" is the start address of the storage area 5 (see FIG. 1). In the example of FIG. 4, the start address of "WK-RECORD" is "Address".
[0042] “Size” is the size of the memory area 5. In this example, the size of “WK-RECORD” is 8 bytes, so “Size” is 8 bytes. “Contents” is the content of the data stored in the memory area 5.
[0043] In the example of Figure 5, it is assumed that the first source program 3a with the file name "a.cob" is called twice. For example, the first call records the logs with "#serial number" of "11" and "12", and the second call records the logs with "#serial number" of "53" and "54".
[0044] It is assumed that in the second call, "-0" is stored in the lowest 4 bytes of "WK-RECORD", and the lowest 4 bytes "30303050" of "Content" in the log with "#serial number" of "54" represent "-0" in zoned decimal format.
[0045] Referring again to Figure 4, the runtime 8 then checks the format of the data in the executable program 4 (step P5). In this example, the runtime 8 checks whether the format of "PARAM-NUM" on line 000300 of the second source program 3b (see Figure 3(b)) is permitted by COBOL.
[0046] As an example, the runtime 8 receives the start address 11 and size 12 of "PARAM-NUM" as arguments, and checks the format of "PARAM-NUM" stored in the start address 11. The start address 11 and size 12 of "PARAM-NUM" are passed to the runtime 8 as arguments by an instruction inserted by the compiler 2 immediately before the ADD statement on line 000300 of the second source program 3b during compilation.
[0047] In this example, as explained with reference to Figure 3, "PARAM-NUM" contains "-0", which is not permitted in COBOL. Therefore, the runtime 8 determines that the data corresponding to "PARAM-NUM" in the executable program 4 is invalid, and outputs error 9.
[0048] Next, the incorrect portion identifying device 1 uses the history information 10 to identify a portion where the incorrect data "-0" that will cause an error when the executable program 4 is executed is set (step P6).
[0049] For example, assume that the starting address 11 passed to the runtime 8 in step P4 is "12345674" and the size 12 is 4 bytes. In this case, the fraud location identifying device 1 identifies a 4-byte area starting from "12345674" as the range of the fraud area in which the fraudulent data "-0" is stored.
[0050] Furthermore, the fraud portion identifying device 1 traces back the most recent log of the history information 10 to identify the "address" contained in the fraud area.
[0051] In this example, the "address" of the log with "#serial number" of "54" is "12345670" and its "size" is 8 bytes, so the "address" of that log is included in the invalid area. Furthermore, the "content" of this log is "-0", which is an invalid data format.
[0052] Furthermore, the log going back even further with a "#serial number" of "53" also contains invalid area, but the "content" of that log, "0000000036373849", is not the invalid data "-0".
[0053] Therefore, based on the contents of the log with the "#serial number" of "54", the incorrect part identification device 1 determines that the incorrect data "-0" is set in line 000100 of the first source program 3a with the file name "a.cob".
[0054] Next, the fraud portion identifying device 1 displays a message 15 indicating the portion of the instruction 7 in which the fraudulent data "-0" is set (step P7).
[0055] 6 is a schematic diagram of the message 15. At the end 15a of the message 15, the file name "a.cob" of the first source program 3a that contains the invalid data "-0" and the line number "00100" where the invalid data is set in the first source program 3a are displayed.
[0056] This completes the basic processing executed by the fraud portion identifying device 1.
[0057] This allows the developer to identify the location in the source program 3 where invalid data has been set based on the message 15, making it easier to correct the source program 3.
[0058] Next, the functional configuration of the fraud part identifying device 1 according to this embodiment will be described.
[0059] 7 is a functional configuration diagram of the fraud part identifying device 1. As shown in FIG 7, the fraud part identifying device 1 has a communication unit 21, an input unit 22, a display unit 23, a storage unit 24, and a control unit 25.
[0060] Among these, the communication unit 21 is a processing unit that connects the fraud part identifying device 1 to a network such as a LAN (Local Area Network) or the Internet. The input unit 22 is a processing unit that allows a developer to input various commands to a command line or the like. The display unit 23 is a processing unit that displays the error 9 and message 15 in FIG. 4.
[0061] On the other hand, the storage unit 24 stores the compiler 2, the source program 3, the executable program 4, the runtime 8, and the history information 10 described above.
[0062] The control unit 25 is a processing unit that controls each unit of the fraud part identifying device 1. As an example, the control unit 25 includes an acquisition unit 31, a reception unit 32, an insertion unit 33, an inspection unit , a generation unit 35, and an identification unit .
[0063] Of these, the acquisition unit 31 is a processing unit that acquires the source program 3 via the communication unit 21 and stores the source program 3 in the storage unit 24. The acceptance unit 32 is a processing unit that accepts an input of the command 13.
[0064] When the receiving unit 32 receives an input of the command 13, the insertion unit 33 compiles the source program 3 using the compiler 2 to generate an executable program 4. Furthermore, the insertion unit 33 inserts an instruction 4x before and after the instruction 7 in the executable program 4, and stores the executable program 4 in the storage unit 24.
[0065] The inspection unit 34 is a processing unit that inspects the format of data in the executable program 4 by calling the runtime 8. For example, the inspection unit 34 receives the start address 11 and size 12 of the data to be inspected as arguments, and inspects the format of the data stored in the start address 11. The start address 11 and size 12 of the data to be inspected are generated by the insertion unit 33 at the time of compilation, and the inspection unit 34 receives them as arguments.
[0066] The generating unit 35 is a processing unit that generates the history information 10 by executing the executable program 4 and stores the history information 10 in the storage unit 24 .
[0067] The identification unit 36 is a processing unit that identifies a location where invalid data that will cause an error during execution of the executable program 4 is set, based on the history information 10. For example, the identification unit 36 executes the process of step S16 in Fig. 8 to identify line 000100 of the first source program 3a as the location where the invalid data "-0" is set.
[0068] Furthermore, the identifying unit 36 issues an instruction to the display unit 23 to display a message 15 indicating the identified location.
[0069] Next, the method for identifying an incorrect portion according to the present embodiment will be described. 8A is a flowchart of the fraud location identification method according to this embodiment. First, the acquisition unit 31 acquires the source program 3 via the communication unit 21, and stores the source program 3 in the storage unit 24 (step S11).
[0070] Next, the reception unit 32 receives an input of the command 13 (step S12).
[0071] Next, the insertion unit 33 compiles the source program 3 to generate the executable program 4 in which the instruction 4x is inserted before and after the instruction 7, and stores it in the storage unit 24 (step S13).
[0072] Next, the generation unit 35 executes the executable program 4 to generate the history information 10, and stores the history information 10 in the storage unit 24 (step S14).
[0073] Next, the checking unit 34 checks the format of data in the executable program 4 by calling the runtime 8 (step S15).
[0074] Thereafter, the identifying unit 36 performs an identifying process based on the history information 10 to identify a location where incorrect data that will cause an error when the executable program 4 is executed is set (step S16).
[0075] Next, the identification unit 36 issues an instruction to the display unit 23 to display the message 15 indicating the identified location, and the display unit 23, upon receiving the instruction, displays the message 15 (step S17).
[0076] This completes the basic process of the fraud location identification method according to this embodiment.
[0077] Next, the identification process in step S16 will be described below. Fig. 8(b) is a flowchart of the identification process in step S16.
[0078] First, the identifying unit 36 identifies the range of the illegal area in which the illegal data is stored (step S21). As described above, if the start address 11 (see FIG. 4) is "12345674" and the size 12 is 4 bytes, the identifying unit 36 identifies the 4-byte area starting from "12345674" as the range of the illegal area in which the illegal data "-0" is stored.
[0079] Next, the identifying unit 36 identifies, from among the multiple "addresses" in the history information 10, those that are included in the range of the illegal area identified in step S21 (step S22).
[0080] As described above, when the top address 11 (see FIG. 4) is "12345674" and the size 12 is 4 bytes, the identifying unit 36 identifies an "address" with a "#serial number" of "54" in the history information 10 of FIG.
[0081] Next, when the illegal data "-0" is stored in the "content" corresponding to the identified "address", the identification unit 36 identifies the "line" corresponding to the "address" as the location where the illegal data "-0" is set (step S23). In the above example, the identification unit 36 identifies "000100" in the "line" with "#serial number" of "54" as the location where the illegal data is set. Then, the process returns to the caller.
[0082] This completes the basic process of the fraud location identification method according to this embodiment.
[0083] According to the present embodiment described above, the fraud location identifying device 1 can automatically identify the location where fraudulent data is set in the source program 3, based on the history information 10. Therefore, even if the location where the fraudulent data is set in the source program 3 is far from the location where the data is processed, the developer can immediately identify the location where the fraudulent data is set, and the developer's verification of program operation can be supported.
[0084] Second embodiment In this embodiment, a method for simplifying the history information 10 will be described.
[0085] FIG. 9(a) is a schematic diagram of the history information 10 generated by the fraud part identifying device 1 according to the first embodiment.
[0086] In this example, the "contents" of the logs with "#serial number" of "53" and "54" are the same. This is because the contents of memory area 5 did not change before and after command 7 in Fig. 1 was executed. Multiple logs with the same "contents" like this do not represent a change in the "contents," and are therefore of no use to fraud location identification device 1 in identifying the location of fraudulent data.
[0087] Therefore, in this embodiment, the generation unit 35 does not add to the history information 10 the logs having the "#serial number" of "53" and "54".
[0088] Although the logs with "#serial number" of "11" and "12" have different "contents", when the fraud part identifying device 1 identifies the part of the fraudulent data, only the log "12" after "contents" have been changed and execution is sufficient. Therefore, in this embodiment, the generating unit 35 adds only the log "12" after execution to the history information 10.
[0089] FIG. 9B is a schematic diagram of the history information 10 thus generated by the generation unit 35 in this embodiment.
[0090] As shown in FIG. 9B, the size of the history information 10 can be reduced by not adding the logs with "#serial number" "53" and "54" to the history information 10.
[0091] In addition, for each of the logs with “#serial number” of “11” and “12”, the generation unit 35 reassigns the “#serial number” to “6” and adds only the “after execution” log to the history information 10.
[0092] Note that the generation unit 35 adds only the lowest 4 bytes "36373849" that were changed by instruction 7 out of the "contents" of the logs with "#serial number" of "11" and "12" to the history information 10, and does not add the highest 4 bytes "00000000" to the history information 10. This enables further simplification of the history information 10. In response to adding only the lowest 4 bytes to the history information 10 in this way, the generation unit 35 stores "4" in "size". Then, the generation unit 35 stores "12345674", which is the starting address of the lowest 4 bytes, in "address".
[0093] As described above, in this embodiment, the history information 10 can be simplified, and therefore the data size of the history information 10 can be reduced.
[0094] Third embodiment When executable program 4 is executed, a portion of memory area may be allocated and then released shortly after that area is allocated. For example, when a function included in executable program 4 is executed, a stack area for local variables defined only within that function is allocated when the function is executed, and the stack area is released when the execution of the function ends.
[0095] When data is set in a partial area that is released in such a short time using a MOVE statement or the like, if no data error occurs between the time the partial area is allocated and the time it is released, it is pointless to add a log related to that data to the history information 10. In this embodiment, such waste is eliminated as follows.
[0096] FIG. 10(a) is a schematic diagram of a third source program 3c to be compiled by the fraud location identifying device 1 in this embodiment.
[0097] "01 WK-1 PIC S9(4) VALUE 0." on line 000011 of the third source program 3c is a statement that defines the local variable "WK-1." Also, "01 WK-2 PIC S9(4)." on line 000012 is a statement that defines the local variable "WK-2."
[0098] The statement "PROCEDURE DIVISION." on line 000100 indicates the start of the procedural part of the third source program 3c. Furthermore, the statement "END-PROGRAM. PROG-C." on line 000200 indicates the end of the procedural part of the third source program 3c.
[0099] In this case, a portion of the memory is allocated for storing the local variables "WK-1" and "WK-2" on line 000100, and the portion of the memory is released on line 000200.
[0100] FIG. 10(b) is a schematic diagram of a third section 4c of the executable program 4 obtained by the insertion unit 33 of the fraud portion identifying device 1 compiling the third source program 3c in this embodiment.
[0101] As shown in FIG. 10(b), the insertion unit 33 inserts instructions 4p and 4q before the instruction sequence 4y in the procedural part of the third source program 3c, and inserts instructions 4r and 4s after the instruction sequence 4y.
[0102] The instruction sequence 4y is an instruction sequence in which the instructions in the procedural portion from line 000101 to line 000199 of the third source program 3c are lined up.
[0103] In addition, instructions 4p and 4q are both examples of a third instruction, and are instructions that add information to the history information 10 indicating that a portion of the memory in which the local variables “WK-1” and “WK-2” are stored is available for use by the executable program 4c.
[0104] On the other hand, instructions 4r and 4s are both examples of the fourth instruction. These instructions 4r and 4s are instructions that add information to the history information 10 indicating that a portion of the memory area in which the local variables “WK-1” and “WK-2” are stored has become unavailable to the executable program 4c.
[0105] FIG. 10C is a schematic diagram of the history information 10 generated by the generation unit 35 of the fraud portion identifying device 1 in this embodiment by executing the executable program 4.
[0106] As shown in FIG. 10(c), by executing the above-mentioned instructions 4p and 4q, information "available" indicating that a portion of the memory area has become available is added to the "event type" of the history information 10.
[0107] Furthermore, by executing instructions 4r and 4s, information "unavailable" indicating that a portion of the memory area has become unavailable is added to the "event type" of the history information 10.
[0108] In this embodiment, the fraud portion identifying device 1 simplifies the history information 10 by using information such as "available" and "unavailable."
[0109] FIG. 11 is a schematic diagram of a source program 3 compiled by the fraud location identifying device 1 in this embodiment.
[0110] Here, the source program 3 includes a fourth source program 3d with the file name "d.cob" and a fifth source program 3e with the file name "e.cob". Assume that the fifth source program 3e calls the fourth source program 3d on lines 000100 and 000200. Also assume that in the second call on line 000200, invalid data "-0" is set in the variable "LOC-1" of the fourth source program 3d.
[0111] FIG. 12 is a schematic diagram of a fourth section 4d of the executable program 4 obtained by the insertion unit 33 of the fraud portion identifying device 1 compiling the fourth source program 3d.
[0112] As shown in FIG. 12, the fourth section 4d includes instructions 4t to 4w, 4z, and 7a to 7c.
[0113] Among these, instructions 7a to 7c are instructions corresponding to the statements at line numbers 000200 to 000202 of the fourth source program 3d, respectively.
[0114] In addition, instruction 4t inserted before instruction 7a is an instruction to obtain the contents of the storage area in memory corresponding to "LOC-RECORD" and the position of the statement corresponding to instruction 7a before instruction 7a stores the data "PARAM" in "LOC-RECORD".
[0115] The instruction 4t inserted after the instruction 7a is an instruction to obtain the contents of the storage area in memory corresponding to "LOC-RECORD" and the position of the statement corresponding to the instruction 7a after the instruction 7a stores the data "PARAM" in "LOC-RECORD".
[0116] Similarly, instructions 4u and 4v are instructions for obtaining the contents of the storage area in memory before the execution of instructions 7b and 7c, respectively, and the positions of statements corresponding to the instructions 7b and 7c.
[0117] On the other hand, instruction 4w is an example of a third instruction, and is an instruction to add information to history information 10 indicating that a portion of memory in which the local variable “LOC-RECORD” is stored is available to the fourth executable program 4d.
[0118] Instruction 4z is an example of a fourth instruction, and is an instruction to add information to history information 10 indicating that a portion of memory in which the local variable “LOC-RECORD” is stored has become unavailable to the fourth executable program 4d.
[0119] 13 is a schematic diagram showing the contents of the memory 1a and storage device 1b included in the fraud part identifying device 1. Of these, the memory 1a is a volatile memory such as a DRAM (Dynamic Random Access Memory), and the storage device 1b is a storage such as an HDD (Hard Disc Drive) or an SDD (Solid State Drive).
[0120] In this embodiment, the generation unit 35 of the fraud part identifying device 1 stores the history information 10 in the storage device 1b, and stores a template 10a of the history information 10 in the memory 1a.
[0121] 13 is the history information when the fifth source program 3e calls the fourth source program 3d for the first time (line 000100). In the first call, the invalid data "-0" is not set in the fourth source program 3d.
[0122] Further, the function of the generation unit 35 in this embodiment can be realized, for example, by the fraud location identifying device 1 executing the following COBOL runtime.
[0123] COB_DTLOG(EV_AVAILABLE, &LOC-RECORD, 8, PERSISTENCE_LOCAL); Note that the first argument, "EV_AVAILABLE", is a variable that indicates that the event type is "available". The second argument, "&LOC-RECORD", is the starting address of the area where the variable "LOC-RECORD" is stored. The third argument, "8", is the size of the variable "LOC-RECORD". The fourth variable, "PERSISTENCE_LOCAL", indicates that the variable "LOC-RECORD" is a local variable.
[0124] In this embodiment, first, the generating unit 35 of the fraud portion identifying device 1 generates a template 10a of the history information 10 in the memory 1a.
[0125] In the template 10a, logs with "#serial number" of "35", "40", "42", and "67" are generated. These logs correspond to the information acquired by the instructions 4w, 4t, 4v, and 4z, respectively. Note that the logs with "#serial number" of "40" and "42" are simplified by the fraud location identifying device 1 according to the second embodiment.
[0126] Here, as described above, it is assumed that the fifth source program 3e calls the fourth source program 3d for the first time, and that the invalid data "-0" is not set in the fourth source program 3d.
[0127] In this case, no data error occurs between the time when the partial area in which the local variable "LOC-RECORD" is stored is allocated in memory 1a and the time when the partial area is released. Therefore, the logs with "#serial number" of "40" and "42" that contain the contents of the storage areas of the local variable "LOC-RECORD" and its member variable "LOC-1" are not useful for identifying the locations where invalid data was set.
[0128] Therefore, the generation unit 35 does not add the logs with "#serial number" of "40" and "42" to the history information 10 of the storage device 1b, and deletes them from the memory 1a. Similarly, the generation unit 35 does not add the logs with "#serial number" of "35" and "67", which indicate that a portion of the area where "LOC-RECORD" is stored has become available and unavailable, respectively, to the history information 10 of the storage device 1b, and deletes them from the memory 1a.
[0129] This reduces the capacity of the history information 10 in the storage device 1b, making it possible to save capacity in the storage device 1b.
[0130] On the other hand, the log with "#serial number" of "41" is a log showing the contents of a variable "WK-1" that is different from the local variable "LOC-RECORD". The period from when the memory area in which the variable "WK-1" is stored is secured to when it is released is different from that of the local variable "LOC-RECORD". Therefore, the generation unit 35 adds the log with "#serial number" of "41" to the history information 10 of the storage device 1b.
[0131] FIG. 14 is a schematic diagram of the history information 10 immediately before a data error occurs when the fifth source program 3e calls the fourth source program 3d for the second time (line 000200).
[0132] At this point, logs with "#serial number" of "88", "93", and "95" are generated in the template 10a in the memory 1a. These logs correspond to the information acquired by the instructions 4w, 4t, and 4v in Fig. 12, respectively. Note that the log with "#serial number" of "93" has been simplified by the fraud portion identifying device 1 according to the second embodiment.
[0133] Furthermore, the logs with "#serial number" of "88", "93", and "95" are logs that contain the contents of the storage areas of the local variable "LOC-RECORD" and its member variable "LOC-1", and the storage area of the local variable "LOC-RECORD" has not been released at this point. Therefore, the generation unit 35 reserves the decision on whether to add these logs to the history information 10 of the storage device 1b, and does not add these logs to the history information 10 at this point.
[0134] On the other hand, the log with "#serial number" of "94" is a log showing the contents of a variable "WK-1" that is different from the local variable "LOC-RECORD". The period from when the memory area in which the variable "WK-1" is stored is secured to when it is released is different from that of the local variable "LOC-RECORD". Therefore, at this point in time, the generation unit 35 adds the log with "#serial number" of "94" to the history information 10 of the storage device 1b.
[0135] FIG. 15 is a schematic diagram of the history information 10 immediately after a data error occurs when the fifth source program 3e calls the fourth source program 3d for the second time (line 000200).
[0136] When a data error occurs in this way, the generation unit 35 adds the logs in the memory 1a with "#serial number" of "88," "93," and "95" to the history information 10 in the storage device 1b. Then, these logs are deleted from the memory 1a.
[0137] This completes the basic process of the fraud location identification method according to this embodiment.
[0138] According to the present embodiment described above, if no data error occurs during the period from when a partial area of memory 1a in which local variables are stored is allocated to when it is released, the log for that period is deleted from memory 1a, as shown in Fig. 13. This reduces the capacity of history information 10 stored in storage device 1b, thereby making it possible to save the capacity of storage device 1b.
[0139] (Hardware configuration) Next, a hardware configuration of the fraud part identifying device 1 according to the first and second embodiments will be described.
[0140] FIG. 16 is a hardware configuration diagram of the fraud part identifying device 1 according to the first and second embodiments.
[0141] 16, the fraud portion identifying device 1 includes a memory 1a, a storage device 1b, a processor 1c, a communication interface 1d, a display device 1e, an input device 1f, and a media reading device 1g. These components are connected to each other by a bus 1h.
[0142] Of these, the storage device 1b is a non-volatile storage such as an HDD or SSD, and stores the error portion identification program 100 according to this embodiment.
[0143] The fraud portion identification program 100 may be recorded on a computer-readable recording medium 1k, and the processor 1c may read the fraud portion identification program 100 via a medium reader 1g.
[0144] Such recording media 1k include physically portable recording media such as CD-ROMs, DVDs, and USB memories. Also, semiconductor memories such as flash memories and hard disk drives may be used as the recording media 1k. These recording media 1k are not temporary media such as carrier waves that do not have a physical form.
[0145] Furthermore, the fraud portion identification program 100 may be stored in a device connected to a public line, the Internet, a LAN, etc. In that case, the processor 1c may read and execute the fraud portion identification program 100.
[0146] On the other hand, the memory 1a is hardware that temporarily stores data, such as a DRAM, and the fraud portion identification program 100 is deployed on it.
[0147] The processor 1c is hardware such as a CPU or a GPU that controls each part of the fraud part identifying device 1. The processor 1c also executes the fraud part identifying program 100 in cooperation with the memory 1a.
[0148] In this manner, the memory 1a and the processor 1c cooperate to execute the fraud part identifying program 100, thereby implementing a control unit 25 (see FIG. 7) of the fraud part identifying device 1. The control unit 25 includes an acquisition unit 31, a reception unit 32, an insertion unit 33, an inspection unit 34, a generation unit 35, and an identification unit 36.
[0149] Moreover, the storage unit 24 (see FIG. 7) is realized by the memory 1a and the storage device 1b.
[0150] Furthermore, the communication interface 1d is hardware such as a network interface card (NIC) for connecting the fraud part identifying device 1 to a network such as a LAN or the Internet. The communication interface 1d realizes a communication unit 21 (see FIG. 7).
[0151] The display device 1e is hardware such as a liquid crystal display or a touch panel for displaying the error 9 and message 15 in Fig. 4. The display device 1e realizes a display unit 23 (see Fig. 7).
[0152] The input device 1 f is hardware such as a keyboard and a mouse that allows the developer to input commands 13 to the fraud portion identifying device 1 .
[0153] The medium reading device 1g is hardware such as a CD drive, a DVD drive, or a USB interface for reading the recording medium 1k. [Explanation of symbols]
[0154] 1...malfunction identification device, 2...compiler, 3...source program, 3a-3e...first to fifth source programs, 4...executable program, 4a-4d...first to fourth sections, 5...memory area, 6...data, 8...runtime, 10...history information, 10a...template, 11...starting address, 12...size, 13...command, 15...message.
Claims
1. inserting a second instruction for acquiring the contents of a storage area of a memory before and after a first instruction in a program including the first instruction for changing the contents of the storage area based on data; generating history information indicating a history of each of the contents acquired by the second instructions by executing the program into which the second instructions are inserted; identifying a location where the data that causes an error during execution of the program is set based on the history information; A program for identifying fraudulent areas to cause a computer to execute a process.
2. causing the computer to execute a process of receiving an input of an instruction to insert the second command into the program; 2. The program according to claim 1, wherein the process of inserting the second instruction is performed by using a compiler when the input of the instruction is accepted.
3. if the contents of the storage area do not change before and after the execution of the first instruction, the contents are not added to the history information; The fraudulent portion identifying program according to claim 1 , for causing the computer to execute a process.
4. The second instruction further obtains a start address of the memory area and a position of a statement corresponding to the first instruction in a source program of the program; the history information has the content, the starting address, and the position, which are associated with each other; The process of identifying the location includes: Identifying a range of an area in the memory in which the data is stored; Identifying a leading address included in the range from among the leading addresses in the history information; when the illegal data is stored in the content corresponding to the specified top address, the position corresponding to the specified top address is specified as the location.
2. The program according to claim 1, further comprising a process for detecting a fraudulent portion.
5. inserting a third instruction for adding information about a part of the memory that has become available to the program to the history information; inserting a fourth instruction for adding information that the partial area has become unavailable to the program to the history information; when the data exists in the partial area, if the error does not occur during a period from the execution of the third instruction to the end of the execution of the fourth instruction, delete the history information existing in the memory during the period. The fraudulent portion identifying program according to claim 1 , for causing the computer to execute a process.
6. an insertion unit that inserts a second instruction for acquiring the content of a storage area of a memory before and after a first instruction in a program including the first instruction for changing the content of the storage area based on data; a generating unit that generates history information indicating a history of each of the contents acquired by the second instruction by executing the program into which the second instruction is inserted; an identification unit that identifies a location where the data that causes an error during execution of the program is set based on the history information; 13. An apparatus for identifying an illegal portion comprising:
7. The computer inserting a second instruction for acquiring the contents of a storage area of a memory before and after a first instruction in a program including the first instruction for changing the contents of the storage area based on data; generating history information indicating a history of each of the contents acquired by the second instructions by executing the program into which the second instructions are inserted; identifying a location where the data that causes an error during execution of the program is set based on the history information; 2. A method for identifying an incorrect portion, comprising:
Citation Information
Patent Citations
Program bug latent area extraction device
JP1994214825A
Method and system for instruction change / Insertion of object program
JP1996147155A
Reverse execution debugging system
JP1997006647A
Computer simulator and simulation method
JP2000040018A
Debugging support device, method therefor and recording medium recorded with softwater for supporting debugging
JP2000207246A
