CN107220175B - Application program endless loop positioning method and device, computer equipment and storage medium - Google Patents

Application program endless loop positioning method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN107220175B
CN107220175B CN201710318951.7A CN201710318951A CN107220175B CN 107220175 B CN107220175 B CN 107220175B CN 201710318951 A CN201710318951 A CN 201710318951A CN 107220175 B CN107220175 B CN 107220175B
Authority
CN
China
Prior art keywords
address
interrupt
disassembling
application program
interrupted
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710318951.7A
Other languages
Chinese (zh)
Other versions
CN107220175A (en
Inventor
董时舫
聂鹤宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
PAX Computer Technology Shenzhen Co Ltd
Original Assignee
PAX Computer Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by PAX Computer Technology Shenzhen Co Ltd filed Critical PAX Computer Technology Shenzhen Co Ltd
Priority to CN201710318951.7A priority Critical patent/CN107220175B/en
Publication of CN107220175A publication Critical patent/CN107220175A/en
Application granted granted Critical
Publication of CN107220175B publication Critical patent/CN107220175B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime

Abstract

The invention relates to an application program endless loop positioning method, an application program endless loop positioning device, computer equipment and a storage medium, wherein the method comprises the following steps: running an application program through a process, and interrupting the process when the application program is in a loop state; collecting interrupt information, and calculating the relative address of the interrupted process by using the interrupt information; generating a disassembling code of the application program, wherein the disassembling code comprises a disassembling address; and searching a disassembling target address in the disassembling addresses through the relative address of the interrupted process, and identifying the fault part of the dead loop of the application program through the disassembling target address. By the method, dependence on a hardware debugging tool can be separated, and the flexibility of positioning the fault part can be effectively improved.

Description

Application program endless loop positioning method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for positioning an application program loop, a computer device, and a storage medium.
Background
Applications are typically installed in computer devices. An exception may occur while the application is running, for example, the application is stuck in a loop. An endless loop means that an application cannot terminate its process under its own control. When the application program falls into the dead loop, the fault position corresponding to the dead loop needs to be positioned so as to enable the application program to work normally.
In a conventional manner, a JTAG (Joint Test Action Group) hardware debugging tool may be used to locate a fault location of a dead loop. However, in this positioning method, a CPU (Central Processing Unit) chip that needs to be debugged has a JTAG interface, and if the JTAG interface is not provided or even if the JTAG interface chip is provided but the JTAG interface lead of the CPU is not drawn out, it is not possible to position a defective portion of the dead loop. Because the dependence degree of the method on hardware is higher, the positioning operation is limited, and the flexibility of positioning the fault part is poor.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an application program dead loop positioning method, an application program dead loop positioning apparatus, a computer device, and a storage medium, which can effectively improve flexibility of positioning a fault portion without relying on a hardware debugging tool.
A method of application endless loop positioning, the method comprising:
running an application program through a process, and interrupting the process when the application program is in a loop state;
collecting interrupt information, and calculating the relative address of the interrupted process by using the interrupt information;
generating a disassembling code of the application program, wherein the disassembling code comprises a disassembling address;
and searching a disassembling target address in the disassembling addresses through the relative address of the interrupted process, and identifying the fault part of the dead loop of the application program through the disassembling target address.
In one embodiment, the interruption information comprises an absolute breakpoint address of the interrupted process and a structure pointer of the interrupted process; the step of calculating the relative address of the interrupted process by using the interruption information comprises the following steps:
acquiring the process name of the interrupted process by using the structure pointer of the interrupted process;
acquiring a starting address of the process loaded by using the structure pointer of the interrupted process;
and calculating the relative address of the interrupted process through the absolute breakpoint address of the interrupted process and the loaded starting address of the process.
In one embodiment, the method further comprises:
acquiring the application program name;
acquiring the process name of the interrupted process;
judging whether the process name of the interrupted process is consistent with the application program name or not;
if so, recording the interrupt information as effective interrupt information;
otherwise, the interruption information is discarded.
In one embodiment, the step of searching for a disassembled target address in the disassembled addresses by the relative address of the interrupted process includes:
acquiring the relative address;
acquiring a disassembling address in the disassembling code;
judging whether the disassembled address is consistent with the relative address;
and if so, recording the disassembling address as a disassembling target address.
In one embodiment, the method further comprises:
acquiring an interrupt service program, and inserting a debugging code into the interrupt service program, wherein the debugging code comprises an interrupt information acquisition code segment and an interrupt information output code segment;
the step of interrupting the process comprises: calling the interrupt service program inserted with the debugging code to interrupt the process;
the step of collecting interruption information includes: acquiring interrupt information by using the interrupt information acquisition code segment;
the step of calculating the relative address of the interrupted process by using the interruption information comprises the following steps: and calculating the interrupt information through the interrupt information output code segment to obtain the relative address of the interrupted process.
An application program closed loop positioning device, the device comprising:
the interruption module is used for running an application program through a process and interrupting the process when the application program has endless loop;
the acquisition module is used for acquiring the interrupt information;
the computing module is used for computing the relative address of the interrupted process by utilizing the interruption information;
the disassembling module is used for generating disassembling codes of the application program, and the disassembling codes comprise disassembling addresses;
and the positioning module is used for searching a disassembling target address in the disassembling address through the relative address of the interrupted process and identifying the fault part of the dead loop of the application program through the disassembling target address.
In one embodiment, the interruption information comprises an absolute breakpoint address of the interrupted process and a structure pointer of the interrupted process; the computing module is further configured to obtain a process name of the interrupted process by using the structure pointer of the interrupted process; acquiring a starting address of the process loaded by using the structure pointer of the interrupted process; and calculating the relative address of the interrupted process through the absolute breakpoint address of the interrupted process and the loaded starting address of the process.
In one embodiment, the apparatus further comprises:
the system comprises an insertion module, a debugging module and a control module, wherein the insertion module is used for acquiring an interrupt service program and inserting a debugging code into the interrupt service program, and the debugging code comprises an interrupt information acquisition code segment and an interrupt information output code segment;
the interrupt module is also used for calling the interrupt service program inserted with the debugging code and interrupting the process;
the acquisition module is also used for acquiring interrupt information by using the interrupt information acquisition code segment; and calculating the interrupt information through the interrupt information output code segment to obtain the relative address of the interrupted process.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method steps provided in the above embodiments when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method steps provided in the above-mentioned embodiments.
According to the application program dead cycle positioning method and device, the computer equipment and the storage medium, when the application program is in dead cycle, the process of running the application program is interrupted, the interruption information is collected, and the relative address of the interrupted process is calculated by utilizing the interruption information. And disassembling the application program to obtain a disassembled address. And searching a corresponding disassembling target address in the disassembling addresses by using the relative address of the interrupted process, and identifying the fault part of the dead loop of the application program through the disassembling target address. By interrupting the process of running the application program and disassembling the application program, the fault part of the dead loop of the application program can be positioned by using the relative address of the interrupted process and the disassembling target address. In the process, the dependence on a hardware debugging tool can be separated, and the flexibility of positioning the fault part is effectively improved.
Drawings
FIG. 1 is a flow diagram of a method for application loop-death positioning in one embodiment;
FIG. 2 is a block diagram of an application program loop-death positioning method in accordance with one embodiment;
FIG. 3 is a block diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In an embodiment, as shown in fig. 1, an application program endless loop positioning method is provided, which is described by taking an example of applying the method to a computer device, and specifically includes:
and 102, running the application program through the process, and interrupting the process when the application program is in endless loop.
And 104, acquiring interrupt information, and calculating the relative address of the interrupted process by using the interrupt information.
And 106, generating a disassembling code of the application program, wherein the disassembling code comprises a disassembling address.
And step 108, searching a disassembling target address in the disassembling address according to the relative address of the interrupted process, and identifying the fault part of the dead loop of the application program through the disassembling target address.
The computer device may be an industrial control computer, an embedded device, a server, a desktop computer, a personal laptop computer, a tablet computer, a smart phone, or the like. The computer device may include input means such as a keyboard, a mouse, and an IC (Integrated Circuit) card reader, etc. A computer device runs an application through a process. And when the application program generates endless loop, triggering the interrupt service program, and then interrupting the process corresponding to the application program. The interrupt service routine may be manually triggered via an input device.
Specifically, the method for manual triggering through the input device comprises the following steps: the input device of the computer equipment is manually operated, and the computer equipment is caused to execute the operation of triggering the interrupt service program through the input device, such as card insertion, key pressing and the like. And the computer equipment starts a corresponding interrupt service program according to the operation. The interrupt service program interrupts the process of running the application program, thereby realizing the interrupt of the application program. The method for manually triggering the interrupt service program through the input device has stronger operability of triggering action and is more convenient for the computer equipment to control the interrupt service program to acquire interrupt information.
After the process running the application program is interrupted, the computer device collects the field information of the interrupted process, namely the interruption information. The interrupt information includes: absolute breakpoint address of the interrupted process, running mode of the interrupted process, and structure pointer of the interrupted process. In order to locate the fault location of the application program dead loop, the computer device needs to find the reason why the process was interrupted through the interruption information. Thus, the computer device calculates breakpoint information for the interrupted process using the interruption information. Breakpoint information for interrupted processes includes: the process name of the interrupted process, the relative address of the interrupted process, etc. The computer device can obtain the process name of the interrupted process and the starting address of the loaded process through the structure pointer of the interrupted process, and calculates the relative address of the interrupted process through the absolute breakpoint address of the interrupted process and the starting address of the loaded process.
Most applications are developed using a high-level computer language, such as C, C + +, java, and python, etc., and the computer device generates the disassembled code of the application code by a compiler tool. Because assembly language can keep consistency with machine language, software and hardware resources of the computer device can be accessed through the assembly language. Therefore, the high-level language of the computer is converted into the assembly language, so that the fault position of the dead loop of the application program can be searched more conveniently. The computer device may generate a disassemblable code of the application code by the compilation tool when a loop of the application occurs. The application may also be disassembled before the application loops, generating disassembled code.
The computer device disassembles the application to generate a large amount of disassemblable code. The disassembly code comprises disassembly addresses, machine codes, assembly instructions and the like. The disassembly target address is included in the disassembly address, and the computer equipment can identify the fault part of the dead loop of the application program through the disassembly target address. Specifically, the computer device obtains the relative address of the interrupted process, traverses the disassembling address, searches the disassembling address consistent with the relative address of the interrupted process, and the disassembling address is the disassembling target address, so that the fault part of the dead cycle of the application program can be identified through the disassembling target address.
In one embodiment, the step of identifying the faulty location of the application's dead loop by disassembling the target address comprises: and acquiring a disassembled object code and a context code of the disassembled object code through the disassembled object address, wherein the disassembled object code refers to a code of a line where the disassembled object address is located, identifying meanings of the disassembled object code and the context code of the disassembled object code, and searching a fault part with a dead loop in a code of an application program according to the meanings of the codes. For example, an application is C language code, and after one sentence of C language code is converted into assembly language, the C language code usually corresponds to two or more sentences of assembly code. Therefore, after the computer device converts the C language code of the application program into the assembly code, it is necessary to identify the meaning of the disassembled object code and the context code of the disassembled object code, and then to find the fault statement in the C language code and identify the fault location of the dead loop of the application program.
In this embodiment, when the application program has an endless loop, the computer device interrupts a process in which the application program is running, collects interrupt information, and calculates a relative address of the interrupted process using the interrupt information. And disassembling the application program to obtain a disassembled address. And searching a corresponding disassembling target address in the disassembling addresses by using the relative address of the interrupted process, and identifying the fault part of the dead loop of the application program through the disassembling target address. By interrupting the process of running the application program and disassembling the application program, the fault part of the dead loop of the application program can be positioned by using the relative address of the interrupted process and the disassembling target address. In the process, the dependence on a hardware debugging tool can be separated, and the flexibility of positioning the fault part is effectively improved.
In one embodiment, the method further comprises: acquiring an interrupt service program, and inserting a debugging code into the interrupt service program, wherein the debugging code comprises an interrupt information acquisition code segment and an interrupt information output code segment; the process interrupting step comprises: calling an interrupt service program inserted with a debugging code to interrupt a process; the step of collecting interrupt information includes: acquiring interrupt information by using an interrupt information acquisition code segment; the step of calculating the relative address of the interrupted process using the interrupt information includes: and calculating the interrupt information through the interrupt information output code segment to obtain the relative address of the interrupted process.
In this embodiment, a debug code is inserted into the interrupt service program, and the debug code includes an interrupt information acquisition code segment and an interrupt information output code segment. Specifically, the head of the interrupt service program is inserted with a collection code segment, and the tail of the interrupt service program is inserted with an output code segment. The acquisition code segment is used for acquiring the field information of the interrupted process, and the output code segment is used for calculating breakpoint information by using the field information of the interrupted process and further outputting the breakpoint information of the interrupted process.
When the application program is in endless loop, the computer equipment triggers the interrupt service program through the input device, and the process of running the application program is interrupted. The field information of the interrupted process, namely the interruption information, is acquired through the acquisition code segment, and the breakpoint information is calculated by utilizing the field information of the interrupted process through the output code segment, so that the breakpoint information of the interrupted process is output. And calculating the relative address of the interrupted process by using the interruption information, searching the disassembling target address of the application program according to the relative address of the interrupted process, and identifying the dead-cycle fault part of the application program through the disassembling target address.
In addition, when locating a fault location of an application loop, it is also possible to insert debugging code into the application. If debugging code is inserted in an application, it is necessary to insert debugging code at multiple codes of the application. When the application program has endless loop, a large amount of debugging information can be output by the inserted debugging codes, and the computer equipment is difficult to quickly and effectively search the endless loop fault codes from the large amount of debugging information, so that the position of the application program with endless loop fault is inconvenient to locate. In addition, because the computer device inserts multiple debugging information into the application program, the operation of the application program may be disturbed, and the endless loop fault cannot be reproduced.
In this embodiment, the method for inserting the debugging code into the interrupt service program by the computer device can search the fault position of the application program with endless loop without modifying the application program code. The method for inserting the debugging code is simple, the influence on the running environment of the application program is avoided, the computer equipment is ensured to reproduce the endless loop fault of the application program, and therefore the endless loop fault part is positioned.
In one embodiment, the interrupt information includes an absolute breakpoint address of the interrupted process and a structure pointer of the interrupted process; the step of calculating the relative address of the interrupted process using the interrupt information includes: acquiring the process name of the interrupted process by using the structure pointer of the interrupted process; acquiring a loaded initial address of the process by using a structure pointer of the interrupted process; the relative address of the interrupted process is calculated from the absolute breakpoint address of the interrupted process and the starting address at which the process is loaded.
The interrupt information collected by the computer device comprises a structure pointer of the interrupted process, and the collected interrupt information also comprises an absolute breakpoint address of the interrupted process and an operation mode of the interrupted process. The interrupt service routine obtains the name of the interrupted process using the structure pointer of the interrupted process. Specifically, the interrupted process is retrieved according to the structure pointer of the interrupted process, and the related attributes of the interrupted process, such as the process name, the process identifier and the like, are accessed, so as to obtain the process name of the interrupted process.
Before running, the application program is loaded into the memory by the operating system, and the application program occupies a section of continuous logic address in the memory. The start address of the continuous logical address is the start address of the memory occupied by the application program. After the application is loaded into memory, the operating system schedules a process to run the application. After the process is interrupted, the interrupted process can be retrieved according to the structure pointer of the interrupted process, and then the relevant attribute of the interrupted process is accessed, and the starting address of the process loaded, namely the starting address of the memory occupied by the application program, can be obtained according to the relevant attribute of the interrupted process.
The interrupt service routine calculates the relative address of the interrupted process using the absolute breakpoint address of the interrupted process and the starting address at which the process was loaded. Specifically, the relative address of the interrupted process is equal to the absolute breakpoint address of the interrupted process minus the starting address of the process being loaded. According to the relative address of the interrupted process, the computer device can search the disassembly target address in the disassembly address of the application program, and further identify the fault part of the dead loop of the application program through the disassembly target address.
In this embodiment, the interrupted process is retrieved through the interrupt information, the relevant attribute of the interrupted process is accessed, and the process name of the interrupted process, the start address of the process being loaded, the relative address of the interrupted process, and the like are acquired. The computer equipment determines the application program with failure by using the process name of the interrupted process, searches the disassembly target address of the application program by using the relative address of the interrupted process, and identifies the failure part of the application program with endless loop by using the disassembly target address. Through abundant interruption information, the fault position of the application program with endless circulation can be gradually found out, the positioning result is more accurate, and the positioning efficiency is higher.
In one embodiment, the method further comprises: acquiring the name of an application program; acquiring a process name of an interrupted process; judging whether the process name of the interrupted process is consistent with the application program name, if so, recording the interruption information as effective interruption information; otherwise, the interrupt information is discarded.
When the interrupt information collected by the interrupt service program is not the interrupt information of the application program in which the endless loop occurs, the interrupt information is invalid interrupt information. For example, applications may be dead-cycled when the computer device is executing an interrupt service routine. If the interrupt service program corresponding to the input device is triggered through the input device, the interrupt service program corresponding to the input device may interrupt the interrupt service program being executed by the computer device before the application program process is triggered without the process of the interrupt application program, and the interrupt information acquired by the interrupt service program is not the interrupt information of the application program, i.e., the interrupt information is invalid. As another example, when an operating system implements a task-forced switching mode, there may be multiple applications running in a process. When the interrupt service program interrupts the process corresponding to the application program, the acquired interrupted process information may be interrupt information of other application programs and also invalid interrupt information.
In order to obtain valid interrupt information, validity check needs to be performed on the acquired interrupt information. The interrupt information may be verified by the computer device. Specifically, the method for checking the interrupt information through the computer device comprises the following steps: the computer equipment judges whether the process name of the interrupted process is consistent with the application program name, if so, the interrupted information is effective interrupted information, and the effective interrupted information is recorded. If the interruption information is inconsistent with the verification information, the interruption information is invalid interruption information, the invalid interruption information is discarded, and the application program endless loop fault part is searched by using the verified relative address of the valid interruption information. The interruption information may also be verified manually. The method for checking the interruption information manually comprises the following steps: the method comprises the steps of manually judging whether the name of an application program acquired by computer equipment is consistent with the process name of an interrupted process, if so, sending an operation of recording interruption information to the computer equipment through an input device, recording the interruption information as effective interruption information by the computer equipment according to the operation, and if not, sending an operation of discarding the interruption information to the computer equipment through the input device, and discarding the interruption information by the computer equipment according to the operation.
The computer device may obtain the name of the application program and the process name of the interrupted process after calculating the relative address of the interrupted process, check validity of the interruption information according to the name of the application program and the process name of the interrupted process, and further search the part of the application program dead cycle fault by using the checked relative address of the valid interruption information. The computer equipment checks the interrupt information, stores the effective interrupt information and discards the ineffective interrupt information. By checking the interrupt information, invalid interrupt information in the interrupt information is eliminated, the fault part of the application program can be searched more accurately by using the interrupt information, and the searching efficiency is higher.
The computer device may also check the interrupt information in the manner described above before calculating the relative address of the interrupted process. And after the verification is finished, calculating the relative address of the interrupted process by using the effective interruption information recorded by the computer equipment, further searching the disassembling target address of the application program by using the relative address of the interrupted process, and identifying the fault part of the application program with endless loop through the disassembling target address.
Invalid interrupt information is discarded before the relative address of the interrupted process is calculated using the absolute breakpoint address of the interrupted process and the starting address at which the process was loaded. Compared with the aforementioned computer equipment which calculates the relative address firstly and then calculates the effectiveness, the links of acquiring the loaded starting address of the process by utilizing the invalid interruption information and calculating the relative address of the interrupted process by the absolute breakpoint address of the interrupted process in the invalid interruption information and the loaded starting address of the process are reduced. In the process, invalid interruption information is removed, the calculation amount of the relative address of the interrupted process is further reduced, and the positioning efficiency of the fault part of the application program endless loop is greatly improved.
The computer equipment can trigger the interrupt service program through the manual operation input device, collect interrupt information, and screen effective interrupt information from the collected interrupt information through checking the interrupt information. In general, the interrupt service routine is triggered 1-10 times by the input device, and then the effective interrupt information can be obtained from the acquired interrupt information. The method for acquiring the interrupt information by manually operating the input device has the advantages that the output interrupt information amount is controllable, and a large amount of invalid interrupt information in a non-dead cycle state is prevented from being processed. The interrupt service program interrupt process is triggered through the manual operation input device, interrupt information is collected, a plurality of disassembling target addresses in disassembling addresses of the application program are determined through the interrupt information, the plurality of disassembling target addresses are used for identifying the endless loop code, the problem that the interrupt information is ambiguous is avoided, and the fault part of the application program is accurately identified.
In this embodiment, the computer device performs validity check on the interrupt information, screens the acquired interrupt information according to a check result, selects valid interrupt information, and discards invalid interrupt information. Therefore, invalid interrupt information is filtered, interference of the invalid interrupt information when the computer equipment searches for the endless loop fault of the application program is avoided, and accuracy of endless loop positioning is improved.
In one embodiment, the step of looking up the disassembled target address in the disassembled address by the relative address of the interrupted process comprises: acquiring a relative address of interrupt information; acquiring a disassembling address in disassembling codes; judging whether the disassembling address is consistent with the relative address of the interrupt information; and if so, recording the disassembling address as a disassembling target address.
The computer device obtains the relative address of the valid interrupt information in the interrupt information and the disassemble address in the disassemble code of the application program. Secondly, searching the disassembling address consistent with the relative address of the effective interrupt information in the disassembling address, namely the disassembling target address. Specifically, the computer device judges whether the disassembly address is consistent with the relative address of the effective interrupt information, and if so, records the disassembly address as a disassembly target address.
In the embodiment, the disassembling target address is screened from the disassembling addresses through the relative address of the effective interrupt information, and then the endless loop fault part of the application program is identified through the disassembling target address, so that the endless loop fault code range of the application program is further narrowed, the disassembling code amount needing to be checked is reduced, and the endless loop positioning efficiency of the application program is improved.
In one embodiment, as shown in fig. 2, there is provided an application program dead loop positioning apparatus, including: an interrupt module 202, an acquisition module 204, a computation module 206, a disassembly module 208, and a positioning module 210, wherein:
and the interruption module 202 is used for running the application program through the process and interrupting the process when the application program has dead loop.
And the acquisition module 204 is used for acquiring the interrupt information.
A calculating module 206, configured to calculate a relative address of the interrupted process using the interrupt information.
And the disassembling module 208 is used for generating disassembling codes of the application program, wherein the disassembling codes comprise disassembling addresses.
The positioning module 210 searches the disassembling target address in the disassembling address according to the relative address of the interrupted process, and identifies the fault part of the application program dead loop according to the disassembling target address.
In one embodiment, the interrupt information includes an absolute breakpoint address of the interrupted process and a structure pointer of the interrupted process; the calculation module 206 is further configured to obtain a process name of the interrupted process by using the structure pointer of the interrupted process; acquiring a loaded initial address of the process by using a structure pointer of the interrupted process; the relative address of the interrupted process is calculated from the absolute breakpoint address of the interrupted process and the starting address at which the process is loaded.
In one embodiment, the apparatus further comprises a verification module 212 for obtaining the application name; acquiring a process name of an interrupted process; judging whether the process name of the interrupted process is consistent with the application program name, if so, recording the interruption information as effective interruption information; otherwise, the interrupt information is discarded.
In one embodiment, the location module 210 is further configured to obtain a relative address; acquiring a disassembling address corresponding to an application program; judging whether the disassembled address is consistent with the relative address; if yes, recording the disassembling address as a disassembling target address.
In one embodiment, the apparatus further includes an inserting module 214, configured to obtain the interrupt service program, and insert debugging code into the interrupt service program, where the debugging code includes an interrupt information collecting code segment and an interrupt information outputting code segment; the interrupt module 202 is also used for calling an interrupt service program inserted with a debugging code and interrupting a process; the acquisition module 204 is further configured to acquire interrupt information using an interrupt information acquisition code segment; and calculating the interrupt information through the interrupt information output code segment to obtain the relative address of the interrupted process.
In one embodiment, a computer device is provided, as shown in fig. 3, comprising a memory, a processor for providing computing and control capabilities, and a computer program and database, etc. stored on the memory and executable on the processor. The memory provides an environment for the execution of the computer program. The database is used for storing the relative address of the interrupted process, the disassembled codes of the application programs and the like. The processor, when executing the computer program, implements the steps of:
running an application program through a process, and interrupting the process when the application program is in endless loop;
collecting interrupt information, and calculating the relative address of the interrupted process by using the interrupt information;
generating a disassembling code of the application program, wherein the disassembling code comprises a disassembling address;
and searching a disassembling target address in the disassembling addresses through the relative address of the interrupted process, and identifying the fault part of the dead loop of the application program through the disassembling target address.
The computer device may be implemented as a stand-alone computer device or as a cluster of computer devices. Those skilled in the art will appreciate that the architecture shown in fig. 3 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring the process name of the interrupted process by using the structure pointer of the interrupted process;
acquiring a loaded initial address of the process by using a structure pointer of the interrupted process;
the relative address of the interrupted process is calculated from the absolute breakpoint address of the interrupted process and the starting address at which the process is loaded.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring an application program name;
acquiring a process name of an interrupted process;
judging whether the process name of the interrupted process is consistent with the application program name;
if so, recording the interrupt information as effective interrupt information;
otherwise, the interrupt information is discarded.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring a relative address;
acquiring a disassembling address in disassembling codes;
judging whether the disassembled address is consistent with the relative address;
and if so, recording the disassembling address as a disassembling target address.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring an interrupt service program, and inserting a debugging code into the interrupt service program, wherein the debugging code comprises an interrupt information acquisition code segment and an interrupt information output code segment;
the process interrupting step comprises: calling an interrupt service program inserted with a debugging code to interrupt a process;
the step of collecting interrupt information includes: acquiring interrupt information by using an interrupt information acquisition code segment;
the step of calculating the relative address of the interrupted process using the interrupt information includes: and calculating the interrupt information through the interrupt information output code segment to obtain the relative address of the interrupted process.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
running an application program through a process, and interrupting the process when the application program is in endless loop;
collecting interrupt information, and calculating the relative address of the interrupted process by using the interrupt information;
generating a disassembling code of the application program, wherein the disassembling code comprises a disassembling address;
and searching a disassembling target address in the disassembling addresses through the relative address of the interrupted process, and identifying the fault part of the dead loop of the application program through the disassembling target address.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring the process name of the interrupted process by using the structure pointer of the interrupted process;
acquiring a loaded initial address of the process by using a structure pointer of the interrupted process;
the relative address of the interrupted process is calculated from the absolute breakpoint address of the interrupted process and the starting address at which the process is loaded.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring an application program name;
acquiring a process name of an interrupted process;
judging whether the process name of the interrupted process is consistent with the application program name;
if so, recording the interrupt information as effective interrupt information;
otherwise, the interrupt information is discarded.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a relative address;
acquiring a disassembling address in disassembling codes;
judging whether the disassembled address is consistent with the relative address;
and if so, recording the disassembling address as a disassembling target address.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring an interrupt service program, and inserting a debugging code into the interrupt service program, wherein the debugging code comprises an interrupt information acquisition code segment and an interrupt information output code segment;
the process interrupting step comprises: calling an interrupt service program inserted with a debugging code to interrupt a process;
the step of collecting interrupt information includes: acquiring interrupt information by using an interrupt information acquisition code segment;
the step of calculating the relative address of the interrupted process using the interrupt information includes: and calculating the interrupt information through the interrupt information output code segment to obtain the relative address of the interrupted process.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), or the like.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of application endless loop positioning, the method comprising:
running an application program through a process, and triggering an interrupt service program through an input device to interrupt the process when the application program is in a loop state;
collecting interrupt information, screening effective interrupt information in the interrupt information according to the process name of the interrupted process, and calculating the relative address of the interrupted process by using the effective interrupt information;
generating a disassembling code of the application program, wherein the disassembling code comprises a disassembling address;
and searching a disassembling target address in the disassembling addresses through the relative address of the interrupted process, and identifying the fault part of the dead loop of the application program through the disassembling target address.
2. The method of claim 1, wherein the interruption information comprises an absolute breakpoint address of the interrupted process and a structure pointer of the interrupted process; the step of calculating the relative address of the interrupted process by using the interruption information comprises the following steps:
acquiring the process name of the interrupted process by using the structure pointer of the interrupted process;
acquiring a starting address of the process loaded by using the structure pointer of the interrupted process;
and calculating the relative address of the interrupted process through the absolute breakpoint address of the interrupted process and the loaded starting address of the process.
3. The method according to claim 1, wherein the filtering out valid interrupt information from the interrupt information according to the process name of the interrupted process comprises:
acquiring an application program name;
acquiring the process name of the interrupted process;
judging whether the process name of the interrupted process is consistent with the application program name or not;
if so, recording the interrupt information as effective interrupt information;
otherwise, the interruption information is discarded.
4. The method of claim 1, wherein the step of searching for a disassembled target address in the disassembled addresses by the relative address of the interrupted process comprises:
acquiring the relative address;
acquiring a disassembling address in the disassembling code;
judging whether the disassembled address is consistent with the relative address;
and if so, recording the disassembling address as a disassembling target address.
5. The method of claim 1, further comprising:
acquiring an interrupt service program, and inserting a debugging code into the interrupt service program, wherein the debugging code comprises an interrupt information acquisition code segment and an interrupt information output code segment;
the step of interrupting the process comprises: calling the interrupt service program inserted with the debugging code to interrupt the process;
the step of collecting interruption information includes: acquiring interrupt information by using the interrupt information acquisition code segment;
the step of calculating the relative address of the interrupted process by using the interruption information comprises the following steps: and calculating the interrupt information through the interrupt information output code segment to obtain the relative address of the interrupted process.
6. An apparatus for application loop-death positioning, the apparatus comprising:
the interrupt module is used for running an application program through a process, and triggering an interrupt service program to interrupt the process when the application program has endless loop;
the acquisition module is used for acquiring interrupt information and screening out effective interrupt information in the interrupt information according to the process name of the interrupted process;
the computing module is used for computing the relative address of the interrupted process by utilizing the effective interruption information;
the disassembling module is used for generating disassembling codes of the application program, and the disassembling codes comprise disassembling addresses;
and the positioning module is used for searching a disassembling target address in the disassembling address through the relative address of the interrupted process and identifying the fault part of the dead loop of the application program through the disassembling target address.
7. The apparatus of claim 6, wherein the interruption information comprises an absolute breakpoint address of the interrupted process and a structure pointer of the interrupted process; the computing module is further configured to obtain a process name of the interrupted process by using the structure pointer of the interrupted process; acquiring a starting address of the process loaded by using the structure pointer of the interrupted process; and calculating the relative address of the interrupted process through the absolute breakpoint address of the interrupted process and the loaded starting address of the process.
8. The apparatus of claim 6, further comprising:
the system comprises an insertion module, a debugging module and a control module, wherein the insertion module is used for acquiring an interrupt service program and inserting a debugging code into the interrupt service program, and the debugging code comprises an interrupt information acquisition code segment and an interrupt information output code segment;
the interrupt module is also used for calling the interrupt service program inserted with the debugging code and interrupting the process;
the acquisition module is also used for acquiring interrupt information by using the interrupt information acquisition code segment; and calculating the interrupt information through the interrupt information output code segment to obtain the relative address of the interrupted process.
9. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1-5 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN201710318951.7A 2017-05-08 2017-05-08 Application program endless loop positioning method and device, computer equipment and storage medium Active CN107220175B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710318951.7A CN107220175B (en) 2017-05-08 2017-05-08 Application program endless loop positioning method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710318951.7A CN107220175B (en) 2017-05-08 2017-05-08 Application program endless loop positioning method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN107220175A CN107220175A (en) 2017-09-29
CN107220175B true CN107220175B (en) 2020-01-21

Family

ID=59945121

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710318951.7A Active CN107220175B (en) 2017-05-08 2017-05-08 Application program endless loop positioning method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN107220175B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109766273B (en) * 2018-12-27 2022-09-27 百富计算机技术(深圳)有限公司 Method and device for positioning endless loop, computer equipment and storage medium
CN110750450B (en) * 2019-09-19 2022-08-16 深圳震有科技股份有限公司 Method, device and system for positioning software endless loop and storage medium
CN111124730B (en) * 2019-12-20 2024-01-23 浪潮商用机器有限公司 Error positioning method and device of server and computer storage medium
CN113220334B (en) * 2021-05-25 2024-04-16 百富计算机技术(深圳)有限公司 Program fault positioning method, terminal equipment and computer readable storage medium
CN113761746B (en) * 2021-09-08 2023-07-25 北京世冠金洋科技发展有限公司 Algebraic ring identification method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1477512A (en) * 2002-08-20 2004-02-25 华为技术有限公司 Embedded sorftware task endless loop monitoring method
CN103186461A (en) * 2011-12-30 2013-07-03 重庆重邮信科通信技术有限公司 Storage method and recover method for field data, and related devices
CN106354575A (en) * 2016-08-12 2017-01-25 中国航空工业集团公司西安飞行自动控制研究所 Troubleshooting device and method based on stack tracing

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9336097B2 (en) * 2014-02-27 2016-05-10 International Business Machines Corporation Salvaging hardware transactions

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1477512A (en) * 2002-08-20 2004-02-25 华为技术有限公司 Embedded sorftware task endless loop monitoring method
CN103186461A (en) * 2011-12-30 2013-07-03 重庆重邮信科通信技术有限公司 Storage method and recover method for field data, and related devices
CN106354575A (en) * 2016-08-12 2017-01-25 中国航空工业集团公司西安飞行自动控制研究所 Troubleshooting device and method based on stack tracing

Also Published As

Publication number Publication date
CN107220175A (en) 2017-09-29

Similar Documents

Publication Publication Date Title
CN107220175B (en) Application program endless loop positioning method and device, computer equipment and storage medium
Carreira et al. Xception: Software fault injection and monitoring in processor functional units
US8776029B2 (en) System and method of software execution path identification
Ramanathan et al. Static specification inference using predicate mining
US20090287729A1 (en) Source code coverage testing
US8756572B2 (en) Debugger-set identifying breakpoints after coroutine yield points
Wang et al. Automated path generation for software fault localization
US8555234B2 (en) Verification of soft error resilience
US20060143596A1 (en) Program analyzing apparatus and testing apparatus, and analyzing method and program therefor
US20150006961A1 (en) Capturing trace information using annotated trace output
CN111026601A (en) Monitoring method and device for Java application system, electronic equipment and storage medium
Heuzeroth et al. Generating design pattern detectors from pattern specifications
KR101979329B1 (en) Method and apparatus for tracking security vulnerable input data of executable binaries thereof
Kim et al. Perfguard: binary-centric application performance monitoring in production environments
CN110580220B (en) Method for measuring code segment execution time and terminal equipment
Li et al. Effectively manifesting concurrency bugs in android apps
Chen Performance regression detection in devops
US9442818B1 (en) System and method for dynamic data collection
CN109783837A (en) Emulator, analogue system, emulation mode and simulated program
KR102165747B1 (en) Lightweight crash report based debugging method considering security
CN105912467B (en) Performance test method and device
Fedorova et al. Performance comprehension at WiredTiger
JP4763743B2 (en) Program operation comparison apparatus and method and program
Smith et al. Slicing event traces of large software systems
US20070168978A1 (en) Computer program code debugging method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant