Program debugging method and device, medium, equipment and product
By opening the target debugging session in program debugging, detecting and skipping breakpoints, and obtaining or generating information according to the breakpoint type, the problems of frequent program pauses and low breakpoint processing efficiency in the existing technology are solved, and efficient program debugging is achieved.
Patent Information
- Application Number
- CN202411999819.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-01
AI Technical Summary
Existing program debugging methods require frequent pause of programs, interrupting normal operation processes, and it is difficult to effectively deal with different types of breakpoints, affecting debugging efficiency.
By opening the target debugging session, detect whether the target program runs to a breakpoint, skip the breakpoint according to the breakpoint type, obtain or generate program snapshot information or log information, and add it to the debug data.
It realizes that different types of breakpoints are effectively handled without interrupting the normal operation of the target program, improve program debugging efficiency, and uniformly manage and store information at breakpoints.
Smart Images

Figure CN119739617A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular, to a program debugging method, device, medium, equipment and product. Background Art
[0002] In the process of software development, program debugging is a key link to ensure program quality. In related technologies, developers usually set breakpoints in the program, and the program pauses when it reaches the breakpoint, so that the developer can check the program status information, such as variable values, stack information, etc., when the program is paused. However, this method requires the program to be paused frequently, which not only interrupts the normal running process of the program, but also may affect some program evaluations that require continuous observation of the program running status. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, the present disclosure provides a program debugging method, the method comprising: Opening a target debugging session, wherein the target debugging session is used to debug the target program; Detecting whether the target program runs to a breakpoint, wherein a plurality of breakpoints are set in the target program; In response to the target program running to a first breakpoint, skipping the first breakpoint to continue running the target program, and determining a target breakpoint type of the first breakpoint, the target breakpoint type being a first type for obtaining program snapshot information or a second type for generating program log information; Determining, according to the target breakpoint type, program information when the target program runs to the first breakpoint; Program information corresponding to the first breakpoint is added to debugging data of the target debugging session.
[0005] In a second aspect, the present disclosure provides a program debugging device, the device comprising: A session opening module, used to open a target debugging session, wherein the target debugging session is used to debug the target program; A detection module, used for detecting whether the target program runs to a breakpoint, wherein a plurality of breakpoints are set in the target program; a processing module, configured to, in response to the target program running to a first breakpoint, skip the first breakpoint to continue running the target program, and determine a target breakpoint type of the first breakpoint, wherein the target breakpoint type is a first type for obtaining program snapshot information or a second type for generating program log information; A first determining module, configured to determine program information when the target program runs to the first breakpoint according to the target breakpoint type; The adding module is used to add the program information corresponding to the first breakpoint to the debugging data of the target debugging session.
[0006] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect of the present disclosure.
[0007] In a fourth aspect, the present disclosure provides an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.
[0008] In a fifth aspect, the present disclosure provides a computer program product, including a computer program, which implements the steps of the method described in the first aspect of the present disclosure when the computer program is executed by a processor.
[0009] Through the above technical solution, in the process of opening a target debugging session to debug the target program, if the target program runs to a breakpoint, that is, the first breakpoint, the first breakpoint will be skipped, and the target breakpoint type to which the first breakpoint belongs will be determined to determine whether the first breakpoint is used to obtain program snapshot information or to generate program log information, and then, the program information when the target program runs to the first breakpoint is determined according to the target breakpoint type, and the program information corresponding to the first breakpoint is added to the debugging data of the target debugging session. Thus, different types of breakpoints can be effectively processed without interrupting the normal operation of the target program, and the operation of the target program will not be suspended, and the program information at the breakpoint can be obtained on demand, which is conducive to improving the efficiency of program debugging. In addition, the program information corresponding to the first breakpoint can be directly added to the debugging data of the target debugging session, which is conducive to unified management and storage of information collected from different breakpoints of the target program, and convenient for users to view and analyze in an orderly manner.
[0010] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 It is a flowchart of a program debugging method provided according to an embodiment of the present disclosure.
[0012] Figure 2 It is an exemplary schematic diagram of setting breakpoints in the program debugging method provided by the present disclosure.
[0013] Figure 3 A schematic diagram of an exemplary implementation scenario of the program debugging method provided in the present disclosure.
[0014] Figure 4 It is a block diagram of a program debugging device provided according to an embodiment of the present disclosure.
[0015] Figure 5 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0016] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0017] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0018] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0019] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0020] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0021] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0022] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0023] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0024] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0025] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0026] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0027] Figure 1 FIG. 1 is a flowchart of a program debugging method provided according to an embodiment of the present disclosure. Figure 1 As shown, the method provided by the present disclosure may include steps 11 to 15.
[0028] In step 11, a target debugging session is started.
[0029] Among them, by opening a target debugging session, the target program can be debugged.
[0030] In step 12, it is detected whether the target program runs to a breakpoint.
[0031] Among them, multiple breakpoints are set in the target program.
[0032] In the present disclosure, an integrated development environment (IDE) and an agent program (Agent) may be provided. The integrated development environment is used to implement interaction with users (i.e., developers), such as allowing users to set breakpoints, display debugging data related to the target program, etc. The agent program can manage debugging sessions, breakpoints, etc. Among them, the integrated development environment accesses the agent program. Optionally, the user can start the debugging service through the integrated development environment and set the debugging to be turned on or off. The agent program can monitor new debugging sessions, and can also stop monitoring debugging sessions when debugging is turned off.
[0033] For the target program to be debugged, the user can operate through the operation interface of the integrated development environment to set breakpoints in the target program. In the operation interface of the IDE, a breakpoint setting interface, a code display interface and a debugging data display interface can be provided. The breakpoint setting interface allows the user to set breakpoints, the code display interface displays the code information of the program to be debugged, and the debugging data display interface is used to display the debugging data obtained during the debugging process. The breakpoint setting in the target program in the present disclosure will be exemplarily described below.
[0034] In a possible implementation, the method provided by the present disclosure may further include the following steps: Acquire a breakpoint adding instruction, the breakpoint adding instruction including first information for indicating a breakpoint type and second information for indicating a breakpoint position; At the position indicated by the second information, a target breakpoint corresponding to the breakpoint type indicated by the first information is set, and the target breakpoint is used as the second breakpoint; In response to determining that the second breakpoint has been successfully set, success identification information corresponding to the breakpoint type of the second breakpoint is displayed at a position associated with the second breakpoint.
[0035] In the operation interface of the IDE, a first interactive component for adding breakpoints may be provided in the breakpoint setting interface, and the user may add breakpoints by operating the first interactive component.
[0036] Optionally, the first interactive component may be provided with a first component for setting a breakpoint type and a second component for setting a breakpoint position.
[0037] Among them, the breakpoint type may include a first type for obtaining program snapshot information and a second type for generating program log information. The breakpoint position can be set by combining the file path and the number of lines of code of the target program. For example, the second component can be an input box. Assuming that a breakpoint needs to be set at line 23 of the target program with a file path of A / B / C, you can enter "A / B / C:23".
[0038] Based on this, the user can input the first information through the first component and the second information through the second component, thereby generating a breakpoint adding instruction.
[0039] In response to the breakpoint adding instruction, a breakpoint may be set at a corresponding position of the target program according to the position indicated by the second information. Meanwhile, the type of the newly set target breakpoint (ie, the second breakpoint) is the breakpoint type indicated by the first information.
[0040] Furthermore, when the second breakpoint is set successfully, success identification information corresponding to the breakpoint type of the second breakpoint may be displayed at a position associated with the second breakpoint.
[0041] Information related to the second breakpoint, such as the first information, the second information, etc., may also be displayed in the breakpoint setting interface.
[0042] Optionally, the position associated with the second breakpoint may be within a preset range around the breakpoint position indicated by the second information. For example, it may be on the left side of a code line of the target program corresponding to the breakpoint position indicated by the second information.
[0043] For different breakpoint types, different success identification information can be pre-set to indicate that the breakpoint is successfully created and to identify the type of the breakpoint that has been added. For example, a first icon can be set as success identification information for a first type of breakpoint, and a second icon can be set as success identification information for a second type of breakpoint.
[0044] In addition, when the second breakpoint setting fails, failure identification information corresponding to the breakpoint type of the second breakpoint can also be displayed at a position associated with the second breakpoint. The success identification information and failure identification information of the same type of breakpoint are different. Optionally, the success identification information and failure identification information of the same type of breakpoint can use the same icon shape and different colors.
[0045] Optionally, if the breakpoint type indicated by the first information included in the breakpoint adding instruction is the second type, the breakpoint adding instruction may further include third information for indicating a log template, and the log template at least includes variables and operation rules corresponding to the variables.
[0046] Optionally, the first interactive component may also provide a third component for setting a log template, and the user may input third information by operating the third component. For example, the third component may be an input box.
[0047] The user can manually input the log template according to the actual debugging requirements to set the log output format. Usually, the log template at least includes variables and the operation rules corresponding to the variables. In addition, the log template can also include some texts and characters that can be directly output.
[0048] For example, the log template can be "the value of a+b is: {a+b}", where a and b are variables and a+b is the operation rule. In this way, if the value of variable a is 2 and the value of variable b is 0, the final generated log is "the value of a+b is: 2".
[0049] In a possible implementation, the method provided by the present disclosure may further include the following steps: Obtain a breakpoint deletion instruction, where the breakpoint deletion instruction is used to indicate the location information of the breakpoint to be deleted; In the target program, determining a third breakpoint according to a position indicated by the position information; Delete the third breakpoint from the target program.
[0050] In the operation interface of the IDE, a second interactive component for deleting breakpoints may also be provided, and the user may delete the added breakpoints by operating the second interactive component.
[0051] The location information of the breakpoint to be deleted is similar to the second information and can be set by combining the file path and the number of code lines of the target program.
[0052] After obtaining the breakpoint deletion instruction, the corresponding breakpoint, that is, the third breakpoint, can be located in the target program according to the location information indicated by the breakpoint deletion instruction, and then the third breakpoint can be deleted from the target program. At the same time, the information related to the third breakpoint can also be deleted from the breakpoint setting interface of the IDE.
[0053] Therefore, breakpoints can be freely set through the IDE, including adding and deleting. After the setting is successful, a target debugging session can be opened based on the set breakpoints to debug the target program.
[0054] Figure 2 FIG. 1 is an exemplary schematic diagram of setting breakpoints in the program debugging method provided by the present disclosure. Figure 2 As shown, the process of breakpoint setting can be described as follows.
[0055] The integrated development environment IDE triggers debugging of the target program through step (1) and starts a target debugging session.
[0056] The integrated development environment IDE adds breakpoints through step (2), and the added breakpoints can be breakpoints of the first type or breakpoints of the second type.
[0057] After the breakpoint is added, feedback is sent to the integrated development environment IDE through step (3) (for example, the success identification information corresponding to the breakpoint type described above).
[0058] The IDE deletes the added breakpoints through step (4).
[0059] After the breakpoint is deleted, feedback is sent to the integrated development environment IDE through step (5).
[0060] Steps (2) and (4) can be used to add or delete multiple breakpoints according to actual needs. Whenever an addition is successful, feedback is given through step (3), and whenever a deletion is successful, feedback is given through step (5).
[0061] Back to Figure 1 In step 13, in response to the target program running to the first breakpoint, the first breakpoint is skipped to continue running the target program, and a target breakpoint type of the first breakpoint is determined, the target breakpoint type is a first type for obtaining program snapshot information or a second type for generating program log information.
[0062] In step 14, program information when the target program runs to the first breakpoint is determined according to the target breakpoint type.
[0063] During the debugging of the target program, the target program continues to run. When the target program runs to a breakpoint (ie, the first breakpoint), the first breakpoint can be skipped to continue running the target program, thereby avoiding the target program from stopping and affecting subsequent debugging.
[0064] While skipping the first breakpoint, the target breakpoint type of the first breakpoint can also be determined to further obtain program information related to the first breakpoint, so that information related to the target program operation can be obtained without affecting the operation of the target program.
[0065] In a possible implementation, step 14 may include the following steps: If the target breakpoint type is the first type, target snapshot information when the target program runs to the first breakpoint is obtained as program information corresponding to the first breakpoint.
[0066] If the target breakpoint type is the first type, it means that the user expects to obtain snapshot information of the target program when setting the current first breakpoint. Therefore, the snapshot information when the target program runs to the first breakpoint, that is, the target snapshot information, can be obtained, and the target snapshot information can be used as the program information corresponding to the first breakpoint.
[0067] The target snapshot information includes variable information and stack information when the target program runs to the first breakpoint, which can reflect the state of the target program at that time.
[0068] In another possible implementation, step 14 may include the following steps: If the target breakpoint type is the second type, obtaining a target log template corresponding to the first breakpoint, the target log template at least including a target variable and a target operation rule corresponding to the target variable; Get the variable value of the target variable when the target program runs to the first breakpoint; According to the variable value of the target variable and the target operation rule, the operation result is obtained; According to the target template and the operation result, target log information is generated as program information corresponding to the first breakpoint.
[0069] If the target breakpoint type is the second type, it means that when setting the current first breakpoint, the user expects to obtain relevant information of the target program according to the set log template. Therefore, the log template corresponding to the first breakpoint can be first obtained as the target log template. The target log template is set by the user when setting the second type of breakpoint in the breakpoint setting stage.
[0070] Among them, the target log template at least includes the target variable and the target operation rules corresponding to the target variable, and reference may be made to the description of the log template in the previous text. Based on this, the variable value of the target variable when the target program runs to the first breakpoint can be obtained, and then the variable value is used to perform operations according to the target operation rules related to the target variable in the target log template to obtain the operation result, and then the target log information is generated according to the target template and the operation result as the program information corresponding to the first breakpoint. Referring to the description of the log template in the previous text, it can be seen that in addition to the target variable and the target operation rules, the target log template can also include directly output fields. Therefore, the operation result is added to the specified position in the target log template to generate the target log information. Among them, examples of log information have been provided in the previous text and will not be repeated here.
[0071] Referring to the above method, whenever the target program runs to a breakpoint, the breakpoint can be treated as the first breakpoint until debugging is stopped or the program runs to completion. Figure 2 The step (6) shown returns the program information determined at the breakpoint to the integrated development environment IDE, and thus the program information of multiple breakpoints is fed back until the integrated development environment IDE stops debugging through step (7) to close the target debugging session. In this way, the program information of all the breakpoints that have been run can be obtained without interrupting the running of the target program.
[0072] In step 15, program information corresponding to the first breakpoint is added to the debugging data of the target debugging session.
[0073] After determining the program information corresponding to the first breakpoint, the program information corresponding to the first breakpoint can be added to the debugging data of the target debugging session, and the debugging data can be displayed in the debugging data display interface. In this way, after the debugging of the target program is completed, the program information of all breakpoints in the target program is added and stored in the debugging data of the target debugging session.
[0074] Optionally, before executing step 15, the method provided by the present disclosure may further include the following steps: The program information corresponding to the first breakpoint is filtered according to a preset information filtering rule.
[0075] The information filtering rules can be set according to actual needs. In the information filtering rules, the variable name of the information to be filtered and the corresponding filtering rules can be set, so that for the program information corresponding to the first breakpoint, the variable value corresponding to the variable name indicated by the information filtering rule can be filtered according to the corresponding filtering rules.
[0076] For example, the filtering rules may be to delete the variable value, partially cover the variable value of the string type (such as replacing it with special characters without actual meaning), etc.
[0077] In this way, the program information of the target program can be effectively protected, data leakage during data debugging can be avoided, and information security can be guaranteed.
[0078] Optionally, the debugging data of the target debugging session can also be shared through the IDE. The debugging of the target program can be carried out through multiple debugging sessions, each of which will have corresponding debugging data, and different debugging sessions are distinguished by session identifiers. In this way, the debugging data of any debugging process can be flexibly shared according to needs, improving the convenience of debugging.
[0079] Figure 3 The following is a schematic diagram of an exemplary implementation scenario of the program debugging method provided by the present disclosure. Figure 3As shown, the user can set breakpoints through the integrated development environment IDE, and can also control the opening and closing of debugging. When the user triggers debugging through the IDE, the agent program Agent obtains corresponding program information according to the breakpoint related information set by the user in the IDE during the running of the target program without terminating the program running, and then performs certain filtering through the information filtering rules, and returns to the IDE for display and sharing in the IDE. Based on this, an exemplary process of the program debugging method provided by this solution can be described as follows.
[0080] The user operates the integrated development environment IDE, calls the debugging service, and sets the breakpoints required for debugging, wherein the user can add breakpoints, either the first type of breakpoints or the second type of breakpoints, and the user can delete breakpoints to delete the added breakpoints. Thus, multiple breakpoints P can be set in the target program.
[0081] Based on this, in the process of opening the target debugging session, the debugger is attached to the running target program to debug the target program. During the debugging process, whenever the target program runs to a set breakpoint (i.e., the first breakpoint), the agent Agent determines the program information corresponding to the first breakpoint while skipping the first breakpoint according to the method provided in step 13 and step 14, wherein the program information may be target snapshot information or target log information according to the type of the first breakpoint.
[0082] Afterwards, before the program information is fed back to the integrated development environment IDE, the program information is filtered according to the preset information filtering rules. The filtered program information is returned to the integrated development environment IDE as part of the debugging data of the target debugging session.
[0083] Among them, the target snapshot information can be displayed separately in the integrated development environment IDE according to the variable information and stack information it contains, and the target log information can be directly displayed in the integrated development environment IDE. In this way, after the target program is debugged, the debugging data of the target debugging session is obtained, and the user can share the debugging data through the integrated development environment IDE.
[0084] Through the above technical solution, in the process of opening a target debugging session to debug the target program, if the target program runs to a breakpoint, that is, the first breakpoint, the first breakpoint will be skipped, and the target breakpoint type to which the first breakpoint belongs will be determined to determine whether the first breakpoint is used to obtain program snapshot information or to generate program log information, and then, the program information when the target program runs to the first breakpoint is determined according to the target breakpoint type, and the program information corresponding to the first breakpoint is added to the debugging data of the target debugging session. Thus, different types of breakpoints can be effectively processed without interrupting the normal operation of the target program, and the operation of the target program will not be suspended, and the program information at the breakpoint can be obtained on demand, which is conducive to improving the efficiency of program debugging. In addition, the program information corresponding to the first breakpoint can be directly added to the debugging data of the target debugging session, which is conducive to unified management and storage of information collected from different breakpoints of the target program, and convenient for users to view and analyze in an orderly manner.
[0085] Figure 4 is a block diagram of a program debugging device provided according to an embodiment of the present disclosure. Figure 4 As shown, the device 30 may include: A session opening module 31 is used to open a target debugging session, wherein the target debugging session is used to debug a target program; A detection module 32, used to detect whether the target program runs to a breakpoint, wherein a plurality of breakpoints are set in the target program; a processing module 33, configured to, in response to the target program running to a first breakpoint, skip the first breakpoint to continue running the target program, and determine a target breakpoint type of the first breakpoint, where the target breakpoint type is a first type for obtaining program snapshot information or a second type for generating program log information; A first determination module 34, configured to determine program information when the target program runs to the first breakpoint according to the target breakpoint type; The adding module 35 is used to add the program information corresponding to the first breakpoint to the debugging data of the target debugging session.
[0086] Optionally, the device 30 further includes: A first acquisition module, used for acquiring a breakpoint adding instruction, wherein the breakpoint adding instruction includes first information for indicating a breakpoint type and second information for indicating a breakpoint position; A setting module, configured to set a target breakpoint corresponding to the breakpoint type indicated by the first information at a position indicated by the second information, and use the target breakpoint as a second breakpoint; The display module is configured to display success identification information corresponding to the breakpoint type of the second breakpoint at a position associated with the second breakpoint in response to determining that the second breakpoint has been successfully set.
[0087] Optionally, if the breakpoint type indicated by the first information included in the breakpoint adding instruction is the second type, the breakpoint adding instruction further includes third information for indicating a log template, and the log template at least includes variables and operation rules corresponding to the variables.
[0088] Optionally, the device 30 further includes: A second acquisition module is used to acquire a breakpoint deletion instruction, where the breakpoint deletion instruction is used to indicate the location information of the breakpoint to be deleted; A second determination module, configured to determine a third breakpoint in the target program according to a position indicated by the position information; A deletion module is used to delete the third breakpoint from the target program.
[0089] Optionally, the first determining module 34 includes: The first determining submodule is configured to, if the target breakpoint type is the first type, obtain target snapshot information when the target program runs to the first breakpoint as program information corresponding to the first breakpoint.
[0090] Optionally, the first determining module 34 includes: A first acquisition submodule, configured to acquire a target log template corresponding to the first breakpoint if the target breakpoint type is the second type, wherein the target log template at least includes a target variable and a target operation rule corresponding to the target variable; A second acquisition submodule, used for acquiring the variable value of the target variable when the target program runs to the first breakpoint; A second determination submodule, used to obtain a calculation result according to the variable value of the target variable and the target calculation rule; A generating submodule is used to generate target log information according to the target template and the operation result as program information corresponding to the first breakpoint.
[0091] Optionally, the device 30 further includes: The filtering module is used to filter the program information corresponding to the first breakpoint according to a preset information filtering rule before the adding module 35 adds the program information corresponding to the first breakpoint to the debugging data of the target debugging session.
[0092] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0093] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0094] like Figure 5 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0095] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0096] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0097] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0098] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0099] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0100] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: Opening a target debugging session, wherein the target debugging session is used to debug the target program; Detecting whether the target program runs to a breakpoint, wherein a plurality of breakpoints are set in the target program; In response to the target program running to a first breakpoint, skipping the first breakpoint to continue running the target program, and determining a target breakpoint type of the first breakpoint, the target breakpoint type being a first type for obtaining program snapshot information or a second type for generating program log information; Determining, according to the target breakpoint type, program information when the target program runs to the first breakpoint; Program information corresponding to the first breakpoint is added to debugging data of the target debugging session.
[0101] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0102] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0103] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, a session start module may also be described as a "module for starting a target debugging session."
[0104] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0105] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0106] According to one or more embodiments of the present disclosure, a program debugging method is provided, the method comprising: Opening a target debugging session, wherein the target debugging session is used to debug the target program; Detecting whether the target program runs to a breakpoint, wherein a plurality of breakpoints are set in the target program; In response to the target program running to a first breakpoint, skipping the first breakpoint to continue running the target program, and determining a target breakpoint type of the first breakpoint, the target breakpoint type being a first type for obtaining program snapshot information or a second type for generating program log information; Determining, according to the target breakpoint type, program information when the target program runs to the first breakpoint; Program information corresponding to the first breakpoint is added to debugging data of the target debugging session.
[0107] According to one or more embodiments of the present disclosure, a program debugging method is provided, the method further comprising: Acquire a breakpoint adding instruction, wherein the breakpoint adding instruction includes first information for indicating a breakpoint type and second information for indicating a breakpoint position; At the position indicated by the second information, setting a target breakpoint corresponding to the breakpoint type indicated by the first information, and using the target breakpoint as the second breakpoint; In response to determining that the second breakpoint has been set successfully, success identification information corresponding to the breakpoint type of the second breakpoint is displayed at a position associated with the second breakpoint.
[0108] According to one or more embodiments of the present disclosure, a program debugging method is provided. If the breakpoint type indicated by the first information included in the breakpoint adding instruction is the second type, the breakpoint adding instruction also includes third information for indicating a log template, and the log template at least includes variables and operation rules corresponding to the variables.
[0109] According to one or more embodiments of the present disclosure, a program debugging method is provided, the method further comprising: Obtaining a breakpoint deletion instruction, wherein the breakpoint deletion instruction is used to indicate location information of a breakpoint to be deleted; In the target program, determining a third breakpoint according to the position indicated by the position information; The third breakpoint is deleted from the target program.
[0110] According to one or more embodiments of the present disclosure, a program debugging method is provided, wherein determining, according to the target breakpoint type, program information when the target program runs to the first breakpoint includes: If the target breakpoint type is the first type, target snapshot information when the target program runs to the first breakpoint is obtained as program information corresponding to the first breakpoint.
[0111] According to one or more embodiments of the present disclosure, a program debugging method is provided, wherein determining, according to the target breakpoint type, program information when the target program runs to the first breakpoint includes: If the target breakpoint type is the second type, obtaining a target log template corresponding to the first breakpoint, the target log template at least including a target variable and a target operation rule corresponding to the target variable; Obtaining a variable value of the target variable when the target program runs to the first breakpoint; Obtaining a calculation result according to the variable value of the target variable and the target calculation rule; According to the target template and the operation result, target log information is generated as program information corresponding to the first breakpoint.
[0112] According to one or more embodiments of the present disclosure, a program debugging method is provided. Before the step of adding the program information corresponding to the first breakpoint to the debugging data of the target debugging session, the method further includes: The program information corresponding to the first breakpoint is filtered according to a preset information filtering rule.
[0113] According to one or more embodiments of the present disclosure, a program debugging device is provided, the device comprising: A session opening module, used to open a target debugging session, wherein the target debugging session is used to debug the target program; A detection module, used for detecting whether the target program runs to a breakpoint, wherein a plurality of breakpoints are set in the target program; a processing module, configured to, in response to the target program running to a first breakpoint, skip the first breakpoint to continue running the target program, and determine a target breakpoint type of the first breakpoint, wherein the target breakpoint type is a first type for obtaining program snapshot information or a second type for generating program log information; A first determining module, configured to determine program information when the target program runs to the first breakpoint according to the target breakpoint type; The adding module is used to add the program information corresponding to the first breakpoint to the debugging data of the target debugging session.
[0114] According to one or more embodiments of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processing device, the steps of the program debugging method provided by any embodiment of the present disclosure are implemented.
[0115] According to one or more embodiments of the present disclosure, there is provided an electronic device, including: a storage device having a computer program stored thereon; A processing device is used to execute the computer program in the storage device to implement the steps of the program debugging method provided in any embodiment of the present disclosure.
[0116] According to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the program debugging method provided by any embodiment of the present disclosure.
[0117] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0118] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0119] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. A program debugging method, characterized in that: The method comprises: Opening a target debugging session, wherein the target debugging session is used to debug the target program; Detecting whether the target program runs to a breakpoint, wherein a plurality of breakpoints are set in the target program; In response to the target program running to a first breakpoint, skipping the first breakpoint to continue running the target program, and determining a target breakpoint type of the first breakpoint, the target breakpoint type being a first type for obtaining program snapshot information or a second type for generating program log information; Determining, according to the target breakpoint type, program information when the target program runs to the first breakpoint; Program information corresponding to the first breakpoint is added to debugging data of the target debugging session.
2. The method according to claim 1, characterized in that The method further comprises: Acquire a breakpoint adding instruction, wherein the breakpoint adding instruction includes first information for indicating a breakpoint type and second information for indicating a breakpoint position; At the position indicated by the second information, setting a target breakpoint corresponding to the breakpoint type indicated by the first information, and using the target breakpoint as the second breakpoint; In response to determining that the second breakpoint has been set successfully, success identification information corresponding to the breakpoint type of the second breakpoint is displayed at a position associated with the second breakpoint.
3. The method according to claim 2, characterized in that If the breakpoint type indicated by the first information included in the breakpoint adding instruction is the second type, the breakpoint adding instruction further includes third information for indicating a log template, and the log template at least includes variables and operation rules corresponding to the variables.
4. The method according to claim 1, characterized in that: The method further comprises: Obtaining a breakpoint deletion instruction, wherein the breakpoint deletion instruction is used to indicate location information of a breakpoint to be deleted; In the target program, determining a third breakpoint according to the position indicated by the position information; The third breakpoint is deleted from the target program.
5. The method according to claim 1, characterized in that The determining, according to the target breakpoint type, program information when the target program runs to the first breakpoint includes: If the target breakpoint type is the first type, target snapshot information when the target program runs to the first breakpoint is obtained as program information corresponding to the first breakpoint.
6. The method according to claim 1, characterized in that The determining, according to the target breakpoint type, program information when the target program runs to the first breakpoint includes: If the target breakpoint type is the second type, obtaining a target log template corresponding to the first breakpoint, the target log template at least including a target variable and a target operation rule corresponding to the target variable; Obtaining a variable value of the target variable when the target program runs to the first breakpoint; Obtaining a calculation result according to the variable value of the target variable and the target calculation rule; According to the target template and the operation result, target log information is generated as program information corresponding to the first breakpoint.
7. The method according to claim 1, characterized in that Before the step of adding the program information corresponding to the first breakpoint to the debugging data of the target debugging session, the method further includes: The program information corresponding to the first breakpoint is filtered according to a preset information filtering rule.
8. A program debugging device, characterized in that: The device comprises: A session opening module, used to open a target debugging session, wherein the target debugging session is used to debug the target program; A detection module, used for detecting whether the target program runs to a breakpoint, wherein a plurality of breakpoints are set in the target program; a processing module, configured to, in response to the target program running to a first breakpoint, skip the first breakpoint to continue running the target program, and determine a target breakpoint type of the first breakpoint, wherein the target breakpoint type is a first type for obtaining program snapshot information or a second type for generating program log information; A first determining module, configured to determine program information when the target program runs to the first breakpoint according to the target breakpoint type; The adding module is used to add the program information corresponding to the first breakpoint to the debugging data of the target debugging session.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the steps of the method according to any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.