CN115269404A - Debugging method, device and equipment of code based on interpretation execution - Google Patents

Debugging method, device and equipment of code based on interpretation execution Download PDF

Info

Publication number
CN115269404A
CN115269404A CN202210878244.4A CN202210878244A CN115269404A CN 115269404 A CN115269404 A CN 115269404A CN 202210878244 A CN202210878244 A CN 202210878244A CN 115269404 A CN115269404 A CN 115269404A
Authority
CN
China
Prior art keywords
code
debugging
executed
context information
execution
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
CN202210878244.4A
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.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information 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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202210878244.4A priority Critical patent/CN115269404A/en
Publication of CN115269404A publication Critical patent/CN115269404A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Abstract

The embodiment of the specification discloses a debugging method, a debugging device and debugging equipment of a code based on interpretation execution. By receiving a debug instruction that includes a location of an interrupt point; interpreting and executing a code to be executed corresponding to the debugging instruction; and confirming whether the position of the code in the execution process is matched with the interrupt point position, interrupting the interpretation execution of the code to be executed when the position of the code is matched with the interrupt point position, acquiring the context information during interruption and sending the context information to a sender of the debugging instruction. Therefore, an explanation-based execution mode is realized, and the problems of extra processing overhead and code volume expansion brought by the traditional debugging method are solved.

Description

Debugging method, device and equipment of code based on interpretation execution
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a method, an apparatus, and a device for debugging a code executed based on an interpretation.
Background
Before a program or application is online, various kinds of debugging are usually required to be performed on a code corresponding to the program to ensure that the program operates normally. In the current debugging process of the code, a hook function for debugging is often injected into the code to be debugged in advance, and basic debugging operations such as breakpoint, line-by-line execution, reading of memory variables, and modification of variables are completed through the hook function. Because the hook function needs to be injected into the code in advance, on one hand, the compiling performance of the code is influenced, and the size of the code is increased by the same attribute.
Based on this, a more convenient debugging scheme for code is needed.
Disclosure of Invention
One or more embodiments of the present specification provide a debugging method based on interpreted executed code, so as to solve the following technical problems: a more convenient debugging scheme for code is needed.
To solve the above technical problem, one or more embodiments of the present specification are implemented as follows:
in a first aspect, an embodiment of the present specification provides a method for debugging code executed based on interpretation, including: receiving a debugging instruction containing an interrupt point position; interpreting and executing a code to be executed corresponding to the debugging instruction; and confirming whether the position of the code in the execution process is matched with the interrupt point position, interrupting the interpretation execution of the code to be executed when the position of the code is matched with the interrupt point position, acquiring the context information during interruption and sending the context information to a sender of the debugging instruction.
In a second aspect, an embodiment of the present specification provides a debugging apparatus for executing code based on interpretation, including: the receiving module receives a debugging instruction containing the position of the interrupt point; the execution module is used for explaining and executing the code to be executed corresponding to the debugging instruction; and the interruption module is used for confirming whether the position of the code in the execution process is matched with the interruption point position, interrupting the interpretation execution of the code to be executed when the position of the code is matched with the interruption point position, acquiring context information during interruption and sending the context information to the sender of the debugging instruction.
In a third aspect, embodiments of the present specification provide an electronic device, including:
at least one processor; and (c) a second step of,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
In a fourth aspect, embodiments of the present specification provide a non-transitory computer storage medium having stored thereon computer-executable instructions that, when read by a computer, cause one or more processors to perform a method according to the first aspect.
At least one technical scheme adopted by one or more embodiments of the specification can achieve the following beneficial effects: by receiving a debug instruction that includes a location of an interrupt point; interpreting and executing a code to be executed corresponding to the debugging instruction; and confirming whether the position of the code in the execution process is matched with the interrupt point position, interrupting the interpretation execution of the code to be executed when the position of the code is matched with the interrupt point position, acquiring the context information during interruption and sending the context information to a sender of the debugging instruction. Therefore, an explanation execution based mode is realized, the problems of extra processing overhead and code volume expansion brought by the traditional debugging method are solved, the code compiling speed is greatly improved, the code volume is reduced, and the method is more convenient.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort.
FIG. 1 is a diagram illustrating debugging of code in the prior art;
FIG. 2 is a flowchart illustrating a debugging method based on interpreted executed code according to an embodiment of the present disclosure;
FIG. 3 is a diagram illustrating remote debugging provided by an embodiment of the present disclosure;
FIG. 4 is a diagram illustrating an abstract syntax tree according to an embodiment of the present disclosure;
FIG. 5 is a schematic structural diagram of a debugging apparatus based on interpreted executed code according to an embodiment of the present specification;
fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present specification.
Detailed Description
The embodiment of the specification provides a debugging method, a debugging device, equipment and a storage medium based on interpreted and executed codes.
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any inventive step based on the embodiments of the present disclosure, shall fall within the scope of protection of the present application.
In the current debugging mode for code, remote debugging is often required. That is, debugging the code related in the customer client through the server, and at this time, in order to obtain the corresponding debugging data, a instrumentation debugging scheme is generally adopted. The method comprises the steps of injecting a hook function for debugging into a code needing to be executed in advance, and when a debugger executes a specified code, returning information of a current execution context through the corresponding hook function so as to debug. Taking a code corresponding to the Javascript application as an example, as shown in fig. 1, fig. 1 is a schematic diagram of debugging a code in the prior art. The main process is as follows:
1, performing static analysis on an original JavaScript application to obtain the position of each statement debugging point needing to be instrumented and the variable in each action domain;
and 2, performing instrumentation on the JavaScript code of the original JavaScript application, namely injecting a corresponding debugging hook function. After pile insertion, obtaining adjustable Web application;
and 3, operating the adjustable Web application, and performing bidirectional communication between the logic of the instrumented part and the debugging server, so that debugging basic operations such as breakpoint, line-by-line execution, memory variable reading, variable modification and the like can be completed according to the control instruction of the debugging server.
In the above method, since the hook function needs to be inserted in advance, the code source code needs to be instrumented, which affects the compiling performance of the code and increases the size of the code. Based on this, the embodiments of the present specification provide a more convenient debugging scheme for code.
As shown in fig. 2, fig. 2 is a flowchart illustrating a debugging method based on interpreted executed code according to an embodiment of the present specification, including the following steps:
s201: a debug instruction is received that includes an interrupt point location.
In embodiments of the present specification, debugging of program code may occur in a client of a consuming user. For example, the debuggee object may be applet code or hypertext markup language H5 code in a user application. The server can select part of the clients to carry out corresponding debugging. Debugging refers to reading state information in program execution, locating errors in an isolation and elimination mode, determining the cause of error generation and providing a solution for correcting errors.
The debugging party can input the position of the interrupt point to the server through the self front-end equipment, and sends a debugging instruction containing the position of the interrupt point to the client of the consumer through the server.
The interrupt location is used to indicate the location of the code where the interrupt should occur during execution. For example, the form may be "5 th row, 1 st column", or "start row or end row of the xx th block", or the like. The number of the break point positions included in the debug instruction may be one or more.
S203, the to-be-executed code corresponding to the debugging instruction is interpreted and executed.
In the embodiments of the present specification, the Interpreted execution refers to an interpreter executing code to be executed in real time, wherein the code to be executed should be written based on an Interpreted language (Interpreted language).
An interpreted language is a type of programming language. This type of programming language directly executes the code one sentence by one sentence, and does not need to be Compiled into machine code and then executed by a compiler first, as in the case of the Compiled language (Compiled language). Interpreted languages require the use of an interpreter to dynamically interpret (interpret) code as machine code during execution, or as a subroutine that has been previously compiled into machine code and then executed.
For example, orcale Java, javaScript, python, and shell, among others, are all the aforementioned interpreted languages. The oracle Java is a bytecode for compiling Java source codes into Java, that is, a class file, where there is a compiled action, and then the bytecode is loaded into the JVM and interpreted and executed item by item. The same is true for Python, where Python source code is first compiled into bytecodes, possibly stored in a bytecodes file of pyc, which are then interpreted by an interpreter. JavaScript was earlier to compile source code into an Abstract Syntax Tree (AST), and then to execute the abstract syntax tree directly.
S205, confirming whether the position of the code in the execution process is matched with the interrupt point position, interrupting the interpretation execution of the code to be executed when the position of the code is matched with the interrupt point position, acquiring the context information during interruption and sending the context information to the sender of the debugging instruction
The interpreter interprets the executing code item by item and compares the position of the executing code with the position of the interruption point every time the executing code item is executed. For example, assuming the interrupt location is set as the lower set of column numbers { (4, 1), (4, 5), (7, 3) }, the interpreter will interrupt when executing the code to row 4, column 1, row 4, column 5, and row 7, column 3.
And when the matching occurs, interrupting the interpreted execution of the code to be executed. The interrupted execution is suspended. When the interruption occurs, the notification information of the position of the hit interruption point can be sent to the server, and the context information during the interruption is obtained and sent to the sender of the debugging instruction.
Context information in the debugging process is a set of data that is essential in debugging. These data allow debugging of the interrupt, after which the interrupted program can continue to execute in the same place.
Taking Javascript as an example, when an interrupt occurs, the interpreter may provide basic information required for debugging through the maintenance scope. The basic interfaces of a scope object include various interfaces such as parent, context, find, and var/let/const. Wherein, the parent interface points to the father scope to form a scope chain; context is used for indicating that the identifier declared under the current scope is contained, and find is used for searching the identifier along the scope chain; and var, let, const make different scope declarations, respectively.
By maintaining the scope, context information during interruption is provided, and relevant debugging information generated during interruption can be generated to the server side for corresponding debugging.
By receiving a debug instruction that includes a location of an interrupt point; interpreting and executing a code to be executed corresponding to the debugging instruction; and confirming whether the position of the code in the execution process is matched with the interrupt point position, interrupting the interpretation execution of the code to be executed when the position of the code is matched with the interrupt point position, acquiring the context information during interruption and sending the context information to a sender of the debugging instruction. Therefore, an explanation execution based mode is realized, the problems of extra processing overhead and code volume expansion brought by the traditional debugging method are solved, the code compiling speed is greatly improved, the code volume is reduced, and the method is more convenient.
In one embodiment, after debugging of an interruption point is complete, then the code needs to continue execution. At this time, the debugger can still initiate a breakpoint release instruction through the server. After receiving the instruction for releasing the breakpoint, the interpreter in the client may end the interrupted state of the code to be executed, and continue to interpret and execute the code after the position of the breakpoint.
When the interpreter releases the interruption point, because the context information corresponding to the interruption is obtained and maintained in advance, the to-be-executed code can be continuously executed based on the context when the interpreter is interrupted, and the stability of code execution in the debugging process is maintained.
As shown in fig. 3, fig. 3 is a schematic diagram of remote debugging provided in the embodiment of the present disclosure. The interpreter inquires whether the interrupt points are matched or not in the interpretation and execution process, once the interrupt points are matched with the upper level, the interpreter sends related notification to the debugging party through the service end, and the debugging party carries out debugging. After the debugging of the interruption point is completed, the debugging party can manually operate to release the interruption point, and the interpreter continues to execute the codes.
In one embodiment, if a code to be executed is written by JavaScript, an interpreter needs to analyze the code to execute the code to obtain an abstract syntax tree, wherein the abstract syntax tree includes a plurality of nodes, and then executes the nodes of the abstract syntax tree by a traversal interpretation; correspondingly, confirming whether the codes corresponding to the positions of the interruption points are matched comprises the following steps: and confirming whether the node is matched with the interrupt point position or not for any node to be executed.
Specifically, in executing the nodes of the abstract syntax tree, the abstract syntax tree may be accessed from an abstract syntax tree root node and then executed according to a traversal interpretation of a preset specification, for example, based on the European Computer Manufacturers Association (ECMA specification).
For different types of nodes, respective processing functions are implemented, and the traversal order of the nodes is determined by the preset specification of each node type. For example, for the code:
function a(){}
a()
a visualization structure of the corresponding ast is shown in fig. 4, and fig. 4 is a schematic diagram of an abstract syntax tree provided in the embodiment of the present specification. Which contains Program nodes. For this type of node, each child node is required to be accessed in sequence based on the aforementioned ECMA specification, namely, the function declaration is accessed first, and then the expressstatement is accessed. For the CallExpression node, the callee attribute is calculated firstly, in this case, the CallExpression node is an Identifier type node, namely, the CallExpression node is accessed, the value corresponding to the Identifier "a" is obtained from the action domain and returned, the attribute is continuously calculated when the CallExpression node returns to CallExpression, in this case, the function a call is empty without a reference, and finally the value of "a" is called and the result is returned. In this way, stable and accurate interpretation execution is realized in the interpretation execution process.
In one embodiment, the discontinuity location is labeled in the form of a row and column number. For example, a debugger user adds an interrupt point at the front end, and the debugger front end sends a debug instruction for adding a breakpoint, where the instruction includes a row number and a column number of the breakpoint position, where pseudo codes corresponding to the breakpoint position may be as follows:
{
"unique address": "https: js.// localhost/index,
"line number": 3,
"column number": 0
}。
And determining the 3 rd row and the 0 th column as the position of the interrupt point. Correspondingly, when the interpreter executes each node based on the EMCA specification and needs to determine whether the node matches the interrupt point position, it needs to obtain the row and column number information contained in the abstract syntax tree from the abstract syntax tree and obtain the row and column number corresponding to the node from the row and column number information; and further determining whether the row and column number corresponding to the node matches the row and column number of the characterization code position.
In other words, the interpreter executes nodes in the AST in a traversal manner, and queries whether there is an existing break point position each time a new node is visited, because the AST carries the line number information, the AST can be matched with the line number of the break point in the observer, and if there is a match, it is considered that the break point is hit on the current statement, and the continued execution of the statement is stopped, that is, the statement is interrupted.
In one embodiment, when matching an upper break point and halting execution of code during debugging, the execution context of the entire program needs to be brought into a Pause execution (Pause) state. In a real scenario, there may be other external codes. Execution of these external codes may change the context information at the time of the interrupt.
For example, when the payment application debugs the h5 code of the applet, there may be other external codes in the h5 page that need to be executed, and the execution of the part of the code may depend on or affect the execution of the context information, for example, the external code may be a party initiating a call to a third party or requesting a remote service based on the context information, and the execution of the external codes may make a call with the aforementioned code to be executed in the present scheme, which may change the context information, and cause a debug exception.
Based on this, in order to control the execution flow more accurately, if an external code needs to be executed during debugging, the external code executing party can be determined, and then a synchronous call is initiated to the external code executing party based on the context information. By synchronizing the calls, it is thus possible to cause the execution of the aforesaid external code to be blocked, avoiding the change of context information.
Specifically, when a synchronous call is initiated to the external code executing party based on the context information, a browser adopted by the code to be executed can be determined; and initiating synchronous call to the external code executing party through a standard function set interface of the browser. For example, the standard function set interface of the browser may be a synchronous XMLHttpRequest API interface of the browser, enabling suspended execution of the interrupted context information
The scheme of the application can be operated in any remote debugging scene. For example, the code to be executed comprises applet code or hypertext markup language H5 code applied in the client; correspondingly, the sender of the debugging instruction comprises the server corresponding to the client. The debugger may send the debug protocol over the network to the debugger front end (i.e., the customer's client). The debugging process depends on a network interface provided by a host context to make a request, such as WebSocket in a browser, net module in node. Js monitoring and the like. Therefore, when debugging is performed on different platforms, different APIs need to be called, and thus, it is possible to pack respective debugging package files for each platform, which can be widely used.
Based on the same idea, one or more embodiments of the present specification further provide apparatuses and devices corresponding to the above-described method, as shown in fig. 5 and fig. 6.
In a second aspect, as shown in fig. 5, fig. 5 is a schematic structural diagram of a debugging apparatus based on interpreted executed code according to an embodiment of the present specification, where the apparatus includes:
a receiving module 501, configured to receive a debugging instruction including a location of an interrupt point;
the execution module 503 is configured to interpret and execute the to-be-executed code corresponding to the debug instruction;
and the interrupt module 505 is used for confirming whether the position of the code in the execution process is matched with the interrupt point position, interrupting the interpretation execution of the code to be executed when the position of the code to be executed is matched with the interrupt point position, acquiring context information during interruption and sending the context information to a sender of the debugging instruction.
Optionally, the execution module 503 is configured to determine an abstract syntax tree corresponding to the code, where the abstract syntax tree includes a plurality of nodes; executing nodes of the abstract syntax tree by means of traversal interpretation; accordingly, the interruption module 505, for any node to be executed, determines whether the node matches the interruption point position.
Optionally, in the apparatus, the interrupt location is a row and column number characterizing a code location; correspondingly, the interruption module 505 obtains the row and column number information included in the abstract syntax tree, and obtains the row and column number corresponding to the node from the row and column number information; and determining whether the row and column number corresponding to the node matches the row and column number of the characterization code position.
Optionally, the apparatus further includes a releasing module 507, which receives a breakpoint releasing instruction sent by a sender of the debug instruction; and the execution module 503 continues to execute the code to be executed according to the context information from the interruption point position.
Optionally, the apparatus further comprises a blocking module 509 for determining an external code executing party, wherein the external code executing party executes the external code based on the context information and initiates a synchronization call to the external code executing party based on the context information.
Optionally, the blocking module 509 determines a browser used by the code to be executed; and initiating synchronous call to the external code executing party through a standard function set interface of the browser.
Optionally, the executing module 503 executes the nodes of the abstract syntax tree based on a traversal interpretation of a preset specification, starting from the root node of the abstract syntax tree.
Optionally, in the apparatus, the code to be executed includes applet code or hypertext markup language H5 code applied in the client; correspondingly, the sender of the debugging instruction comprises the server corresponding to the client.
In a third aspect, as shown in fig. 6, fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of this specification, where the electronic device includes:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
In a fourth aspect, based on the same idea, the embodiments of this specification further provide a non-volatile computer storage medium corresponding to the method described above, and storing computer-executable instructions, which, when read by a computer, cause one or more processors to execute the method according to the first aspect.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as ABEL (Advanced Boolean Expression Language), AHDL (alternate Hardware Description Language), traffic, CUPL (core universal Programming Language), HDCal, jhddl (Java Hardware Description Language), lava, lola, HDL, PALASM, rhyd (Hardware Description Language), and vhigh-Language (Hardware Description Language), which is currently used in most popular applications. It will also be apparent to those skilled in the art that hardware circuitry for implementing the logical method flows can be readily obtained by a mere need to program the method flows with some of the hardware description languages described above and into an integrated circuit.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be regarded as a hardware component and the means for performing the various functions included therein may also be regarded as structures within the hardware component. Or even means for performing the functions may be conceived to be both a software module implementing the method and a structure within a hardware component.
The systems, apparatuses, modules or units described in the above embodiments may be specifically implemented by a computer chip or an entity, or implemented by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, the present specification embodiments may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises that element.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
All the embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the apparatus, the device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is intended to represent one or more embodiments of the present disclosure, and should not be taken to be limiting of the present disclosure. Various modifications and alterations to one or more embodiments of the present description will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of one or more embodiments of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A method of debugging code that is executed based on interpretation, comprising:
receiving a debugging instruction containing an interrupt point position;
interpreting and executing a code to be executed corresponding to the debugging instruction;
and confirming whether the position of the code in the execution process is matched with the interrupt point position, interrupting the interpretation execution of the code to be executed when the position of the code is matched with the interrupt point position, acquiring the context information during interruption and sending the context information to a sender of the debugging instruction.
2. The method of claim 1, wherein interpreting executing the code to be executed comprises:
determining an abstract syntax tree corresponding to the code, wherein the abstract syntax tree comprises a plurality of nodes;
executing nodes of the abstract syntax tree by means of traversal interpretation;
correspondingly, determining whether the codes corresponding to the positions of the interruption points are matched includes: and confirming whether the node is matched with the position of the interrupt point or not for any node to be executed.
3. The method of claim 2, wherein the interrupt location is a row column number characterizing a code location;
correspondingly, confirming whether the node matches the breakpoint location includes:
acquiring row and column number information contained in the abstract syntax tree, and acquiring a row and column number corresponding to the node from the row and column number information;
and determining whether the row and column number corresponding to the node matches the row and column number of the characterization code position.
4. The method of claim 1, further comprising:
receiving a breakpoint releasing instruction sent by a sender of the debugging instruction;
and from the interruption point position, continuously executing the code to be executed according to the context information.
5. The method of claim 1, wherein the method further comprises:
determining an external code executor, wherein the external code executor executes external code based on the context information;
initiating a synchronization call to the external code executor based on the context information.
6. The method of claim 4, wherein initiating a synchronization call to the external code executor based on the context information comprises:
determining a browser adopted by the code to be executed;
and initiating synchronous call to the external code executing party through a standard function set interface of the browser.
7. The method of claim 2, wherein the traversable interpretation executes nodes of the abstract syntax tree, comprising:
starting from the root node of the abstract syntax tree, executing the nodes of the abstract syntax tree based on the ergodic interpretation of the preset specification.
8. The method of claim 1, wherein the code to be executed comprises applet code or hypertext markup language H5 code applied in a client; correspondingly, the sender of the debugging instruction comprises the server corresponding to the client.
9. A debugging apparatus for interpreting an executed code, comprising:
the receiving module receives a debugging instruction containing the position of the interrupt point;
the execution module is used for explaining and executing the code to be executed corresponding to the debugging instruction;
and the interruption module is used for confirming whether the position of the code in the execution process is matched with the interruption point position, interrupting the interpretation and execution of the code to be executed when the position of the code is matched with the interruption point position, acquiring the context information during interruption and sending the context information to the sender of the debugging instruction.
10. An electronic device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.
CN202210878244.4A 2022-07-25 2022-07-25 Debugging method, device and equipment of code based on interpretation execution Pending CN115269404A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210878244.4A CN115269404A (en) 2022-07-25 2022-07-25 Debugging method, device and equipment of code based on interpretation execution

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210878244.4A CN115269404A (en) 2022-07-25 2022-07-25 Debugging method, device and equipment of code based on interpretation execution

Publications (1)

Publication Number Publication Date
CN115269404A true CN115269404A (en) 2022-11-01

Family

ID=83769410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210878244.4A Pending CN115269404A (en) 2022-07-25 2022-07-25 Debugging method, device and equipment of code based on interpretation execution

Country Status (1)

Country Link
CN (1) CN115269404A (en)

Similar Documents

Publication Publication Date Title
US11494287B2 (en) Scalable execution tracing for large program codebases
US10621068B2 (en) Software code debugger for quick detection of error root causes
US8458681B1 (en) Method and system for optimizing the object code of a program
US7530056B1 (en) Method and system for detecting runtime defects in a program by comparing correct and incorrect runs
TWI684916B (en) Function selection method and server
CN107015841B (en) Preprocessing method for program compiling and program compiling device
WO2014035737A1 (en) Obtaining metadata set by imperative statement
KR20180018722A (en) Method and apparatus for generating, capturing, storing and loading debug information for failed test scripts
CN114547024A (en) SQL statement risk detection method, device, equipment and medium
US9117017B2 (en) Debugger with previous version feature
US20150106781A1 (en) Verification of uml state machines
CN114625660A (en) Debugging method and device
CN109284222B (en) Software unit, project testing method, device and equipment in data processing system
CN108319548A (en) A kind of program code adjustment method and device
CN113127329B (en) Script debugging method and device and computer storage medium
CN116610568A (en) Method, device, equipment and medium for identifying dependency relationship of codes
CN115269404A (en) Debugging method, device and equipment of code based on interpretation execution
CN115618363A (en) Vulnerability path mining method and related equipment
CN114840427A (en) Code testing and test case generating method and device
CN108733564B (en) Browser performance testing method, device and equipment
CN109308256B (en) Dynamic analysis method, equipment and storage medium for java program
CN107451050B (en) Function acquisition method and device and server
US10061604B2 (en) Program execution recording and playback
CN116432185B (en) Abnormality detection method and device, readable storage medium and electronic equipment
CN115391793B (en) Real-time vulnerability detection system and method based on FlowDroid tool and storage medium

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