Program debugging method, intelligent terminal and readable storage medium
Through software-level plug-in programs and breakpoint maintenance tables, program debugging is realized when the CPU core does not have a hardware debugging interface, solving the problem of missing hardware debugging interface and having the same functions as the hardware debugging interface.
Patent Information
- Application Number
- CN202510103636.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-01-22
AI Technical Summary
When the CPU core does not have a hardware debugging interface, the lack of a program debugging mechanism makes it impossible to achieve effective program debugging.
Program debugging is realized through software, and the plug-in program is used to obtain debugging instructions during the main program operation, save the register status, obtain the breakpoint address, and debug operations through the breakpoint maintenance table to realize the software-level debugging function.
Without increasing the complexity of the hardware, program debugging with the same functions as the hardware debugging interface is implemented, making up for the dependence of traditional debugging methods on the hardware interface.
Smart Images

Figure CN119938545A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip information technology, and in particular to a program debugging method, an intelligent terminal and a readable storage medium. Background Art
[0002] In the development and testing of electronic products, it is crucial to ensure that chips and systems can run correctly. Most modern CPU architectures contain a hardware debugging module DAP (Debug Access Port). The DAP interface is a standard interface for debugging and accessing internal system resources. It can support a variety of debugging functions, including communication between the debugger and the target device, access to registers and memory, setting breakpoints and trigger conditions, etc.
[0003] However, some CPU cores are not equipped with complete hardware debugging modules, such as modules without hardware breakpoint support or without integrated DAP modules. Although these CPUs have TAP (Test Access Port) for JTAG interface communication, they lack the ability to support hardware breakpoints, making them unable to have a program debugging mechanism.
[0004] Therefore, there is an urgent need for a program debugging method, an intelligent terminal and a readable storage medium to solve the above problems. Summary of the invention
[0005] The technical problem solved by the present invention is to provide a program debugging method, an intelligent terminal and a readable storage medium, which can realize program debugging through software when the CPU core does not have a hardware debugging interface.
[0006] The present invention solves the technical problem by adopting the following technical solutions: A program debugging method comprises: when a debugging instruction is obtained during the running process of a main program, jumping to a plug-in program through the debugging instruction, and saving a register state through the plug-in program; obtaining a breakpoint address according to the register state; matching the breakpoint address with a preset address in a breakpoint maintenance table to obtain an original instruction corresponding to the preset address matching the breakpoint address, and performing a corresponding debugging operation, wherein the breakpoint maintenance table comprises a breakpoint table and a temporary breakpoint table.
[0007] In a preferred embodiment of the present invention, before the step of jumping to the plug-in program when a debugging instruction is obtained during the running of the main program and saving the register state through the plug-in program, it includes: obtaining new breakpoint information, generating a maintenance command based on the new breakpoint information, and sending it to the maintenance interface, wherein the new breakpoint information includes a breakpoint address; replacing the original instruction of the breakpoint address with a specific exception instruction through the maintenance interface, and saving the original instruction and the breakpoint address in the breakpoint table.
[0008] In a preferred embodiment of the present invention, the above-mentioned steps of obtaining the newly set breakpoint information, generating a maintenance command based on the newly set breakpoint information, and sending it to the maintenance interface, also include: obtaining the newly set breakpoint information, generating a debugging command based on the newly set breakpoint information and sending it to the command processing program; after the command processing program converts the debugging command into the maintenance command, it uses the JTAG protocol interface to send it to the maintenance interface of the target device.
[0009] In a preferred embodiment of the present invention, the above-mentioned step of saving the register state through the plug-in program includes: saving the register state of the CPU through the plug-in program, and saving the exception type, the exception type including maintenance interrupt and specific exception; executing an infinite loop instruction through the plug-in program to enter a waiting state and suspend the main program.
[0010] In a preferred embodiment of the present invention, after the above-mentioned step of matching the breakpoint address with the preset address in the breakpoint maintenance table to obtain the original instruction corresponding to the preset address matching the breakpoint address and performing the corresponding debugging operation, it includes: if the breakpoint address matches the preset address in the temporary breakpoint table, restoring the original instruction corresponding to the breakpoint address, and deleting the preset address matching the breakpoint address in the temporary breakpoint table; if the breakpoint address matches the preset address in the breakpoint table, restoring the original instruction corresponding to the breakpoint address, and after executing the original instruction, replacing the original instruction with the specific exception instruction again.
[0011] In a preferred embodiment of the present invention, after the above-mentioned step of matching the breakpoint address with the preset address in the breakpoint maintenance table to obtain the original instruction corresponding to the preset address matching the breakpoint address, and performing the corresponding debugging operation, it also includes: determining / generating the next temporary breakpoint address according to the breakpoint address, and saving the original instruction of the next temporary breakpoint address into the temporary breakpoint table; replacing the original instruction of the next temporary breakpoint address with the specific exception instruction.
[0012] In a preferred embodiment of the present invention, after the above-mentioned step of replacing the original instruction of the next temporary breakpoint address with the specific exception instruction, it also includes: replacing the dead loop instruction in the plug-in program with an empty instruction to continue running the main program; when exiting the plug-in program, replacing the empty instruction with the dead loop instruction again.
[0013] In a preferred embodiment of the present invention, the above-mentioned matching of the breakpoint address with the preset address in the breakpoint maintenance table to obtain the original instruction corresponding to the preset address matching the breakpoint address, and performing corresponding debugging operations, the breakpoint maintenance table includes a breakpoint table and a temporary breakpoint table, and then includes: responding to a breakpoint deletion instruction, obtaining a breakpoint to be deleted corresponding to the breakpoint deletion instruction; matching the breakpoint to be deleted with the preset address in the breakpoint table, deleting the preset address matching the breakpoint to be deleted and the original instruction corresponding to the preset address in the breakpoint table.
[0014] An intelligent terminal comprises: a memory and a processor, wherein a program debugging program is stored in the memory, and when the program debugging program is executed by the processor, the steps of the program debugging method described in any one of the above are implemented.
[0015] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the program debugging method described in any one of the above are implemented.
[0016] The technical effect achieved by the present invention using the above technical solution is: it is possible to debug the program for a CPU core that does not have a hardware debugging interface, making up for the dependence of traditional debugging methods on hardware interfaces, realizing debugging in software, and having the same functions as hardware debugging interfaces.
[0017] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following specifically cites a preferred embodiment and describes it in detail with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 The figure is a flow chart of a program debugging method shown in the present invention.
[0019] Figure 2 A schematic diagram of the system structure of a program debugging mechanism shown in the present invention.
[0020] Figure 3 A schematic diagram of a state transition path of a debugging instruction shown in the present invention.
[0021] Figure 4 The figure is a schematic diagram of the execution logic of a plug-in program of the present invention. DETAILED DESCRIPTION
[0022] In order to further explain the technical means and effects taken by the present invention to achieve the predetermined invention purpose, the embodiments of the present invention are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of the present invention. Through the description of the specific implementation methods, the technical means and effects taken by the present invention to achieve the predetermined purpose can be more deeply and specifically understood, and the attached drawings are only for reference and explanation purposes, and are not used to limit the present invention.
[0023] The present invention aims to solve the problem of how to efficiently implement program debugging when the CPU core does not have a hardware debugging interface.
[0024] See also Figure 1 , Figure 1 The figure is a flow chart of a program debugging method shown in the present invention.
[0025] like Figure 1 As shown, a program debugging method provided by an embodiment of the present invention comprises the following steps: S11: When a debugging instruction is obtained during the running of the main program, the plug-in program is jumped to through the debugging instruction, and the register state is saved through the plug-in program.
[0026] Specifically, the debugging instructions include: specific exception instructions. The specific exception instructions are obtained after the main program runs to the breakpoint address, that is, the specific exception instructions are set at the breakpoint address.
[0027] In other embodiments, the debugging instructions also include: maintenance interrupt instructions. Interrupt and exception handling are important components of the core functions of the CPU. They not only ensure the system's timely response to external events and proper handling of internal errors, but also maintain the stability and security of the system. Maintenance interrupts are interrupt events that can be triggered from an external maintenance interface. When the user sends a maintenance interrupt instruction from the maintenance interface, the CPU receives the interrupt signal, suspends the currently executed task, jumps to the interrupt entry execution (i.e., the plug-in program), and returns to continue executing the task after handling the interrupt and exception.
[0028] Specifically, the host computer is responsible for managing the debugging process, and the user can send various debugging commands through the debugging interface of the host computer. The main program runs on the debugging target chip, and the chip CPU fetches instructions and runs. The main program contains plug-in programs. PC is the program counter, which contains the address of the instruction currently being executed. When each instruction is fetched, the storage address of the program counter is increased by one. After the instruction is fetched, the program counter points to the next instruction in the sequence. That is, the position where the PC runs refers to the position where the CPU fetches instructions and executes.
[0029] Specifically, the plug-in is responsible for handling specific exceptions and maintenance interrupt events triggered during CPU operation. More complex maintenance functions can be implemented through the plug-in, such as setting breakpoints, single-step debugging, and breakpoint debugging.
[0030] Specifically, the register state plays a vital role in the computer system. It not only records various status information after the instruction is executed, but also directly participates in the decision-making process of the program control flow. In this embodiment, the register state includes the breakpoint address of the main program.
[0031] S12: Get the breakpoint address according to the register status.
[0032] In programming and debugging, a breakpoint is a signal that tells the debugger to temporarily suspend program execution at a specific point. When execution is suspended at a breakpoint, the program is in break mode, which helps the developer to inspect and debug the program.
[0033] Specifically, one or more breakpoints are preset in the program, and the execution of the program is controlled by these breakpoints. When the program is executed, if a breakpoint is encountered, it will pause and enter the debugging state, allowing the developer to check the current program state (such as register values, variables, memory, etc.), so as to analyze the situation when the code is executed to the breakpoint.
[0034] S13: Match the breakpoint address with the preset address in the breakpoint maintenance table to obtain the original instruction corresponding to the preset address matching the breakpoint address, and perform corresponding debugging operations. The breakpoint maintenance table includes a breakpoint table and a temporary breakpoint table.
[0035] A breakpoint is a permanent breakpoint. When the program reaches the breakpoint, it will be suspended. If the user does not actively delete it, the program will be suspended every time it reaches the breakpoint. A temporary breakpoint is a one-time breakpoint. When it is triggered once, the system will automatically delete it and it will not be triggered again.
[0036] When using a debugger, if you want to stop the program at a certain location, you can do so by setting a breakpoint at that location, which is the breakpoint address. When the program reaches the breakpoint, it stops running to debug the CPU.
[0037] Through the above method, a flexible and efficient program debugging mechanism is provided for CPU cores that do not have a hardware debugging interface, which makes up for the dependence of traditional debugging methods on hardware interfaces, realizes debugging in software, and has the same functions as hardware debugging interfaces.
[0038] Optionally, when a debugging instruction is obtained during the running of the main program, before jumping to the plug-in program and saving the register state through the plug-in program, it includes: obtaining new breakpoint information, generating a maintenance command based on the new breakpoint information, and sending it to the maintenance interface, the new breakpoint information includes the breakpoint address; replacing the original instruction of the breakpoint address with a specific exception instruction through the maintenance interface, and saving the original instruction and breakpoint address in the breakpoint table.
[0039] Optionally, the step of obtaining new breakpoint information, generating a maintenance command based on the new breakpoint information, and sending it to the maintenance interface also includes: obtaining new breakpoint information, generating a debugging command based on the new breakpoint information and sending it to the command handler; the command handler converts the debugging command into a maintenance command, and then sends it to the maintenance interface of the target device using the JTAG protocol interface.
[0040] Specifically, breakpoint debugging is the most common function in the debugging process. Users can set breakpoints through the host computer and obtain the CPU core status when the program runs to the breakpoint position and pauses execution.
[0041] The command processing program is used to convert the debugging commands sent by the host computer into maintenance commands and send them to the maintenance interface of the target device through the JTAG protocol interface. The maintenance commands can be used to read and write the I / O registers and memory of the target device.
[0042] For example, the user first specifies the location / code line number (break xxx) where the breakpoint is to be set on the main program through the host computer software. The host computer software parses the instruction address (i.e., the breakpoint address) in the corresponding code segment based on the ELF file, and then generates a set breakpoint command (also known as a debug command / instruction) containing the breakpoint address. The set breakpoint command containing the breakpoint address is then sent to the command handler. After converting the debug command into a maintenance command sequence, the command handler uses the JTAG protocol interface to send it to the maintenance interface of the target device (see Figure 2 , the user program in the figure is the main program).
[0043] Specifically, after receiving the maintenance command, the maintenance interface will replace the original instruction at the corresponding breakpoint address in the main program memory with a specific exception instruction, and save the original instruction at the breakpoint address to the breakpoint table of the host computer. In the subsequent process, when the main program runs to the breakpoint address, the specific exception instruction will be executed by the main program, thereby jumping to the plug-in program through the specific exception entry, and the main program will be suspended.
[0044] Optionally, the step of saving the register state through the plug-in program includes: saving the register state of the CPU through the plug-in program, and saving the exception type, the exception type including maintenance interrupt and specific exception; executing an infinite loop instruction through the plug-in program to enter a waiting state and suspend the main program.
[0045] Specifically, the plug-in first saves the current register status, and then the main program running on the target chip stays at a fixed position (i.e., breakpoint) and enters a waiting state. At this time, the user can send a command (reg) to obtain the register status through the host computer, and the maintenance interface will return the saved breakpoint field information to the host computer, so that the user can view the execution status of the program at the breakpoint and make corresponding debugging operations.
[0046] Optionally, after matching the breakpoint address with a preset address in a breakpoint maintenance table to obtain the original instruction corresponding to the preset address that matches the breakpoint address, and performing corresponding debugging operations, the steps include: if the breakpoint address matches the preset address in a temporary breakpoint table, restoring the original instruction corresponding to the breakpoint address, and deleting the preset address that matches the breakpoint address in the temporary breakpoint table; if the breakpoint address matches the preset address in the breakpoint table, restoring the original instruction corresponding to the breakpoint address, and after executing the original instruction, replacing the original instruction with a specific exception instruction again.
[0047] Specifically, when the main program executes to a breakpoint and triggers a specific exception, the host computer first obtains the current CPU register state, which includes the address that triggered the exception (i.e., the breakpoint address). The host computer matches the breakpoint address in the saved breakpoint table and the temporary breakpoint table to find the original instruction corresponding to the breakpoint address.
[0048] If it is a temporary breakpoint, the original instruction corresponding to the temporary breakpoint in the temporary breakpoint table is written back to the temporary breakpoint address in the main program memory to restore the original instruction, and the record in the temporary breakpoint table is deleted.
[0049] If it is a breakpoint, the specific exception instruction at the breakpoint address is restored to the original instruction. After the CPU fetches the instruction and executes the original instruction, the original instruction at the breakpoint address is replaced with the specific exception instruction. At this time, the main program has run to the next instruction after the breakpoint, so the breakpoint will not be triggered. Only when the main program runs to this breakpoint again will the breakpoint be triggered again.
[0050] It should be noted that since breakpoints are set by users, the main program cannot delete them by itself during its operation. The breakpoint will be deleted only when the user actively sends a command to delete the breakpoint. Temporary breakpoints are generated by the main program according to logic when it is running, so the main program needs to delete them in a timely manner.
[0051] Optionally, after matching the breakpoint address with a preset address in a breakpoint maintenance table to obtain the original instruction corresponding to the preset address that matches the breakpoint address and performing corresponding debugging operations, the step also includes: determining / generating the next temporary breakpoint address based on the breakpoint address, and saving the original instruction of the next temporary breakpoint address into the temporary breakpoint table; replacing the original instruction of the next temporary breakpoint address with a specific exception instruction.
[0052] Specifically, when performing single-step debugging, a temporary breakpoint needs to be set. The host computer determines the address of the next instruction (i.e., the next temporary breakpoint address, which is the original breakpoint address + 4) based on the current breakpoint address, and saves the original instruction of the next temporary breakpoint address into the temporary breakpoint table. Then, the host computer replaces the original instruction at the temporary breakpoint address with a specific exception instruction to ensure that when the main program has the current breakpoint and executes to the next temporary breakpoint address, an exception is triggered to jump to the plug-in program for debugging, and the main program is suspended.
[0053] Optionally, after the step of replacing the original instruction of the next temporary breakpoint address with the specific exception instruction, it also includes: replacing the dead loop instruction in the plug-in program with an empty instruction to continue running the main program; when exiting the plug-in program, replacing the empty instruction with the dead loop instruction again.
[0054] After debugging at a breakpoint, the main program needs to be restored: Since the PC is still at a fixed position in the plug-in program, the host computer needs to actively release it to continue executing the main program, that is, the host computer replaces the dead loop instruction in the plug-in program with an empty instruction so that the CPU can continue to fetch instructions. Before exiting the plug-in program, the host computer needs to replace the empty instruction with the dead loop instruction to ensure that it can be suspended when the next breakpoint is triggered to jump into the plug-in program.
[0055] After the main program leaves the above breakpoint, the program instructions continue to be executed. When the main program executes to the set new temporary breakpoint address, the temporary breakpoint is triggered again, and the plug-in program is jumped into again through the specific exception instruction of the temporary breakpoint.
[0056] In the above way, after each step is executed, it will pause at the newly set temporary breakpoint, thus realizing the function of single-step debugging.
[0057] In one embodiment, when the user sends a pause debugging instruction through the host computer, no matter where the main program of the debugging target chip is running at this time, it should be immediately paused. The host computer can send a maintenance interrupt to the CPU core through a maintenance command to achieve the main program pausing and the PC jumping into the maintenance interrupt entry.
[0058] The host computer sends a maintenance command, triggering a maintenance interrupt. The system jumps to the plug-in program through the maintenance interrupt entry. The plug-in program saves the current register status, and then the PC stays at a fixed position and enters a waiting state. At this time, the user sends a command to obtain the register status through the host computer, and the maintenance interface returns the saved field information to the host computer.
[0059] It should be noted that when a maintenance interrupt or a specific exception (breakpoint, specific exception instruction) occurs, the plug-in program is jumped into through the maintenance interrupt entry or the specific exception entry to execute the processing logic. For maintenance interrupts and specific exceptions, the plug-in program processing logic is the same except for the different entry points.
[0060] Specifically, the plug-in's processing logic (see Figure 4 ) is: First, the program will save the CPU register state (current scene) to a specific area in the memory and save the exception type. Then it will execute an infinite loop instruction and enter a waiting state, where the PC (i.e., program counter) stays. When the host computer replaces the loop instruction with an empty instruction, the PC continues to execute normally. Before exiting the plug-in program, the loop instruction replaced with the empty instruction is restored to its original state to ensure the correctness of the subsequent debugging process. When an exception occurs again, the PC jumps into the plug-in program and can be looped again.
[0061] After completing breakpoint debugging and single-step debugging, you need to restore the CPU to allow it to run normally. Replace the dead loop jump instructions in the plug-in program with empty instructions so that the PC can execute the main program normally. Before exiting the plug-in program, replace the empty instructions with the dead loop jump instructions to ensure the correctness of the subsequent debugging process.
[0062] See also Figure 3 , Figure 3A schematic diagram of the state transition path of a debugging instruction shown in the present invention. Among them, the Step command is used to execute the program step by step during the debugging process. The Go command is used to continue executing the program until a certain condition is reached or it ends; unlike the Step command, the Go command will execute the program at full speed and will not execute each instruction step by step; the Go command is often used to continue executing the program, especially to skip the single-step execution stage during the debugging process and run directly to the next breakpoint or the end of the program. The Halt command is used to stop the operation of the CPU; during the debugging process, the halt command can suspend the execution of the program, which is convenient for developers to check the current status or debug.
[0063] The program debugging method of this embodiment uses the JTAG interface protocol and a debugging system mechanism composed of a host computer, a command processing program, and a plug-in program to realize the debugging functions of accessing registers and memories, setting and clearing breakpoints, and single-step debugging. By maintaining the interface, the present invention realizes the main debugging functions of the DAP interface, such as breakpoint debugging, single-step debugging, and register access, without adding additional hardware complexity, thereby improving the debugging efficiency of the system and reducing the development cost.
[0064] The present invention also provides an intelligent terminal, comprising: a memory and a processor, wherein a program debugging program is stored in the memory, and when the program debugging program is executed by the processor, the steps of the program debugging method described in any one of the above are implemented.
[0065] The present invention also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the program debugging method described in any one of the above are implemented.
[0066] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a portion of the steps in the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0067] Through the description of the above implementation methods, those skilled in the art can clearly understand that the embodiments of the present invention can be implemented by hardware, or by software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the embodiments of the present invention.
[0068] The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the specific details in the above embodiments. The above embodiments and drawings are exemplary. The modules or processes in the drawings are not necessarily required to implement the embodiments of the present invention and cannot be understood as limitations on the present invention. Within the technical concept of the present invention, the technical scheme of the present invention can be subjected to a variety of simple modifications and combinations, and these simple modifications and combinations all belong to the protection scope of the present invention.
Claims
1. A program debugging method, characterized in that: include: When a debugging instruction is obtained during the running of the main program, the plug-in program is jumped to through the debugging instruction, and the register state is saved through the plug-in program; Obtaining a breakpoint address according to the register state; The breakpoint address is matched with a preset address in a breakpoint maintenance table to obtain an original instruction corresponding to the preset address matching the breakpoint address, and a corresponding debugging operation is performed. The breakpoint maintenance table includes a breakpoint table and a temporary breakpoint table.
2. The program debugging method according to claim 1, characterized in that: Before the step of jumping to the plug-in program when a debugging instruction is obtained during the running of the main program and saving the register state through the plug-in program, the method includes: Acquire new breakpoint information, generate a maintenance command based on the new breakpoint information, and send the command to the maintenance interface, wherein the new breakpoint information includes a breakpoint address; The original instruction of the breakpoint address is replaced with a specific abnormal instruction through the maintenance interface, and the original instruction and the breakpoint address are saved in the breakpoint table.
3. The program debugging method according to claim 2, characterized in that: The step of obtaining the newly set breakpoint information, generating a maintenance command based on the newly set breakpoint information, and sending the maintenance command to the maintenance interface further includes: Acquire the newly set breakpoint information, and generate a debugging command according to the newly set breakpoint information and send it to a command processing program; The command processing program converts the debugging command into the maintenance command, and then sends the command to the maintenance interface of the target device using the JTAG protocol interface.
4. The program debugging method according to claim 1, characterized in that: The step of saving the register state through the plug-in program includes: The plug-in program is used to save the register state of the CPU and the exception type, wherein the exception type includes a maintenance interrupt and a specific exception; The dead loop instruction is executed by the plug-in program to enter a waiting state and suspend the main program.
5. The program debugging method according to claim 2 or 4, characterized in that: After the step of matching the breakpoint address with the preset address in the breakpoint maintenance table to obtain the original instruction corresponding to the preset address matching the breakpoint address and performing the corresponding debugging operation, the method further comprises: If the breakpoint address matches the preset address in the temporary breakpoint table, restoring the original instruction corresponding to the breakpoint address, and deleting the preset address matching the breakpoint address in the temporary breakpoint table; If the breakpoint address matches the preset address in the breakpoint table, the original instruction corresponding to the breakpoint address is restored, and after the original instruction is executed, the original instruction is replaced with the specific exception instruction again.
6. The program debugging method according to claim 5, characterized in that: After the step of matching the breakpoint address with the preset address in the breakpoint maintenance table to obtain the original instruction corresponding to the preset address matching the breakpoint address and performing the corresponding debugging operation, the method further includes: Determine / generate a next temporary breakpoint address according to the breakpoint address, and save the original instruction of the next temporary breakpoint address into the temporary breakpoint table; The original instruction of the next temporary breakpoint address is replaced by the specific exception instruction.
7. The program debugging method according to claim 6, characterized in that: After the step of replacing the original instruction of the next temporary breakpoint address with the specific abnormal instruction, the method further includes: The dead loop instruction in the plug-in program is replaced with a null instruction to continue running the main program; when exiting the plug-in program, the null instruction is replaced with the dead loop instruction again.
8. The program debugging method according to claim 5, characterized in that: The step of matching the breakpoint address with a preset address in a breakpoint maintenance table to obtain an original instruction corresponding to the preset address matching the breakpoint address and performing a corresponding debugging operation, wherein the breakpoint maintenance table includes a breakpoint table and a temporary breakpoint table, comprises: In response to a breakpoint deletion instruction, obtaining a breakpoint to be deleted corresponding to the breakpoint deletion instruction; The to-be-deleted breakpoint is matched with the preset address in the breakpoint table, and the preset address and the original instruction corresponding to the preset address that match the to-be-deleted breakpoint in the breakpoint table are deleted.
9. An intelligent terminal, characterized in that: The intelligent terminal comprises: a memory and a processor, wherein a program debugging program is stored in the memory, and when the program debugging program is executed by the processor, the steps of the program debugging method according to any one of claims 1 to 8 are implemented.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the program debugging method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Breakpoint processing method and device for kernel mode program
CN110955598A
Program debugging method and device, equipment and storage medium
CN113742237A
Program debugging method and microcontroller
CN115269403A
Microcontroller software debugging method, debugging server and electronic equipment
CN116737528A
Remote debugging implementation method of embedded operating system
CN117472790A
Cited By
Debugging method and device, electronic equipment, storage medium and computer program product
CN121958069A