CN117827659A - Code debugging method and device and computing equipment - Google Patents

Code debugging method and device and computing equipment Download PDF

Info

Publication number
CN117827659A
CN117827659A CN202311873678.6A CN202311873678A CN117827659A CN 117827659 A CN117827659 A CN 117827659A CN 202311873678 A CN202311873678 A CN 202311873678A CN 117827659 A CN117827659 A CN 117827659A
Authority
CN
China
Prior art keywords
code
breakpoint
loop body
determining
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311873678.6A
Other languages
Chinese (zh)
Inventor
赵忠杰
赵建梁
郑长春
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Netease Shuzhifan Technology Co ltd
Original Assignee
Hangzhou Netease Shuzhifan Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Netease Shuzhifan Technology Co ltd filed Critical Hangzhou Netease Shuzhifan Technology Co ltd
Priority to CN202311873678.6A priority Critical patent/CN117827659A/en
Publication of CN117827659A publication Critical patent/CN117827659A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the disclosure provides a code debugging method, a code debugging device and computing equipment. The method comprises the following steps: responding to the debugging request, and determining a first code corresponding to the code to be debugged; the code to be debugged is a code for debugging indicated by a code debugging request, and the code to be debugged is obtained by combining logic codes of components in a low-code platform; determining at least one loop body contained in the first code; repeating the following steps until the execution of the first code is finished: if the first code line in the code behavior loop body which needs to be executed currently is determined, breakpoint information of the loop body is determined; the breakpoint information represents whether a breakpoint exists in the loop body; determining an execution mode of the target code line in the loop body when the target code line is executed for the time according to the breakpoint information, and executing the code line in the loop body based on the execution mode; code lines in the target code behavior loop body that are not nested into the remaining loop bodies; and outputting a debugging result corresponding to the breakpoint in the first code.

Description

Code debugging method and device and computing equipment
Technical Field
Embodiments of the present disclosure relate to the field of data processing, and more particularly, to a code debugging method, apparatus, and computing device.
Background
This section is intended to provide a background or context to the embodiments of the disclosure recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
The low code is a visualized application development method, and software development can be rapidly realized based on fewer codes. The user can complete software development through the components provided by the low code platform using logic of drag components or model drivers, etc.
How to code debug the software developed based on the low code platform to ensure the accuracy of the software development is a problem to be solved.
Disclosure of Invention
The present disclosure provides a code debugging method, apparatus and computing device to debug code built based on a low code platform.
In a first aspect of the embodiments of the present disclosure, there is provided a code debugging method, including: responding to the debugging request, and determining a first code corresponding to the code to be debugged; the code to be debugged is the code which is debugged and indicated by the debugging request, and the code to be debugged is obtained by combining logic codes of components in a low code platform; the first code is written in a general programming language;
Determining at least one loop body contained in the first code; the loop body is a code segment which needs to be repeatedly executed;
repeating the following steps until the first code execution ends: if the first code line in the code behavior loop body needing to be executed currently is determined, breakpoint information of the loop body is determined; the breakpoint information characterizes whether a breakpoint exists in the loop body; determining an execution mode of the target code line in the loop body when the target code line is executed for the time according to the breakpoint information, and executing the code line in the loop body based on the execution mode; code lines in the target code behavior loop body which are not nested into other loop bodies;
and outputting a debugging result corresponding to the breakpoint in the first code.
In one embodiment of the present disclosure, determining breakpoint information of the loop body includes:
if it is determined that another circulation body is nested in the circulation body and a breakpoint is arranged in the other circulation body, determining that the breakpoint exists in the circulation body.
In one embodiment of the present disclosure, the breakpoint has status information; the state information is any one of the following states: an enabled state, a disabled state; if it is determined that another loop body is nested in the loop body and a breakpoint is set in the other loop body, determining that the breakpoint exists in the loop body includes:
If it is determined that another circulation body is nested in the circulation body and a breakpoint in an enabling state is set in the other circulation body, determining that the breakpoint exists in the circulation body.
In one embodiment of the present disclosure, determining at least one loop body contained by the first code includes:
determining a mapping relation between the first code and the code to be debugged; the mapping relation comprises an identification of a component corresponding to the code to be debugged, a component type corresponding to the component and row information corresponding to the component; the row information is the position information of the mapping code of the component in the first code; the mapping code is a code corresponding to the component when mapped to the first code;
determining a component with the component type being a circulation type as a target component; and determining the mapped code of the target component as a loop body in the first code.
In one embodiment of the present disclosure, determining, according to the breakpoint information, an execution manner of the object code line in the loop body when the object code line is executed for the time includes:
if the breakpoint exists in the loop body, determining that the execution mode of the current execution of the target line of the loop body is a first mode; the first mode is that current execution state information of a code line is recorded in real time in an execution process; the execution state information is used for indicating a code block which is not executed currently in the target line; the code block is any one of a method, a function and a class;
If the fact that the breakpoint does not exist in the circulating body is determined, determining that the execution mode of the current execution of the target line of the circulating body is a second mode; the second mode is a mode of directly executing the target line.
In one embodiment of the present disclosure, the method further comprises:
responding to breakpoint operation, and adjusting breakpoint information of a target loop body in a first code according to the breakpoint operation; the breakpoint operation is used for indicating a target loop body needing to adjust breakpoint information, and the breakpoint operation is at least one operation of newly adding the breakpoint operation, deleting the breakpoint operation, starting the breakpoint operation and disabling the breakpoint operation to the first code;
if the target loop body is determined to be currently in the executing process, keeping the executing mode of the target code line in the target loop body unchanged in the current executing process.
In one embodiment of the present disclosure, the debug result corresponding to the breakpoint includes: at least one of a component corresponding to the code at the breakpoint on the low-code platform, a value of a debugging variable at the breakpoint, and thread information of a thread executing the code at the breakpoint.
In one embodiment of the disclosure, the breakpoint in the first code corresponds to a component corresponding to the code to be debugged.
In one embodiment of the present disclosure, the method further comprises: if the code line needing to be executed currently is determined to be not the code line in the loop body, determining that the first mode is the execution mode of the code line needing to be executed currently, and executing the code line needing to be executed currently according to the execution mode; the first mode is to record current execution state information of a code line in real time in an execution process.
In a second aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium comprising: the computer readable storage medium has stored therein computer executable instructions which, when executed by a processor, implement the method of any of the first aspects.
In a third aspect of the embodiments of the present disclosure, there is provided a code debugging apparatus, including:
the first determining unit is used for responding to the debugging request and determining a first code corresponding to the code to be debugged; the code to be debugged is the code which is debugged and indicated by the debugging request, and the code to be debugged is obtained by combining logic codes of components in a low code platform; the first code is written in a general programming language;
A second determining unit configured to determine at least one loop body included in the first code; the loop body is a code segment which needs to be repeatedly executed;
repeating the following third determining unit, fourth determining unit and first executing unit until the first code execution ends:
a third determining unit, configured to determine breakpoint information of a code behavior loop body if it is determined that a first code line in the code behavior loop body needs to be executed currently; the breakpoint information characterizes whether a breakpoint exists in the loop body;
a fourth determining unit, configured to determine, according to the breakpoint information, an execution manner when the object code line in the loop body is executed for the current time;
the first execution unit is used for executing the code line in the loop body based on the execution mode; code lines in the target code behavior loop body which are not nested into other loop bodies;
and the output unit is used for outputting a debugging result corresponding to the breakpoint in the first code.
In one embodiment of the present disclosure, the third determining unit is specifically configured to:
if it is determined that another circulation body is nested in the circulation body and a breakpoint is arranged in the other circulation body, determining that the breakpoint exists in the circulation body.
In one embodiment of the present disclosure, the breakpoint has status information; the state information is any one of the following states: an enabled state, a disabled state; the third determining unit is specifically configured to:
if it is determined that another circulation body is nested in the circulation body and a breakpoint in an enabling state is set in the other circulation body, determining that the breakpoint exists in the circulation body.
In one embodiment of the present disclosure, the second determining unit includes:
the first determining module is used for determining the mapping relation between the first code and the code to be debugged; the mapping relation comprises an identification of a component corresponding to the code to be debugged, a component type corresponding to the component and row information corresponding to the component; the row information is the position information of the mapping code of the component in the first code; the mapping code is a code corresponding to the component when mapped to the first code;
the second determining module is used for determining that the component with the component type being the circulation type is a target component;
and the third determining module is used for determining the mapping code of the target component as a cyclic body in the first code.
In one embodiment of the present disclosure, the fourth determining unit includes:
A fourth determining module, configured to determine, if it is determined that a breakpoint exists in the loop body, that an execution mode of the current execution of the target line of the loop body is a first mode; the first mode is that current execution state information of a code line is recorded in real time in an execution process; the execution state information is used for indicating a code block which is not executed currently in the target line; the code block is any one of a device, a function and a class;
a fifth determining module, configured to determine, if it is determined that the breakpoint does not exist in the loop body, that an execution mode of the current execution of the target line of the loop body is a second mode; the second mode is a mode of directly executing the target line.
In one embodiment of the present disclosure, the apparatus further comprises:
the adjusting unit is used for responding to the breakpoint operation and adjusting the breakpoint information of the target loop body in the first code according to the breakpoint operation; the breakpoint operation is used for indicating a target loop body needing to adjust breakpoint information, and the breakpoint operation is at least one operation of newly adding the breakpoint operation, deleting the breakpoint operation, starting the breakpoint operation and disabling the breakpoint operation to the first code;
and the control unit is used for keeping the execution mode of the target code line in the target loop body unchanged when the target code line is executed at the present time if the target loop body is determined to be currently in the executed process.
In one embodiment of the present disclosure, the debug result corresponding to the breakpoint includes: at least one of a component corresponding to the code at the breakpoint on the low-code platform, a value of a debugging variable at the breakpoint, and thread information of a thread executing the code at the breakpoint.
In one embodiment of the disclosure, the breakpoint in the first code corresponds to a component corresponding to the code to be debugged.
In one embodiment of the present disclosure, the apparatus further comprises:
a fifth determining unit, configured to determine, if it is determined that the code line to be executed currently is not a code line in the loop body, that the first mode is an execution mode of the code line to be executed currently;
the second execution unit is used for executing the code line which is required to be executed currently according to the execution mode; the first mode is to record current execution state information of a code line in real time in an execution process.
In a fourth aspect of embodiments of the present disclosure, there is provided a computing device comprising: at least one processor; and a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor to cause the computing device to perform the method of any of the first aspects.
According to the code debugging method, the code debugging device and the computing equipment, resources required to be occupied by codes generated based on a low-code platform in a debugging process can be reduced.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings, in which:
fig. 1 is a schematic view of a code debugging scenario provided in an embodiment of the present disclosure;
fig. 2 is a flow chart of a code debugging method according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a code debugging method according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a storage medium according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a code debugging device according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a computing device according to an embodiment of the present disclosure.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are presented merely to enable one skilled in the art to better understand and practice the present disclosure and are not intended to limit the scope of the present disclosure in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Those skilled in the art will appreciate that embodiments of the present disclosure may be implemented as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the following forms, namely: complete hardware, complete software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to an embodiment of the disclosure, a code debugging method, medium, device and computing equipment are provided.
In this context, it is to be understood that the terms involved:
the breakpoint, one of the debugger functions, can interrupt the program where needed, thereby facilitating its analysis.
Furthermore, any number of elements in the figures is for illustration and not limitation, and any naming is used for distinction only and not for any limiting sense.
In addition, the data related to the disclosure may be data authorized by the user or fully authorized by each party, and the collection, transmission, use and the like of the data all conform to the requirements of national related laws and regulations, and the embodiments of the disclosure may be mutually combined.
The principles and spirit of the present disclosure are explained in detail below with reference to several representative embodiments thereof.
Summary of The Invention
The inventor finds that with the development of a low-code platform, application program development by adopting a visual component provided by the low-code platform has become a main development mode. After programming based on components provided by the low code platform, how to debug the resulting application to ensure the accuracy of the application functions is a problem that needs to be solved.
In one possible implementation, when debugging an application program developed based on a low-code platform, the components and the logical combinations between the components required for programming on the interface based on the low-code platform can be generally converted into code written in a general-purpose programming language. And then, debugging the converted code. In the debugging process, in order to ensure that the debugging results corresponding to all the components corresponding to the codes can be obtained in the debugging process, the current execution state corresponding to each row of codes is recorded in real time in the code debugging process, so that the components which are executed in the current concrete can be positioned based on the execution state. However, the above method needs to consume additional resources to record the execution state, and especially when the code includes a large number of loops, or the loops have a large number of loops, the response speed of the debugging process is relatively slow, which affects the debugging efficiency.
Based on the above problems, the present disclosure provides a code debugging method, device and computing device, where after converting a program to be debugged written corresponding to a low code platform into a program written based on a general programming language, the method determines an execution mode of a code line included in a loop body by analyzing whether a breakpoint exists in the loop body in a code to be executed, so as to achieve a purpose of debugging the program written by the low code platform. And the execution mode of the target code line can be determined based on breakpoint information in the loop body, so that the problem of excessive resource occupation caused by the fact that state record operation needs to be executed on each line of code in the debugging process is avoided.
Having described the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are specifically described below.
Application scene overview
An application scenario of the solution provided in the present disclosure is first illustrated with reference to fig. 1. Fig. 1 is a schematic diagram of a code debugging scenario provided in an embodiment of the present disclosure. As shown in fig. 1, the low code platform and the code debugging platform are included in the figure. Wherein the low code platform may send code written based on the low code platform components to the code debugging platform. The code debugging platform performs code debugging based on the acquired code, and feeds back a debugging result to the low code platform when the code is executed to a breakpoint position in the code debugging process, so that the debugging result can be displayed on the low code platform in real time. It should be noted that the above application scenario is merely illustrative, and is not limited herein.
Exemplary method
A task monitoring method according to an exemplary embodiment of the present disclosure is described below with reference to fig. 1 in conjunction with the application scenario of fig. 1. It should be noted that the above application scenario is only shown for the convenience of understanding the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in any way in this respect. Rather, embodiments of the present disclosure may be applied to any scenario where applicable.
Fig. 2 is a flow chart of a code debugging method according to an embodiment of the present disclosure. As shown in fig. 2, the method comprises the steps of:
s201, responding to a debugging request, and determining a first code corresponding to a code to be debugged; the code to be debugged is a code for debugging indicated by a code debugging request, and the code to be debugged is obtained by combining logic codes of components in a low-code platform; the first code is written in a general purpose programming language.
Illustratively, the debug request in this embodiment may be used to indicate code to be debugged that needs to be debugged. It should be noted that, the code to be debugged in this embodiment is based on a combination of logic codes corresponding to components in the low code platform. The logic code corresponding to the component can be understood as the code corresponding to the component when the component is executed at the bottom layer of the low-code platform.
In addition, in this embodiment, after the code to be debugged is obtained, the code to be debugged may be subjected to code language conversion processing, so as to obtain the first code written in the general programming language. And obtaining a debugging result corresponding to the code to be debugged according to the first code to be debugged.
It should be noted that, in one possible implementation, the debugging may also be directly performed on the basis of the code to be debugged.
S202, determining at least one loop body contained in a first code; a loop body is a piece of code that needs to be repeatedly executed.
Illustratively, after determining the first code, a corresponding loop body in the first code may be further determined. It should be noted that, a loop body is a code segment in the code that needs to be repeatedly executed.
In one example, in determining the loop body in the first code, the corresponding loop body in the first code may be determined by detecting a programming statement corresponding to a loop structure contained in the first code. For example, for loop sentences, while loop sentences, and the like can be detected.
The following steps S203 to S204 are repeated until the first code execution ends:
s203, if the first code line in the code behavior loop body needing to be executed currently is determined, breakpoint information of the loop body is determined; the breakpoint information characterizes whether a breakpoint exists in the loop body.
Illustratively, after determining the loop body contained in the first code, the code lines contained in the first code are executed line by line. And, each time execution is performed to a first code line in a loop body included in the first code (i.e., a first code line in the loop body), it is necessary to detect whether a breakpoint exists in the current loop body.
In one example, whether a breakpoint exists in the loop body may be determined by querying the code line in which the breakpoint is located and the code line corresponding to the loop body.
S204, determining an execution mode of the target code line in the loop body when the target code line is executed for the time according to breakpoint information, and executing the code line of the loop body based on the execution mode; code lines in the object code behavior loop body that are not nested into the remaining loop body.
In this embodiment, after the breakpoint information in the loop body is acquired, the execution mode of the object code line in the loop body may be determined according to the breakpoint information. In this embodiment, the execution mode of the current execution of the object code line can be understood as the corresponding execution mode when the loop body executes at the current time.
It should be noted that, the object code line in the loop body may understand that, of the code lines included in the loop body, the code lines not embedded in the remaining loop bodies. If the code behavior is the code line in the rest of the loop body nested in the current loop body, the execution mode of the code line can be determined based on breakpoint information corresponding to the rest of the loop body.
For example, if the number of code lines corresponding to the loop body 1 is 1-10, and only one loop body 2 is nested in the loop body 1, and the number of lines corresponding to the loop body 2 is 5-8, then the number of target code lines corresponding to the loop body 1 is 1-4 and 9-10.
In addition, when determining the execution mode of the object code line in the loop body in this time according to the breakpoint information, in one possible implementation mode, if it is determined that the breakpoint exists in the loop body, a prompt may be sent to the user to determine whether to check the debugging result at the breakpoint, and if the user selects to avoid checking, the execution mode of the object code line in the current loop is direct execution, that is, the code execution state does not need to be recorded in real time. If it is determined that the loop body does not have a breakpoint, the current execution mode of the target code line can be direct execution.
Further, when determining the current execution mode of the target loop body in the loop body, code lines in the loop body may be sequentially executed according to the determined execution mode. That is, when executing the object code line into the loop body, the determined execution mode may be adopted to execute the object code line; when executing the rest of the loop body nested in the loop body, the process goes to the step S203, and the execution is repeated.
S205, outputting a debugging result corresponding to the breakpoint in the first code.
In this embodiment, after obtaining the debug result corresponding to the first code break point, the debug result at the first code break point may be output to the user.
It should be noted that, the timing of outputting the debug result may be that the debug result is output when the first code is executed to the breakpoint, or may be output after the execution of the first code is finished, which is not limited in this embodiment.
In addition, the debug result corresponding to the breakpoint may specifically include a value, debug time, etc. corresponding to a preset parameter to be debugged corresponding to the breakpoint, which is not limited in this embodiment.
It can be understood that in this embodiment, when executing the first line of each loop body in the first code, the execution mode corresponding to the current execution mode of the target code line in the loop body is determined based on the breakpoint information of whether the breakpoint exists in the loop body, so as to avoid the problem of large resource occupation caused by continuously recording the execution state corresponding to each line of code in the loop body in the code debugging process. In addition, in this embodiment, each time the loop body executes to the first time of the loop body, the execution mode of this time is determined based on the breakpoint information at the current time, so as to avoid the problem that when the breakpoint information corresponding to the loop body changes in the debugging process, the debugging result corresponding to the newly added breakpoint cannot be obtained in time, and also avoid the problem that when the code at the deleted breakpoint still adopts the mode corresponding to the breakpoint to execute, the debugging resource occupation amount is large easily caused.
Fig. 3 is a flowchart of yet another code debugging method according to an embodiment of the present disclosure. As shown in fig. 3, the method comprises the steps of:
s301, responding to a debugging request, and determining a first code corresponding to a code to be debugged; the code to be debugged is a code for debugging indicated by a code debugging request, and the code to be debugged is obtained by combining logic codes of components in a low-code platform; the first code is written in a general purpose programming language.
For example, the technical principle of step S301 may be referred to step S201, which is not described herein.
S302, determining a mapping relation between a first code and a code to be debugged; the mapping relation comprises an identification of a component corresponding to the code to be debugged, a component type corresponding to the component and row information corresponding to the component; the row information is the position information of the mapping code of the component in the first code; the mapping code is the code corresponding to the component when mapped to the first code.
In this embodiment, when determining the loop body included in the first code, the loop body may be determined according to a mapping relationship corresponding to when performing code conversion between the first code and the code to be debugged. The mapping relation specifically comprises the following steps: the identification of the component corresponding to the code to be debugged, the component type of the component corresponding to the code to be debugged and the line number of the mapping code obtained after the code corresponding to the component is converted in the first code, namely the line information corresponding to the component.
S303, determining a component with the component type being a circulation type as a target component, and determining a mapping code of the target component as a circulation body in the first code; a loop body is a piece of code that needs to be repeatedly executed.
For example, after the mapping relationship is obtained, a component with a component type being a loop type may be screened from components corresponding to the code to be debugged as a target component, and then the mapping code corresponding to the target component is regarded as a loop body to be determined in this embodiment.
It can be understood that in this embodiment, by using the component type corresponding to the mapping relationship and the code row corresponding to the component, the loop body included in the first code is quickly determined, so that a complex operation of determining the loop body by traversing the loop sentence in the first code is avoided.
The following steps S304-S305 are repeated until the first code execution ends:
s304, if it is determined that the code line to be executed is the first code line in the loop body, another loop body is nested in the loop body, and a breakpoint is set in the other loop body, determining that the breakpoint in the loop body is breakpoint information of the loop body. Wherein the breakpoint information characterizes whether a breakpoint exists in the loop body.
Illustratively, in this embodiment, the breakpoint information corresponding to the loop body may be determined in combination with the nested relationship between the loop bodies. Specifically, when breakpoint information in the loop body is determined, whether the loop body is escaped from other loop bodies or not can be determined, and if another loop body is nested in the loop body and a breakpoint is set in the other loop body, it is determined that the breakpoint also exists in the current loop body. That is, if a breakpoint exists in one loop body, all loop bodies including the loop body are loop bodies having the breakpoint. Furthermore, by the determination mode of the breakpoint information, the execution state information of the code can be recorded in real time from the outermost loop body comprising the breakpoint, so that the complete monitoring of the code at the breakpoint is realized.
In one example, if the remaining loop body is not nested in the loop body, but a breakpoint exists in a code line in the loop body, the loop body is determined to have the breakpoint.
In one example, a breakpoint has state information; the state information is any one of the following states: an enabled state, a disabled state; when step S304 is executed, if it is determined that another loop body is nested in the loop body and a breakpoint in an enabled state is set in the other loop body, it is determined that the breakpoint exists in the loop body.
For example, the breakpoint in the first code in this embodiment may also have status information, so as to determine whether the breakpoint is enabled by obtaining the status information corresponding to the breakpoint, and if the breakpoint is in the enabled state, the debug result at the breakpoint needs to be obtained is characterized. If the breakpoint is in a disabled state, the characterization does not need to output a debugging result corresponding to the breakpoint, namely the user does not care about an execution result at the breakpoint.
That is, when the breakpoint has state information, it is necessary to determine whether a breakpoint in the loop body exists in the current enabled state when determining the breakpoint information corresponding to the loop body. Specifically, if a breakpoint in an enabled state exists in another loop body nested in the loop body, it may be determined that the breakpoint exists in the current loop body.
It can be understood that in this embodiment, the breakpoint may also set state information, so that a user can adjust a code corresponding to a breakpoint that needs to be debugged temporarily in the debugging process by adjusting the state information corresponding to the breakpoint.
In one example, a breakpoint in the first code corresponds to a component to which the code is to be debugged.
Illustratively, the breakpoint in the first code in the present embodiment is set based on the component corresponding to the code to be debugged, that is, the breakpoint in the first code corresponds to the component corresponding to the code to be debugged. For example, there may be multiple breakpoints for one code line in the converted first code, with each breakpoint corresponding to one component.
It can be understood that in this embodiment, by associating the breakpoint in the first code with the component corresponding to the code to be debugged, so that the debugging result corresponding to each component can be checked in the component dimension later, which is convenient for the low code writer to modify the component in time.
S305, determining an execution mode of the target code line in the loop body when the target code line is executed for the time according to breakpoint information, and executing the code line in the loop body based on the execution mode; code lines in the object code behavior loop body that are not nested into the remaining loop body.
In one example, when determining the execution mode of the object code, the method may be implemented by the following steps: if the breakpoint in the loop body is determined, determining that the execution mode of the current execution of the target line of the loop body is a first mode; the first mode is that in the execution process, the current execution state information of the code line is recorded in real time; the execution state information is used for indicating a code block which is not executed currently in the target line; the code block is any one of a method, a function and a class; if the fact that the breakpoint does not exist in the loop body is determined, determining that the execution mode of the current execution of the target line of the loop body is a second mode; the second mode is a mode in which the target line is directly executed.
In this embodiment, when determining, according to the breakpoint information, the current execution mode of the object code line in the loop body, if it is determined that a breakpoint exists in the current loop body, it may be determined that breakpoint debugging is currently required at the breakpoint, and further, in order to ensure that obtaining a debugging result in the breakpoint debugging process may be completed, the first mode may be determined as the execution mode of the object code line in the loop body. The first mode is a mode of continuously recording state information to be executed corresponding to the code while the code is executed. The code execution state information may represent a code block in a code line that has not been executed currently, where the code block may specifically be any one of a method, a function, or a class in the code. Furthermore, the execution state information corresponding to the code line is recorded in real time, so that the execution state of the code execution is tracked.
However, if there is no breakpoint in the current loop body, in order to avoid the problem of high resource occupation caused by real-time recording of the execution state information, in this embodiment, the second mode may be used as the current execution mode of the target code line in the current loop body, that is, the mode of directly executing the code line.
It can be understood that in this embodiment, when the loop body is at a breakpoint, the execution state may be recorded in real time so as to determine the execution process of the current code, however, when the loop body is not at a breakpoint, the code may be directly executed without recording the execution state information, so as to avoid occupying a large amount of system resources in the debugging process.
In one example, the method may further include the following steps based on the above embodiment; responding to the breakpoint operation, and adjusting breakpoint information of a target loop body in the first code according to the breakpoint operation; the breakpoint operation is used for indicating a target loop body needing to adjust breakpoint information, and the breakpoint operation is at least one operation of newly adding the breakpoint operation, deleting the breakpoint operation, starting the breakpoint operation and disabling the breakpoint operation to the first code; if the target loop body is determined to be currently in the process of being executed, the execution mode of the target code line in the target loop body in the current execution is kept unchanged.
In this embodiment, the user may change the breakpoint existing in the first code by performing the breakpoint operation. Specifically, the breakpoint operation may occur before the first code is executed, or may occur during the first code debugging execution. In addition, the new breakpoint operation in this embodiment is an operation of adding a new breakpoint in the code. The delete breakpoint operation is an operation of deleting a breakpoint that has been added in the code. A start breakpoint operation may be understood as an operation that sets a breakpoint in a first code to a start state. And disable breakpoint operations, i.e., operations in which a breakpoint in code is set to a disabled state.
In this embodiment, after receiving the breakpoint operation, if it is determined that the breakpoint operation is set for the first code, the breakpoint information of the target loop body in the first code may be further adjusted according to the received breakpoint operation. The target loop body indicates a loop body with a breakpoint operation, wherein the loop body needs to be adjusted.
And if the breakpoint information of the target loop body is adjusted, the target loop body is currently in an executed state, and the execution mode corresponding to the target code line in the target loop body is kept unchanged until the next execution reaches the first line of the target loop body, and the execution mode of the target code line in the current execution of the target loop body is determined according to the latest breakpoint information.
It can be appreciated that the influence of the breakpoint operation on the breakpoint information in this embodiment does not change the execution mode of the target code line in the loop body currently being executed. Compared with the execution process of the circulating body, when the breakpoint information of the circulating body is switched from no breakpoint to a breakpoint, the first mode is immediately adopted as the execution mode, the mode cannot acquire the complete information of the current execution of the circulating body, system debugging resources are wasted, and the problem of the debugging resource waste can be avoided by the mode in the embodiment.
In one example, the first code execution process may further include the steps of:
if the code line needing to be executed currently is determined to be not the code line in the loop body, determining that the first mode is the execution mode of the code line needing to be executed currently, and executing the code line needing to be executed currently according to the execution mode; the first way is to record the current execution state information of the code line in real time in the execution process.
In this embodiment, if it is determined that the code line to be executed currently is not the code line included in any loop body in the first code during the execution of the first code, the first mode may be used as the execution mode of the code line to be executed currently. That is, in this embodiment, when executing the code line in the acyclic body, since such code line is executed only once in the execution of the first code and is not repeatedly executed in a cyclic manner, when executing such code line, the execution status information corresponding to the execution process may be recorded in real time during the execution of such code line, so that the execution position corresponding to the current first code may be located based on the execution status information.
In this embodiment, when executing the code line in the non-loop body in the first code, the first method may be directly adopted for execution, without determining whether the breakpoint exists in the code line again, so that the execution position corresponding to the code line may be determined in real time based on the recorded execution state information.
S306, outputting a debugging result corresponding to the breakpoint in the first code; the debugging result corresponding to the breakpoint comprises: at least one of a component corresponding to the code at the breakpoint on the low-code platform, a value of a debugging variable at the breakpoint, and thread information of a thread executing the code at the breakpoint.
In this embodiment, the debug result corresponding to the breakpoint may include not only the component corresponding to the breakpoint, that is, the breakpoint is set for which component corresponding to the code to be debugged, so that the component corresponding to the breakpoint may be subsequently determined, and the component corresponding to the obtained debug result may be determined. When the debugging result is output in real time, the user can be informed of the current corresponding debugging process, namely which component is debugged, based on the component corresponding to the breakpoint.
In addition, the debugging result can also comprise a value corresponding to a debugging variable corresponding to the breakpoint. The debugging variable can be a variable which is set in advance by a user and needs to be checked at the breakpoint, or can be a value of a parameter of a scope corresponding to the parameter at the breakpoint.
And, the debug result may also include thread information of the thread corresponding to the code at the execution breakpoint. So that it is possible to trace the thread information to which thread the code is executed later.
It can be understood that by outputting the above-mentioned debugging result, not only can the user be accurately informed of the component currently in debugging, but also the value of the parameter required to be debugged corresponding to the component can be displayed in real time. And the thread information of the thread corresponding to the breakpoint can be set, so that the subsequent user can analyze and debug the error reasons and other operations in combination with the thread indicated by the thread information.
For example, consider the example where there are 3 components in a code line. When the code line is executed in the first mode, the code blocks corresponding to the 3 components can be written into a stack structure in sequence according to the execution sequence. When a code block corresponding to a first component in a code line needs to be executed, a method entry event corresponding to the code block is created so as to mark that the code block is about to be executed by using the method entry event. After responding to the method entry event, deleting the method entry event (preventing repeated response), and creating a method exit event. After execution of the code block ends, the code block is ejected from the stack structure in response to the method exit event described above. Thereafter, the method exit event (preventing duplicate responses) is deleted and a step event is created; the code block corresponding to the second component is executed by repeating the above-described process by returning the program to the current code line in response to the created step event.
Exemplary Medium
Having described the method of the exemplary embodiments of the present disclosure, next, a storage medium of the exemplary embodiments of the present disclosure will be described with reference to fig. 4.
Referring to fig. 4, a storage medium 40 has stored therein a program product for implementing the above-described method according to an embodiment of the present disclosure, which may employ a portable compact disc read only memory (CD-ROM) and include computer-executable instructions for causing a computing device to perform the code debugging method provided by the present disclosure. However, the program product of the present disclosure is not limited thereto.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave in which the computer-executable instructions are carried. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. The readable signal medium may also be any readable medium other than a readable storage medium.
Computer-executable instructions for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-executable instructions may be executed entirely on the user computing device, partly on the user device, partly on the remote computing device, or entirely on the remote computing device or server. In the context of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN).
Exemplary apparatus
Having described the medium of the exemplary embodiment of the present disclosure, next, a code debugging device 500 of the exemplary embodiment of the present disclosure is described with reference to fig. 5, so as to implement the method in any method embodiment, and the implementation principle and technical effect are similar, and are not repeated herein.
Fig. 5 is a schematic structural diagram of a code debugging device according to an embodiment of the present disclosure, as shown in fig. 5, where the device includes:
a first determining unit 501, configured to determine, in response to a debug request, a first code corresponding to a code to be debugged; the code to be debugged is a code for debugging indicated by a code debugging request, and the code to be debugged is obtained by combining logic codes of components in a low-code platform; the first code is written in a general programming language;
a second determining unit 502, configured to determine at least one loop body included in the first code; the loop body is a code segment which needs to be repeatedly executed;
the following third determination unit 503, fourth determination unit 504, and first execution unit 505 are repeated until the first code execution ends:
a third determining unit 503, configured to determine breakpoint information of the loop body if it is determined that the code line is the first code line in the loop body of the code behavior that needs to be executed currently; the breakpoint information represents whether a breakpoint exists in the loop body;
A fourth determining unit 504, configured to determine, according to the breakpoint information, an execution manner when the object code line in the loop body is executed for the current time;
a first execution unit 505, configured to execute a code line in the loop body based on an execution manner; code lines in the target code behavior loop body that are not nested into the remaining loop bodies;
and an output unit 506, configured to output a debug result corresponding to the breakpoint in the first code.
In one example, the third determining unit is specifically configured to:
if it is determined that another circulation body is nested in the circulation body and a breakpoint is arranged in the other circulation body, determining that the breakpoint exists in the circulation body.
In one example, a breakpoint has state information; the state information is any one of the following states: an enabled state, a disabled state; the third determining unit is specifically configured to:
if it is determined that another loop body is nested in the loop body and a breakpoint in an enabling state is set in the other loop body, determining that the breakpoint exists in the loop body.
In one example, the second determining unit includes:
the first determining module is used for determining the mapping relation between the first code and the code to be debugged; the mapping relation comprises an identification of a component corresponding to the code to be debugged, a component type corresponding to the component and row information corresponding to the component; the row information is the position information of the mapping code of the component in the first code; the mapping code is the code corresponding to the component when mapped to the first code;
The second determining module is used for determining that the component with the component type being the circulation type is a target component;
and the third determining module is used for determining the mapping code of the target component as a cyclic body in the first code.
In one example, the fourth determining unit includes:
a fourth determining module, configured to determine, if it is determined that the breakpoint exists in the loop body, that an execution mode of the current execution of the target line of the loop body is a first mode; the first mode is that in the execution process, the current execution state information of the code line is recorded in real time; the execution state information is used for indicating a code block which is not executed currently in the target line; the code block is any one of a device, a function and a class;
a fifth determining module, configured to determine, if it is determined that the breakpoint does not exist in the loop body, that an execution mode of the current execution of the target line of the loop body is a second mode; the second mode is a mode in which the target line is directly executed.
In one example, the apparatus further comprises:
the adjusting unit is used for responding to the breakpoint operation and adjusting the breakpoint information of the target loop body in the first code according to the breakpoint operation; the breakpoint operation is used for indicating a target loop body needing to adjust breakpoint information, and the breakpoint operation is at least one operation of newly adding the breakpoint operation, deleting the breakpoint operation, starting the breakpoint operation and disabling the breakpoint operation to the first code;
And the control unit is used for keeping the execution mode of the target code line in the target loop body unchanged when the target loop body is executed at the present time if the target loop body is determined to be in the process of being executed at the present time.
In one example, the debug result corresponding to the breakpoint includes: at least one of a component corresponding to the code at the breakpoint on the low-code platform, a value of a debugging variable at the breakpoint, and thread information of a thread executing the code at the breakpoint.
In one example, a breakpoint in the first code corresponds to a component to which the code is to be debugged.
In one example, the apparatus further comprises:
a fifth determining unit, configured to determine, if it is determined that the code line to be executed currently is not a code line in the loop body, that the first mode is an execution mode of the code line to be executed currently;
the second execution unit is used for executing the code line which is required to be executed currently according to the execution mode; the first way is to record the current execution state information of the code line in real time in the execution process.
Exemplary computing device
Having described the methods, media, and apparatus of exemplary embodiments of the present disclosure, a computing device of exemplary embodiments of the present disclosure is next described with reference to fig. 6.
The computing device 60 shown in fig. 6 is merely an example and should not be taken as limiting the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 6, computing device 60 is in the form of a general purpose computing device. Components of computing device 60 may include, but are not limited to: at least one processing unit 601, at least one memory unit 602, a bus 603 connecting the different system components, including the processing unit 601 and the memory unit 602. Wherein at least one memory unit 602 has stored therein computer-executable instructions; at least one processing unit 601 includes a processor that executes computer-executable instructions to implement the methods described above.
Bus 603 includes a data bus, a control bus, and an address bus.
The storage unit 602 may include readable media in the form of volatile memory, such as Random Access Memory (RAM) 6021 and/or cache memory 6022, and may further include readable media in the form of non-volatile memory, such as Read Only Memory (ROM) 6023.
The storage unit 602 may also include a program/utility 6025 having a set (at least one) of program modules 6024, such program modules 6024 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Computing device 60 may also communicate with one or more external devices 604 (e.g., keyboard, pointing device, etc.). Such communication may occur through an input/output (I/O) interface 605. Moreover, computing device 60 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 606. As shown in fig. 6, the network adapter 606 communicates with other modules of the computing device 60 over the bus 603. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with computing device 60, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
It should be noted that although in the above detailed description several units/modules or sub-units/modules of a code debugging device are mentioned, such a division is only exemplary and not mandatory. Indeed, the features and functionality of two or more units/modules described above may be embodied in one unit/module in accordance with embodiments of the present disclosure. Conversely, the features and functions of one unit/module described above may be further divided into ones that are embodied by a plurality of units/modules.
Furthermore, although the operations of the methods of the present disclosure are depicted in the drawings in a particular order, this is not required to or suggested that these operations must be performed in this particular order or that all of the illustrated operations must be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform.
While the spirit and principles of the present disclosure have been described with reference to several particular embodiments, it is to be understood that this disclosure is not limited to the particular embodiments disclosed nor does it imply that features in these aspects are not to be combined to benefit from this division, which is done for convenience of description only. The disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (10)

1. A code debugging method, comprising:
responding to the debugging request, and determining a first code corresponding to the code to be debugged; the code to be debugged is the code which is debugged and indicated by the debugging request, and the code to be debugged is obtained by combining logic codes of components in a low code platform; the first code is written in a general programming language;
Determining at least one loop body contained in the first code; the loop body is a code segment which needs to be repeatedly executed;
repeating the following steps until the first code execution ends: if the first code line in the code behavior loop body needing to be executed currently is determined, breakpoint information of the loop body is determined; the breakpoint information characterizes whether a breakpoint exists in the loop body; determining an execution mode of the target code line in the loop body when the target code line is executed for the time according to the breakpoint information, and executing the code line in the loop body based on the execution mode; code lines in the target code behavior loop body which are not nested into other loop bodies;
and outputting a debugging result corresponding to the breakpoint in the first code.
2. The method of claim 1, wherein determining breakpoint information for the loop body comprises:
if it is determined that another circulation body is nested in the circulation body and a breakpoint is arranged in the other circulation body, determining that the breakpoint exists in the circulation body.
3. The method of claim 2, wherein the breakpoint has status information; the state information is any one of the following states: an enabled state, a disabled state; if it is determined that another loop body is nested in the loop body and a breakpoint is set in the other loop body, determining that the breakpoint exists in the loop body includes:
If it is determined that another circulation body is nested in the circulation body and a breakpoint in an enabling state is set in the other circulation body, determining that the breakpoint exists in the circulation body.
4. The method of claim 1, wherein determining at least one loop body contained in the first code comprises:
determining a mapping relation between the first code and the code to be debugged; the mapping relation comprises an identification of a component corresponding to the code to be debugged, a component type corresponding to the component and row information corresponding to the component; the row information is the position information of the mapping code of the component in the first code; the mapping code is a code corresponding to the component when mapped to the first code;
determining a component with the component type being a circulation type as a target component; and determining the mapped code of the target component as a loop body in the first code.
5. The method of claim 1, wherein determining, based on the breakpoint information, an execution manner of the object code line in the loop body when executed this time comprises:
if the breakpoint exists in the loop body, determining that the execution mode of the current execution of the target line of the loop body is a first mode; the first mode is that current execution state information of a code line is recorded in real time in an execution process; the execution state information is used for indicating a code block which is not executed currently in the target line; the code block is any one of a method, a function and a class;
If the fact that the breakpoint does not exist in the circulating body is determined, determining that the execution mode of the current execution of the target line of the circulating body is a second mode; the second mode is a mode of directly executing the target line.
6. The method according to claim 1, wherein the method further comprises:
responding to breakpoint operation, and adjusting breakpoint information of a target loop body in a first code according to the breakpoint operation; the breakpoint operation is used for indicating a target loop body needing to adjust breakpoint information, and the breakpoint operation is at least one operation of newly adding the breakpoint operation, deleting the breakpoint operation, starting the breakpoint operation and disabling the breakpoint operation to the first code;
if the target loop body is determined to be currently in the executing process, keeping the executing mode of the target code line in the target loop body unchanged in the current executing process.
7. The method of claim 1, wherein the debug result corresponding to the breakpoint comprises: at least one of a component corresponding to the code at the breakpoint on the low-code platform, a value of a debugging variable at the breakpoint, and thread information of a thread executing the code at the breakpoint.
8. The method of claim 1, wherein the breakpoint in the first code corresponds to a component to which the code is to be debugged.
9. A code debugging device, comprising:
the first determining unit is used for responding to the debugging request and determining a first code corresponding to the code to be debugged; the code to be debugged is the code which is debugged and indicated by the debugging request, and the code to be debugged is obtained by combining logic codes of components in a low code platform; the first code is written in a general programming language;
a second determining unit configured to determine at least one loop body included in the first code; the loop body is a code segment which needs to be repeatedly executed;
repeating the following third determining unit, fourth determining unit and first executing unit until the first code execution ends:
a third determining unit, configured to determine breakpoint information of a code behavior loop body if it is determined that a first code line in the code behavior loop body needs to be executed currently; the breakpoint information characterizes whether a breakpoint exists in the loop body;
a fourth determining unit, configured to determine, according to the breakpoint information, an execution manner when the object code line in the loop body is executed for the current time;
the first execution unit is used for executing the code line in the loop body based on the execution mode; code lines in the target code behavior loop body which are not nested into other loop bodies;
And the output unit is used for outputting a debugging result corresponding to the breakpoint in the first code.
10. A computing device, comprising:
at least one processor;
and a memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor to cause the computing device to perform the method of any one of claims 1 to 8.
CN202311873678.6A 2023-12-29 2023-12-29 Code debugging method and device and computing equipment Pending CN117827659A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311873678.6A CN117827659A (en) 2023-12-29 2023-12-29 Code debugging method and device and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311873678.6A CN117827659A (en) 2023-12-29 2023-12-29 Code debugging method and device and computing equipment

Publications (1)

Publication Number Publication Date
CN117827659A true CN117827659A (en) 2024-04-05

Family

ID=90505536

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311873678.6A Pending CN117827659A (en) 2023-12-29 2023-12-29 Code debugging method and device and computing equipment

Country Status (1)

Country Link
CN (1) CN117827659A (en)

Similar Documents

Publication Publication Date Title
CN107506300B (en) User interface testing method, device, server and storage medium
US8386851B2 (en) Functional coverage using combinatorial test design
US10761963B2 (en) Object monitoring in code debugging
US20130132933A1 (en) Automated compliance testing during application development
US20080276129A1 (en) Software tracing
US20150006961A1 (en) Capturing trace information using annotated trace output
US8752027B2 (en) Injecting faults into program for testing software
US8117499B2 (en) Generation of a stimuli based on a test template
CN110597704B (en) Pressure test method, device, server and medium for application program
CN105204986A (en) Automated product testing method, server and mobile equipment
CN111459814A (en) Automatic test case generation method and device and electronic equipment
CN109542341B (en) Read-write IO monitoring method, device, terminal and computer readable storage medium
US20110258613A1 (en) Software debugger activation based on key performance indicators
CN117827659A (en) Code debugging method and device and computing equipment
CN110837467A (en) Software testing method, device and system
CN112463574A (en) Software testing method, device, system, equipment and storage medium
CN110806981B (en) Application program testing method, device, equipment and storage medium
KR100901780B1 (en) Non-stop Debugging Apparatus for Correcting Errors in Embedded Systems and Method thereof
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN114116291B (en) Log detection method, log detection device, computer device and storage medium
CN112114811A (en) Compiling method, device and equipment
CN116820946B (en) Method and device for automatically testing compatibility of target software
CN116069687A (en) Verification method, verification device and processor for data consistency
CN113127002B (en) Method, device, equipment and medium for monitoring code compiling process
CN114692382B (en) Management method and device for nuclear power simulation model development data and computer equipment

Legal Events

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