CN110750450B - Method, device and system for positioning software endless loop and storage medium - Google Patents
Method, device and system for positioning software endless loop and storage medium Download PDFInfo
- Publication number
- CN110750450B CN110750450B CN201910886437.2A CN201910886437A CN110750450B CN 110750450 B CN110750450 B CN 110750450B CN 201910886437 A CN201910886437 A CN 201910886437A CN 110750450 B CN110750450 B CN 110750450B
- Authority
- CN
- China
- Prior art keywords
- exception
- loop
- cpu
- stack
- program
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000012544 monitoring process Methods 0.000 claims abstract description 12
- 238000012545 processing Methods 0.000 claims abstract description 5
- 230000006870 function Effects 0.000 claims description 43
- 238000004891 communication Methods 0.000 claims description 11
- 230000002159 abnormal effect Effects 0.000 claims description 7
- 238000010586 diagram Methods 0.000 description 7
- 238000007639 printing Methods 0.000 description 4
- 238000004590 computer program Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/362—Debugging of software
- G06F11/3644—Debugging of software by instrumenting at runtime
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/53—Decompilation; Disassembly
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4482—Procedural
- G06F9/4484—Executing subprograms
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method, a device, a system and a storage medium for positioning software endless loop, wherein the method comprises the following steps: receiving a debug command provided by a CPU (Central processing Unit), and monitoring a branch instruction; when the branch instruction is executed, the CPU triggers an exception and enters an exception handler; judging in the exception handling program, if the current call stack is in the stack of the monitored task, allowing to record the call record, and if the current call stack is not in the stack of the monitored task, not recording; forcibly terminating the exception handling program, reading the valid information and storing the valid information as a file; disassembling the exception handler to determine a location of a dead loop. Compared with the existing positioning method, the method is very simple and efficient, and effectively solves the problems of complex operation, low positioning efficiency, high configuration requirement and the like in the existing software closed-loop positioning method.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device and a system for positioning software endless loop and a storage medium.
Background
Applications are typically installed on a computer device and may experience exceptions during runtime, such as trapping of the application 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.
The following methods are common: firstly, adding printing in suspicious codes, recording program running tracks, and circularly printing the added information once a CPU enters a dead loop. And secondly, monitoring the target program by using third-party software or tools for task detection, such as gdb, and determining the position of the dead loop by methods such as setting a breakpoint.
The first method is to carry out positioning by guessing, which has high requirements on the skills of developers, and meanwhile, the printing adding positions need to be frequently modified, the printing information is increased, codes are compiled, and debugging and running are carried out for many times, which is very inconvenient. The second method is to use third-party software or source code, which needs to obtain the license of the software or the source code, is very familiar with the third-party software, can only run on a target environment, and is very troublesome to configure the third-party software, and some systems even do not support the third-party software to run in the system.
Therefore, the existing software endless loop positioning technology has the problems of complex operation, low positioning efficiency, high configuration requirement and the like, and needs to be improved.
Disclosure of Invention
In view of the defects of the prior art, the invention aims to provide a method, a device, a system and a storage medium for positioning software endless loop, and aims to solve the problems of complex operation, low positioning efficiency, high configuration requirement and the like in the conventional method for positioning software endless loop.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for positioning software endless loop, wherein the method comprises the following steps:
a. receiving a debug command provided by a CPU, and monitoring a branch instruction;
b. when the branch instruction is executed, the CPU triggers an exception and enters an exception handler;
c. judging in the exception handling program, if the current call stack is in the stack of the monitored task, allowing to record the call record, and if the current call stack is not in the stack of the monitored task, not recording;
d. forcibly terminating the exception handling program, reading the valid information and storing the valid information as a file;
e. disassembling the exception handler, saving the disassembled result as a file, determining which section of code the CPU executes in a continuous loop, and failing to exit to determine the location of a dead loop.
The method for positioning software dead loop, wherein the step a of receiving a debug command provided by a CPU comprises the following steps of:
and (4) initializing and setting the branch instruction, enabling the branch instruction to be abnormal, and enabling the branch instruction to monitor.
In the method for locating a software dead loop, when the branch instruction in step b is executed, the CPU triggers an exception and enters an exception handler, further comprising the steps of:
b1, in the exception handling program, the control operation system saves each register before entering the exception program and transfers the registers to the exception handling function, and the exception handling program can acquire each register of the CPU.
The method for positioning software endless loop, wherein the step d of forcibly terminating the exception handler, reading valid information and storing the valid information as a document comprises the following steps:
d0, determining that the exception handler has been loop-locked, and then running for a period of time.
The method for locating a software closed loop, wherein the step e disassembles the exception handler, saves the disassembled result as a file, determines the section of code between which the CPU is continuously executed in a loop, and cannot exit, so as to determine the position of the closed loop, further comprising the steps of:
e1, searching in the disassembled result by using the PC value in each piece of record information of the call stack, and obtaining the function of the PC value, thereby finding out the function of each piece of call stack information.
A software closed loop positioning device, comprising: a processor, a memory, and a communication bus;
the memory stores a software dead-cycle positioning method program executable by the processor;
the communication bus realizes connection communication between the processor and the memory;
when the processor executes the program of the positioning method of the software endless loop, the following steps are realized:
a. receiving a debug command provided by a CPU (Central processing Unit), and monitoring a branch instruction;
b. when the branch instruction is executed, the CPU triggers an exception and enters an exception handler;
c. judging in the exception handling program, if the current call stack is in the stack of the monitored task, allowing to record the call record, and if the current call stack is not in the stack of the monitored task, not recording;
d. forcibly terminating the exception handling program, reading the valid information and storing the valid information as a file;
e. disassembling the exception handler, saving the disassembled result as a file, determining which section of code the CPU executes in a continuous loop, and failing to exit to determine the location of a dead loop.
The device for positioning software endless loop, when the processor executes the program of the method for positioning software endless loop, the following steps are further implemented:
and initializing and setting the branch instruction, enabling the branch instruction to be abnormal, and enabling the branch instruction to monitor.
The positioning device for software endless loop, when the processor executes the positioning method program for software endless loop, the following steps are also implemented:
b1, in the exception handling program, the control operating system saves each register before entering the exception program and transfers the register to the exception handling function, and the exception handling program can obtain each register of the CPU.
d0, determining that the exception handler has been loop-locked, and then running for a period of time.
e1, searching in the disassembled result by using the PC value in each piece of record information of the call stack, and obtaining the function of the PC value, thereby finding out the function of each piece of call stack information.
A software closed loop positioning system, comprising:
the receiving module is used for receiving a debug command provided by the CPU and monitoring a branch instruction;
an exception triggering module for triggering an exception by the CPU and entering an exception handler when the branch instruction is executed;
the judging module is used for judging in the exception handling program, if the current call stack is in the stack of the monitored task, the call record is allowed to be recorded, and if the current call stack is not in the stack of the monitored task, the call record is not recorded;
the program termination module is used for forcibly terminating the exception handling program, reading the valid information and storing the valid information as a file;
and the analysis module is used for disassembling the exception handling program, saving a disassembling result as a file, and determining that the CPU continuously executes the loop between the sections of codes and cannot exit so as to determine the position of the dead loop.
A storage medium having one or more programs stored thereon, the one or more programs being executable by one or more processors for performing any of the steps in a method for software closed loop positioning.
Compared with the prior art, the invention provides a method, a device, a system and a storage medium for positioning software endless loop, which utilize a debug function provided by a CPU (central processing unit), trigger an exception when a branch instruction is executed, record and process analysis in an exception handling program, allow recording of a call record and record to a specified memory position if a current call stack is in a stack of a monitored task, and continue to operate the CPU, or directly return to the program to continue to operate normally without recording. And after the dead loop runs for a certain time, forcibly terminating the application program, reading stack information kept by the fixed memory, analyzing, and determining the section of the code between which the CPU executes the loop continuously and cannot exit, so that the position of the dead loop is determined. Therefore, compared with the existing positioning method, the method is very simple and efficient, and effectively solves the problems of complex operation, low positioning efficiency, high configuration requirement and the like in the existing software endless loop positioning method.
Drawings
Fig. 1 is a flowchart of a method for positioning a software loop.
FIG. 2 is a diagram illustrating an exemplary branch instruction initialization configuration according to the present invention.
FIG. 3 is a diagram illustrating the execution of task A according to an embodiment of the present invention.
FIG. 4 is a detailed flow chart of the embodiment of the present invention before entering an exception handler until the exception handler is terminated.
Fig. 5 is a functional schematic block diagram of a positioning apparatus for software dead loop provided in the present invention.
Fig. 6 is a functional block diagram of a software loop-locked positioning system according to the present invention.
Detailed Description
In order to make the objects, technical solutions and effects of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1 to 4, the method for positioning a software loop in a dead state according to the present invention includes the following steps:
s100, receiving a debug command provided by a CPU, and monitoring a branch instruction;
in the embodiment of the present invention, before the step S100, the method includes:
and (4) initializing and setting the branch instruction, enabling the branch instruction to be abnormal, and enabling the branch instruction to monitor.
Specifically, a closed loop task ID is set, the number N of call stack layers is set, the bottom S of a task stack is obtained, and a record stack memory address A is set. FIG. 2 is a diagram illustrating initialization of branch instructions.
Further, the developer provides task IDs of dead cycles to be monitored, each task is assigned a task stack (a segment of available memory space) by the operating system, and all stacks to be used by function calls come from the task stack. The stack address allocated by the operating system is the task stack bottom. Please refer to fig. 3, which is a diagram illustrating the execution of task a. The stack bottom of the task a is sp ═ 0x04806400, the first calling function of the task a is F1, then F1 calls F2, and so on, each function call needs to open up a stack space for storing the local variables defined in the function execution. Note that here is just the call stack of the function, not where the program instructions are stored. When the function Fn is executed, SP is 0x0480589, and according to the traceability of the stack, SP is 0x04806400 at the bottom of the stack. It may then be found that the top of the stack is the bottom of the stack of task A, and it is determined that the current function was executed by task A, and it is also determined that task A is currently executing.
S200, when the branch instruction is executed, triggering an exception by a CPU and entering an exception handling program;
in this embodiment of the present invention, the step S200 further includes the steps of:
b1, in the exception handling program, the control operation system saves each register before entering the exception program and transfers the registers to the exception handling function, and the exception handling program can acquire each register of the CPU.
Specifically, the registers include a stack register sp, general registers r0 to r31, a pc register, and the like. The stack register sp is a key register for backtracking the function call relation, and can backtrack to the stack bottom of the current task according to sp;
specifically, a call stack at the abnormal position is obtained, a call stack bottom s is traced back, and then the number n of layers at the stack bottom is recorded.
S300, judging in the exception handling program, if the current call stack is in the stack of the monitored task, allowing to record the call record, and if the current call stack is not in the stack of the monitored task, not recording;
specifically, recording and processing and analyzing in an exception handling program, if a current call stack is in a stack of a monitored task, allowing the call record to be recorded, recording to a specified memory position, and continuing to enable a CPU to execute a branch instruction, and if the current call stack is not in the stack of the monitored task, not recording, and directly returning to enable the CPU to continue to execute the branch instruction;
further, the deeper the number of function call layers, the more the number of function call stack stages. If the calling relations of the four functions A- > B- > C- > D are satisfied, the call stack obtained in the D function has 4 levels of stack address information. In order to simplify the positioning process, only a specified number of stages of calling functions need to be monitored, and the number of stages can be configured. If only the 4-level call stack is monitored, the D function calls the E function, and call stack information cannot be recorded in the E function, so that stack information can be greatly reduced, and a dead loop position can be located more quickly.
In order to further understand the steps S200-S300 of the present invention, the detailed implementation flow from the current entering of the exception handling routine to the termination of the exception handling routine is described. Please refer to fig. 4, which is a flowchart illustrating an embodiment of the present invention before an exception handler is entered and terminated.
S400, forcibly terminating the exception handling program, reading effective information and storing the effective information as a file;
in this embodiment of the present invention, before the step S400, the method further includes the steps of:
d0, determining that the exception handler has been loop-locked, and then running for a period of time.
Specifically, after determining that the exception handling program is in a loop, running for 1 minute, and forcibly stopping running the program;
furthermore, an interface for reading records is provided, stack information held by the fixed memory is read out and stored in a PC text document. One stack record includes the stack address ulsackaddr, PC value ulNextInstAddr.
S500, disassembling the exception handling program, saving a disassembling result as a file, and determining the section of code between which the CPU executes the loop without stopping, wherein the loop cannot be withdrawn so as to determine the position of the dead loop.
In this embodiment of the present invention, the step S500 further includes the steps of:
e1, searching in the disassembled result by using the PC value in each piece of record information of the call stack, and obtaining the function of the PC value, thereby finding out the function of each piece of call stack information.
Specifically, disassembling an application program generating dead cycles on a PC, storing a disassembling result in a text file, searching the disassembling result by using a PC value in each piece of record information of a call stack, and acquiring a function where the PC value is located. By the method, the function where each piece of call stack information is located is found out and analyzed, so that the continuous running of the loop between the code sections can be quickly found out, and the loop cannot exit, so that the position of the dead loop can be determined.
For a better understanding of the invention, we now exemplify a section of dead loop code:
testDeadLoopTask is a test task body, a call stack is set to be 4 layers, and after the test task body runs for one minute, the information of monitoring records after exception is as follows:
0x04806400 | 0x00251ca4 | printf |
0x04806380 | 0x00284cd0 | function1 |
0x04806294 | 0x0028594a | function2 |
0x04806380 | 0x00284cd0 | function1 |
0x04806294 | 0x0028594a | function2 |
0x04806380 | 0x00284cd0 | function1 |
0x04806294 | 0x0028594a | function2 |
0x04806380 | 0x00284cd0 | function1 |
0x04806294 | 0x0028594a | function2 |
0x04806380 | 0x00284cd0 | function1 |
0x04806294 | 0x0028594a | function2 |
。。。 | 。。。 | 。。。 |
from the above table, it can be seen that the task testloadtask always runs in the functions 1 and 2, and then the position of the dead loop can be directly found out by combining the actual code.
Referring to fig. 5, based on the above method for positioning software endless loop, the present invention further provides a device for positioning software endless loop, including: a processor 10, a memory 20, a communication bus 30, and a communication interface 50, wherein the processor 10 is connected with the memory 20 through the communication bus 30, and the communication interface 50 is connected with the processor 10 through the communication bus 30;
the memory 20 has stored thereon a software dead-loop positioning method program 40 executable by the processor 10;
fig. 5 shows only some of the components of the positioning apparatus in a software dead loop, but it should be understood that not all of the shown components are required and that more or fewer components may be implemented instead.
When the processor 10 executes the positioning method program 40 of the software dead loop, the following steps are realized:
a. receiving a debug command provided by a CPU, and monitoring a branch instruction;
b. when the branch instruction is executed, the CPU triggers an exception and enters an exception handler;
c. judging in the exception handling program, if the current call stack is in the stack of the monitored task, allowing to record the call record, and if the current call stack is not in the stack of the monitored task, not recording;
d. forcibly terminating the exception handling program, reading the valid information and storing the valid information as a file;
e. disassembling the exception handler, saving the disassembled result as a file, determining which section of code the CPU executes in a continuous loop, and failing to exit to determine the location of a dead loop.
The device for positioning software endless loop, when the processor executes the program of the method for positioning software endless loop, the following steps are further implemented:
and (4) initializing and setting the branch instruction, enabling the branch instruction to be abnormal, and enabling the branch instruction to monitor.
The positioning device for software endless loop, wherein the processor executes the positioning method program for software endless loop to further implement the following steps:
b1, in the exception handling program, the control operation system saves each register before entering the exception program and transfers the registers to the exception handling function, and the exception handling program can acquire each register of the CPU.
d0, determining that the exception handler has been loop-locked, and then running for a period of time.
e1, searching in the disassembled result by using the PC value in each piece of record information of the call stack, and obtaining the function of the PC value, thereby finding out the function of each piece of call stack information.
Please refer to fig. 6, which is a functional block diagram of a software loop locking positioning system according to the present invention. In this embodiment, the system installed with the program of the positioning method of the software dead loop may be divided into one or more modules, and the one or more modules are stored in the memory 20 and executed by one or more processors (in this embodiment, the processor 10) to complete the present invention. In fig. 6, the system in which the positioning method program of the software loop can be installed can be divided into a receiving module 21, an abnormality triggering module 22, a judging module 23, a program terminating module 24, and an analyzing module 25. The module referred to in the invention refers to a series of computer program instruction segments capable of performing specific functions, and is more suitable than a program for describing the execution process of the positioning method program of the software dead loop in the equipment. The following description will specifically describe the functionality of the modules 21-25.
The receiving module 21 is configured to receive a debug command provided by the CPU and monitor a branch instruction;
an exception triggering module 22, configured to, when the branch instruction is executed, trigger an exception by the CPU and enter an exception handler;
a judging module 23, configured to judge in the exception handling program, if the current call stack is in the stack of the monitored task, allow to record the call record, and if the current call stack is not in the stack of the monitored task, not record the call record;
a program termination module 24, configured to terminate the exception handler forcibly, read valid information, and store the valid information as a file;
and the analysis module 25 is used for disassembling the exception handler, saving the disassembling result as a file, and determining that the CPU continuously executes the loop between the sections of the codes and cannot exit so as to determine the position of the dead loop.
Based on the foregoing embodiments, the present invention further provides a storage medium, where the storage medium stores one or more programs, and the one or more programs are executable by one or more processors to implement any one of the steps in the method for positioning a software dead loop, which is specifically described above.
In summary, the present invention provides a method, an apparatus, a system, and a storage medium for positioning a software loop, where an exception is triggered when a branch instruction is executed by using a debug function provided by a CPU, and then an exception is recorded in an exception handling program and processed and analyzed, if a current call stack is in a stack of a monitored task, the call record is allowed to be recorded and recorded to a specified memory location, and the CPU is continuously run, otherwise, the call record is not recorded, and the program is directly returned to continue to run normally. And after the dead loop runs for a certain time, forcibly terminating the application program, reading stack information kept by the fixed memory, analyzing, and determining the section of the code between which the CPU executes the loop continuously and cannot exit, so that the position of the dead loop is determined. Therefore, compared with the existing positioning method, the method is very simple and efficient, and effectively solves the problems of complex operation, low positioning efficiency, high configuration requirement and the like in the existing software closed-loop positioning method.
Of course, it will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program instructing relevant hardware (such as a processor, a controller, etc.), and the program may be stored in a computer readable storage medium, and when executed, the program may include the processes of the above method embodiments. The storage medium may be a memory, a magnetic disk, an optical disk, etc.
It will be understood that the invention is not limited to the examples described above, but that modifications and variations will occur to those skilled in the art in light of the above teachings, and that all such modifications and variations are considered to be within the scope of the invention as defined by the appended claims.
Claims (8)
1. A method for positioning software endless loop is characterized by comprising the following steps:
a. receiving a debug command provided by a CPU (Central processing Unit), and monitoring a branch instruction;
b. when the branch instruction is executed, the CPU triggers an exception and enters an exception handler;
c. judging in the exception handling program, if the current call stack is in the stack of the monitored task, allowing to record the call record, and if the current call stack is not in the stack of the monitored task, not recording;
d. forcibly terminating the exception handling program, reading the valid information and storing the valid information as a file;
e. disassembling the exception handler, saving a disassembling result as a file, and determining that the CPU executes the loop between the sections of codes without stop and cannot exit so as to determine the position of the loop;
said step b, when said branch instruction is executed, the CPU triggering an exception and entering an exception handler further comprises the steps of:
b1, in the exception handling program, controlling the operating system to save each register before entering the exception program and transmitting the saved register to the exception handling function, wherein the exception handling program can acquire each register of the CPU;
said step e disassembling said exception handler, saving the disassembled result as a file, determining which section of code the CPU is executing in a loop without stopping, and cannot exit, to determine the location of the dead loop further comprises the steps of:
e1, searching in the disassembled result by using the PC value in each piece of record information of the call stack, and acquiring the function of the PC value, thereby finding out the function of each piece of call stack information.
2. The method as claimed in claim 1, wherein the step a of receiving a debug command provided by the CPU comprises, before monitoring the branch instruction:
and (4) initializing and setting the branch instruction, enabling the branch instruction to be abnormal, and enabling the branch instruction to monitor.
3. The method as claimed in claim 1, wherein said step d comprises the steps of, before forcibly terminating said exception handler, reading valid information and storing the valid information as a document:
d0, determining that the exception handler has been loop-locked, and then running for a period of time.
4. A software loop-through positioning device, comprising: a processor, a memory, and a communication bus;
the memory stores a software dead-cycle positioning method program executable by the processor;
the communication bus realizes connection communication between the processor and the memory;
when the processor executes the program of the positioning method of the software endless loop, the following steps are realized:
a. receiving a debug command provided by a CPU, and monitoring a branch instruction;
b. when the branch instruction is executed, the CPU triggers an exception and enters an exception handler;
c. judging in the exception handling program, if the current call stack is in the stack of the monitored task, allowing to record the call record, and if the current call stack is not in the stack of the monitored task, not recording;
d. forcibly terminating the exception handling program, reading the valid information and storing the valid information as a file;
e. disassembling the exception handler, saving a disassembling result as a file, and determining that the CPU executes the loop between the sections of codes without stop and cannot exit so as to determine the position of the loop;
said step b, when said branch instruction is executed, the CPU triggering an exception and entering an exception handler further comprises the steps of:
b1, in the exception handling program, controlling the operating system to save each register before entering the exception program and transmitting the saved register to the exception handling function, wherein the exception handling program can acquire each register of the CPU;
said step e disassembling said exception handler, saving the disassembled result as a file, determining which section of code the CPU is executing in a loop without stopping, and cannot exit, to determine the location of the dead loop further comprises the steps of:
e1, searching in the disassembled result by using the PC value in each piece of record information of the call stack, and obtaining the function of the PC value, thereby finding out the function of each piece of call stack information.
5. The apparatus according to claim 4, wherein the processor further implements, when executing the program of the method for locating software dead loop, the following steps:
and (4) initializing and setting the branch instruction, enabling the branch instruction to be abnormal, and enabling the branch instruction to monitor.
6. The apparatus according to claim 4, wherein the processor executes the program of the method for positioning software dead loop to further implement the following steps:
d0, determining that the exception handler has been loop-locked, and then running for a period of time.
7. A system for locating software loops, comprising:
the receiving module is used for receiving a debug command provided by the CPU and monitoring a branch instruction;
an exception triggering module for triggering an exception by the CPU and entering an exception handler when the branch instruction is executed;
the judging module is used for judging in the exception handling program, if the current call stack is in the stack of the monitored task, the call record is allowed to be recorded, and if the current call stack is not in the stack of the monitored task, the call record is not recorded;
the program termination module is used for forcibly terminating the exception handling program, reading the effective information and storing the effective information as a file;
the analysis module is used for disassembling the exception handling program, storing a disassembling result as a file, and determining that the CPU continuously executes the loop between the sections of codes and cannot exit so as to determine the position of the dead loop;
the exception triggering module is specifically used for controlling the operating system to store each register before entering the exception program in the exception handling program and transmitting the register to the exception handling function, and the exception handling program can acquire each register of the CPU;
the analysis module is specifically configured to search in the disassembled result by using the PC value in each piece of record information of the call stack, and obtain a function where the PC value is located, so as to find out the function where each piece of call stack information is located.
8. A storage medium storing one or more programs, the one or more programs being executable by one or more processors to perform the steps of a method for locating software dead loops as claimed in any one of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910886437.2A CN110750450B (en) | 2019-09-19 | 2019-09-19 | Method, device and system for positioning software endless loop and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910886437.2A CN110750450B (en) | 2019-09-19 | 2019-09-19 | Method, device and system for positioning software endless loop and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110750450A CN110750450A (en) | 2020-02-04 |
CN110750450B true CN110750450B (en) | 2022-08-16 |
Family
ID=69276786
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910886437.2A Active CN110750450B (en) | 2019-09-19 | 2019-09-19 | Method, device and system for positioning software endless loop and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110750450B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113220334B (en) * | 2021-05-25 | 2024-04-16 | 百富计算机技术(深圳)有限公司 | Program fault positioning method, terminal equipment and computer readable storage medium |
CN113778884A (en) * | 2021-09-14 | 2021-12-10 | 北京爱芯科技有限公司 | Simulation debugging method and device, computing equipment and computer storage medium |
CN114422192B (en) * | 2021-12-23 | 2024-03-29 | 武汉思普崚技术有限公司 | Abnormal slow flow detection method and device for network security equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102141947A (en) * | 2011-03-30 | 2011-08-03 | 东方通信股份有限公司 | Method and system for processing abnormal task in computer application system adopting embedded operating system |
CN102495793A (en) * | 2011-11-11 | 2012-06-13 | 迈普通信技术股份有限公司 | Method for detecting endless loop task |
GB201701777D0 (en) * | 2017-02-03 | 2017-03-22 | Jaguar Land Rover Ltd | Apparatus and method for separating sheet materials |
CN107220175A (en) * | 2017-05-08 | 2017-09-29 | 百富计算机技术(深圳)有限公司 | Application program endless loop localization method, device, computer equipment and storage medium |
-
2019
- 2019-09-19 CN CN201910886437.2A patent/CN110750450B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102141947A (en) * | 2011-03-30 | 2011-08-03 | 东方通信股份有限公司 | Method and system for processing abnormal task in computer application system adopting embedded operating system |
CN102495793A (en) * | 2011-11-11 | 2012-06-13 | 迈普通信技术股份有限公司 | Method for detecting endless loop task |
GB201701777D0 (en) * | 2017-02-03 | 2017-03-22 | Jaguar Land Rover Ltd | Apparatus and method for separating sheet materials |
CN107220175A (en) * | 2017-05-08 | 2017-09-29 | 百富计算机技术(深圳)有限公司 | Application program endless loop localization method, device, computer equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
程序死循环、死锁问题定位;大雄小方;《CSDN博客 https://blog.csdn.net/qq_41797857/article/details/91404150》;20190611;第1-3页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110750450A (en) | 2020-02-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110750450B (en) | Method, device and system for positioning software endless loop and storage medium | |
US7950001B2 (en) | Method and apparatus for instrumentation in a multiprocessing environment | |
US20090172664A1 (en) | Adding a profiling agent to a virtual machine to permit performance and memory consumption analysis within unit tests | |
US8141056B2 (en) | Just-in-time dynamic instrumentation | |
US9128837B2 (en) | Providing customizable, process-specific just-in-time debugging in an operating system | |
CN102063286B (en) | Program flow controls | |
EP3619611B1 (en) | Conditional debugging of server-side production code | |
CN110781075B (en) | Method, device and system for detecting memory leakage and storage medium | |
US8806447B2 (en) | Step-type operation processing during debugging by machine instruction stepping concurrent with setting breakpoints | |
US8843899B2 (en) | Implementing a step-type operation during debugging of code using internal breakpoints | |
CN109101416B (en) | Kernel fault injection method and electronic equipment | |
CN114168222B (en) | Method and device for acquiring time consumption during starting, terminal equipment and storage medium | |
CN111124792A (en) | Multi-core debugging method and device and storage medium | |
US20170075789A1 (en) | Method and apparatus for generating, capturing, storing, and loading debug information for failed tests scripts | |
WO2019184597A1 (en) | Function selection method and server | |
US8108840B2 (en) | Method for enhancing debugger performance of hardware assisted breakpoints | |
CN103425576A (en) | Information feedback method and terminal | |
JPH07105023A (en) | Method and apparatus for detection of spurious interrupt at inside of data processing system | |
Wang et al. | Detecting data races in interrupt-driven programs based on static analysis and dynamic simulation | |
CN115237728B (en) | Visual monitoring method for real-time operating system running state | |
US20130117732A1 (en) | Technique to improve performance of software breakpoint handling | |
CN114036047A (en) | Method for realizing firmware instant debugger based on serial port | |
CN110647467B (en) | Target code coverage rate testing method, system and medium based on single step exception | |
CN112486712B (en) | Method for diagnosing non-response of equipment in embedded system | |
CN109947414A (en) | A kind of dynamic Hook Function implementation method based on Vxworks 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 |