Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method for a re-recording software program execution process, which not only eliminates random factors and can stably re-record all software program faults, but also has high reliability and wide application range, and the re-recording method is simple to operate and has good practicability.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows:
a method of replicating a software program execution process for accurately locating software program faults, the software program including a number of software subroutines, comprising the steps of:
pre-packaging interfaces of all software programs;
when the software program runs, all data acquired by each software subprogram through an interface and a return code of the interface are stored into corresponding each copy data, and all the copy data are stored in a file according to the sequence of generation time;
when a software program is copied, the internal state of a failed software subprogram is marked as a copy mode, after the state mark of the copy mode is identified by an interface of the failed software subprogram, when data needs to be acquired through the interface, stored data and a return code of the interface are sequentially read from corresponding copy data, and the failed software subprogram runs according to the read data and the return code to realize the failure of the software program so as to locate the failure of the software program.
On the basis of the technical scheme, when the software program is copied, the failed software subprogram runs, and other software subprograms are in an idle state.
On the basis of the technical scheme, the method further comprises the following steps: and (4) while copying the software program, positioning the fault of the software program according to the recorded program log.
On the basis of the technical scheme, the method further comprises the following steps: while copying the software program, the method of code single step debugging is used to locate the software program fault.
On the basis of the technical scheme, the interface of the software program comprises an operating system interface and a communication interface.
The invention also provides a storage medium, which stores a computer program, and the computer program realizes the method of the execution process of the copy software program when being executed by a processor.
The invention also provides an electronic device, which comprises a memory and a processor, wherein the memory is stored with a computer program running on the processor, and the processor executes the computer program to realize the method for executing the copy software program.
The invention also provides a system for executing the copy software program, wherein the software program comprises a plurality of software subprograms, and the software subprograms comprise:
the packaging module is used for packaging the interfaces of all software programs;
the storage module is used for storing all data acquired by each software subprogram through an interface and the return code of the interface into corresponding each copy data when the software program runs, and storing all the copy data in a file according to the sequence of generation time;
and the disk copying module is used for marking the internal state of the failed software subprogram as a disk copying mode when the disk copying software program is copied, reading the stored data and the return code of the interface in sequence from the corresponding disk copying data when the interface of the failed software subprogram needs to acquire data through the interface after the state mark of the disk copying mode is identified, and operating the failed software subprogram according to the read data and the return code to realize the disk copying software program.
On the basis of the technical scheme, the device further comprises a first positioning module, wherein the first positioning module is used for positioning the fault of the software program according to the recorded program log while copying the software program.
On the basis of the technical scheme, the system further comprises a second positioning module, wherein the second positioning module is used for positioning the software program fault by using a code single-step debugging method while copying the software program.
Compared with the prior art, the invention has the advantages that: the method for the execution process of the software program of the invention not only eliminates random factors and can stably copy all software program faults, but also has high reliability and wide application range, and the method for copying the software program of the invention has simple operation and good practicability.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Referring to fig. 2, an embodiment of the present invention provides a method for copying a software program execution process, which is used for locating a software program fault, where the software program includes several software subroutines, and includes the steps of:
s1: pre-packaging interfaces of all software programs;
s2: when the software program runs, all data acquired by each software subprogram through an interface and a return code of the interface are stored into corresponding each copy data, and all the copy data are stored in a file according to the sequence of generation time;
s3: when a software program is copied, the internal state of a failed software subprogram is marked as a copy mode, after the state mark of the copy mode is identified by an interface of the failed software subprogram, when data needs to be acquired through the interface, stored data and a return code of the interface are sequentially read from corresponding copy data, and the failed software subprogram runs according to the read data and the return code to realize the failure of the software program so as to locate the failure of the software program.
At present, program software obtains running time by means of a scheduling mechanism of an operating system, obtains external data through an interface, such as reading files, receiving messages, calling an API to obtain system time, and the like, and meanwhile, the software program can also output some data, such as writing files, sending messages to other software programs, and the like, and also can retain certain data inside the program, such as storing some service data in a memory. However, most faults occurring during the running of the program are caused by that external data acquired at a certain moment and internal data of the program are not matched under certain conditions, such as internal data organization errors of the program, and the program is in error.
The working principle of the method for copying the software program execution process in the embodiment of the invention is as follows: when the software program normally runs, all data acquired by each software subprogram through an interface and a return code of the interface are stored into corresponding copy data, each software subprogram has one corresponding copy data, and all the copy data are stored into a file according to the sequence of generation time, so that the original value of external data of the software program is recorded into the file in an original sequence; when the software program is copied, the failed software subprogram reads the stored data and the return code of the interface from the file in sequence and operates the failed software subprogram, so that the same error can occur again when the failed software subprogram is operated to the original error place, and the failure of the software program is realized so as to locate the failure of the software program.
Compared with the prior art, on one hand, because the external data is stored in the original value original sequence, random factors are eliminated, all software program faults can be stably copied, the method is suitable for the situation that the faults occur repeatedly and the situation that the faults occur for the first time, and the application range is wide; on the other hand, the disk duplicating method is simple to operate, good in practicability, less in information to be recorded, and free of operation obstacles such as manual operation or instrument operation.
In the embodiment of the invention, when the software program is copied, the failed software subprogram runs, and other software subprograms are in an idle state.
As shown in fig. 1 and fig. 3, when the software program runs, the software program includes three software subroutines, a, B, and C, each of which corresponds to respective copy data, and when each software subroutine calls an OS interface to acquire data, the acquired interface data and a return code of the interface are stored in the corresponding copy data, data transmitted to the software program through a communication interface is also stored in the copy data, and all the copy data are stored in a time sequence.
Referring to fig. 4, when the software subprogram C fails during the copying of the software program, the software subprogram C no longer receives data from the outside, but reads the stored data from the copied data, and at this time, the software subprograms a and B are in an idle state.
Furthermore, the method for executing the copy software program according to the embodiment of the present invention further includes the steps of: and (4) while copying the software program, positioning the fault of the software program according to the recorded program log.
Furthermore, the method for executing the copy software program according to the embodiment of the present invention further includes the steps of: while copying the software program, the method of code single step debugging is used to locate the software program fault.
In the embodiment of the invention, the fault of the software program is assisted to be positioned by recording a program log or a code single-step debugging method while the software program is copied, so that the fault positioning of the software program is more accurate and the positioning efficiency is high.
Specifically, in the embodiment of the invention, the interfaces of the software program comprise an operating system interface and a communication interface. The operating system interface comprises a system time interface, a random number interface, a file reading interface, a timer interface and a memory application interface. The communication interface is a communication interface for acquiring service data, such as data input from an input command of telnet.
In the using process, all the interfaces of the software program are packaged, when the software program is copied, the interfaces do not need to be called really to obtain data, and only the stored data needs to be read from the copied data, so that the randomness can be avoided, and the failure of the software program can be stabilized.
For example, the random number obtained during the disk copying process is different from the random number obtained during the failure, so that after the disk copying method of this embodiment is adopted, the random number stored in the disk copying data is read from the disk copying data, i.e., the disk copying failure occurs, and the recorded return code is returned, so that both the return code and the data are the same as those in the case of the failure, and the software program must also be run in the same flow in the case of the failure, thereby stabilizing the disk copying process against the software program failure.
Furthermore, in the embodiment of the present invention, when the software program is in the copy mode, data input other than the copy data is not responded, data is not output any more, and the copy data is not stored any more, and the currently used data is read from the copy data, and the copy data is not modified, so that it is ensured that the copy can be repeatedly performed for many times until the software program fault is accurately located.
The embodiment of the invention also provides a system for the execution process of the copy software program, wherein the software program comprises a plurality of software subprograms, and the software subprograms comprise:
the packaging module is used for packaging the interfaces of all software programs;
the storage module is used for storing all data acquired by each software subprogram through an interface and the return code of the interface into corresponding each copy data when the software program runs, and storing all the copy data in a file according to the sequence of generation time;
and the disk copying module is used for marking the internal state of the failed software subprogram as a disk copying mode when the disk copying software program is copied, reading the stored data and the return code of the interface in sequence from the corresponding disk copying data when the interface of the failed software subprogram needs to acquire data through the interface after the state mark of the disk copying mode is identified, and operating the failed software subprogram according to the read data and the return code to realize the disk copying software program.
According to the system for the execution process of the software program for copying, disclosed by the embodiment of the invention, on one hand, because the external data is stored in the original value and original sequence, random factors are eliminated, all software program faults can be copied stably, the system is suitable for the situation that the faults occur repeatedly and the situation that the faults occur for the first time, and the application range is wide; on the other hand, the system in the execution process of the copy software program is simple in operation, good in practicability, less in information to be recorded, and free of operation obstacles such as manual operation or instrument operation.
Furthermore, the system for executing the copy software program according to the embodiment of the present invention further includes a first locating module, configured to locate a fault of the software program according to the recorded program log while copying the software program.
Furthermore, the system for the execution process of the copy software program of the embodiment of the invention further comprises a second positioning module, which is used for positioning the software program fault by using the code single-step debugging method while copying the software program.
According to the system for the execution process of the disked software program, the fault of the software program is assisted to be positioned by recording a program log or a code single-step debugging method while the software program is disked, so that the fault positioning of the software program is more accurate, and the positioning efficiency is high.
The embodiment of the invention also provides a storage medium, wherein a computer program is stored on the storage medium, and when being executed by a processor, the computer program realizes the steps of the method for executing the copy software program, and specifically realizes the following steps:
pre-packaging interfaces of all software programs;
when the software program runs, all data acquired by each software subprogram through an interface and a return code of the interface are stored into corresponding each copy data, and all the copy data are stored in a file according to the sequence of generation time;
when a software program is copied, the internal state of a failed software subprogram is marked as a copy mode, after the state mark of the copy mode is identified by an interface of the failed software subprogram, when data needs to be acquired through the interface, the stored data and the return code of the interface are sequentially read from the corresponding copy data, and the failed software subprogram runs according to the read data and the return code to realize the failure of the software program so as to locate the failure of the software program.
The embodiment of the present invention further provides an electronic device, which includes a memory and a processor, where the memory stores a computer program running on the processor, and the processor implements the steps of the method for implementing the execution process of the copy software program when executing the computer program, and specifically implements the following steps:
pre-packaging interfaces of all software programs;
when the software program runs, all data acquired by each software subprogram through an interface and a return code of the interface are stored into corresponding each copy data, and all the copy data are stored in a file according to the sequence of generation time;
when a software program is copied, the internal state of a failed software subprogram is marked as a copy mode, after the state mark of the copy mode is identified by an interface of the failed software subprogram, when data needs to be acquired through the interface, stored data and a return code of the interface are sequentially read from corresponding copy data, and the failed software subprogram runs according to the read data and the return code to realize the failure of the software program so as to locate the failure of the software program.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The present invention is not limited to the above-described embodiments, and it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements are also considered to be within the scope of the present invention. Those not described in detail in this specification are well within the skill of the art.