CN111176986B - Thread script debugging method and device, computer equipment and storage medium - Google Patents

Thread script debugging method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111176986B
CN111176986B CN201911292192.7A CN201911292192A CN111176986B CN 111176986 B CN111176986 B CN 111176986B CN 201911292192 A CN201911292192 A CN 201911292192A CN 111176986 B CN111176986 B CN 111176986B
Authority
CN
China
Prior art keywords
thread
debugging
breakpoint
debug
position information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911292192.7A
Other languages
Chinese (zh)
Other versions
CN111176986A (en
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.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China 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 Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN201911292192.7A priority Critical patent/CN111176986B/en
Publication of CN111176986A publication Critical patent/CN111176986A/en
Application granted granted Critical
Publication of CN111176986B publication Critical patent/CN111176986B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake

Abstract

The application relates to a thread script debugging method, a thread script debugging device, computer equipment and a storage medium. The method comprises the following steps: when a service operation request is received, acquiring a debugging identifier corresponding to the service operation request; acquiring a corresponding first thread lock according to the debugging identification through the first debugging thread so as to enable the first debugging thread to enter a waiting state; when the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and business script codes are executed through the first debugging thread; and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, and the breakpoint position information is set through the second debugging thread. By adopting the scheme, the safety of thread script debugging can be improved.

Description

Thread script debugging method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of debugging technologies, and in particular, to a method and apparatus for debugging a thread script, a computer device, and a storage medium.
Background
Code development can be performed in a distributed environment, whether the developed code has errors or not can be checked, and thread debugging can be performed.
However, in the conventional thread debugging method, a debugging client performs thread script debugging and executes debugging by interrupting an interpretation executor through a script engine; in the debugging process, a plurality of service requests are generated, namely, the debugging period contains a plurality of requests, and the thread script debugging is disturbed by the mixed thread environment in the debugging process, so that the safety of the thread script debugging is reduced.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a thread script debugging method, apparatus, computer device, and storage medium that can improve thread script debugging security.
A method of thread script debugging, the method comprising:
when a service operation request is received, acquiring a debugging identifier corresponding to the service operation request;
acquiring a corresponding first thread lock through a first debugging thread according to the debugging identification so as to enable the first debugging thread to enter a waiting state;
when the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and
executing service script codes through the first debugging thread;
And when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, wherein the breakpoint position information is set through the second debugging thread.
In one embodiment, the breakpoint location information is stored in a memory, the memory including at least one breakpoint location information.
In one embodiment, the breakpoint location information is stored in a memory, the memory including at least one breakpoint location information.
In one embodiment, before the first debug thread wakes up from the wait state when the second debug thread passes a start command, the method further comprises:
acquiring a corresponding second thread lock by the second debugging thread according to the debugging identification so as to enable the second debugging thread to enter a waiting state;
when the second debugging thread receives a starting command, the second debugging thread is awakened from the waiting state, and a second thread lock corresponding to the second debugging thread is released.
In one embodiment, the execution result is put into a memory by the first debug thread, and after the execution result is obtained when the execution is performed to the code position corresponding to the breakpoint position information, the method further includes:
And sending the execution result to a terminal interface for rendering and displaying through the second debugging thread.
In one embodiment, after the execution result is sent to a terminal interface for rendering and displaying by the second debug thread, the method further includes:
acquiring a breakpoint adding instruction, wherein the breakpoint adding instruction carries breakpoint position information to be added;
executing the breakpoint adding instruction, and storing the breakpoint position information to be added in the memory.
In one embodiment, the method further comprises:
receiving an ending instruction;
and executing closing operation on the first debugging thread and the second debugging thread according to the ending instruction.
A thread script debugging apparatus, the apparatus comprising:
the first acquisition module is used for acquiring a debugging identifier corresponding to a service operation request when the service operation request is received;
the second acquisition module is used for acquiring a corresponding first thread lock through a first debugging thread according to the debugging identification so as to enable the first debugging thread to enter a waiting state;
the release module is used for waking up the first debugging thread from the waiting state when the second debugging thread transmits a start command, releasing a first thread lock corresponding to the first debugging thread and executing service script codes by the first debugging thread;
And the execution module is used for obtaining an execution result when executing the code position corresponding to the breakpoint position information, wherein the breakpoint position information is set by the second debugging thread.
In one embodiment, the apparatus further comprises:
the instruction adding module is used for obtaining a breakpoint adding instruction, wherein the breakpoint adding instruction carries breakpoint position information to be added; executing the breakpoint adding instruction, and storing the breakpoint position information to be added in the memory.
A computer device comprising a memory storing a computer program and a processor which when executing the computer program performs the steps of:
when a service operation request is received, acquiring a debugging identifier corresponding to the service operation request;
acquiring a corresponding first thread lock through a first debugging thread according to the debugging identification so as to enable the first debugging thread to enter a waiting state;
when the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and
executing service script codes through the first debugging thread;
And when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, wherein the breakpoint position information is set through the second debugging thread.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
when a service operation request is received, acquiring a debugging identifier corresponding to the service operation request;
acquiring a corresponding first thread lock through a first debugging thread according to the debugging identification so as to enable the first debugging thread to enter a waiting state;
when the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and
executing service script codes through the first debugging thread;
and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, wherein the breakpoint position information is set through the second debugging thread.
The thread script debugging method, the thread script debugging device, the computer equipment and the storage medium acquire a debugging identification corresponding to a service operation request when the service operation request is received; acquiring a corresponding first thread lock according to the debugging identification through the first debugging thread so as to enable the first debugging thread to enter a waiting state; when the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and business script codes are executed through the first debugging thread; and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, and the breakpoint position information is set through the second debugging thread. The first debugging thread enters a waiting state only after the first thread lock corresponding to the debugging identification is obtained, and a corresponding relation exists between the debugging identification and the first thread lock, and after the first debugging thread wakes up through the second debugging thread, service script codes are executed, namely, the execution result is obtained when the code positions corresponding to breakpoint position information are executed through coordination interaction between the first debugging thread and the second debugging thread, script debugging is completed, interference of threads corresponding to other service requests is avoided, and safety among thread script debugging is improved.
Drawings
FIG. 1 is an application environment diagram of a thread script debugging method in one embodiment;
FIG. 2 is a flow diagram of a thread script debugging method in one embodiment;
FIG. 3 is a schematic block diagram of thread script debugging in one embodiment;
FIG. 4 is a flow chart of a method of debugging a line script in another embodiment;
FIG. 5 is a block diagram of a thread script debugging apparatus in one embodiment;
FIG. 6 is a block diagram of a line script debugging device in another embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The thread script debugging method provided by the application can be applied to an application environment shown in figure 1. Wherein the terminal 102 communicates with the server 104 via a network. When receiving a service operation request from a terminal 102, a server 104 acquires a debugging identifier corresponding to the service operation request; acquiring a corresponding first thread lock through a first debugging thread according to the debugging identification so as to enable the first debugging thread to enter a waiting state; when a second debugging thread transmits a start command, waking up the first debugging thread from the waiting state, releasing a first thread lock corresponding to the first debugging thread, and executing business script codes through the first debugging thread; and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, wherein the breakpoint position information is set through the second debugging thread. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smartphones, and tablet computers, and the server 104 may be implemented by a stand-alone server or a server cluster formed by a plurality of servers.
It will be appreciated that the terms "first," "second," and the like, as used herein, may be used to describe various debug threads, but are not limited by these terms. These terms are only used to distinguish a first debug thread from another debug thread. For example, a first debug thread may be referred to as a second debug thread, and similarly, a second debug thread may be referred to as a first debug thread, without departing from the scope of the present application. The first debug thread and the second debug thread are both debug threads, but they are not the same debug thread.
In one embodiment, as shown in fig. 2, a method for debugging a thread script is provided, and the method is applied to the server 104 in fig. 1 for illustration, and includes the following steps:
step 202, when a service operation request is received, obtaining a debug identifier corresponding to the service operation request.
Wherein the service operation request is a request for acquiring service data, and the service operation request may be a test request. For example, a data table is newly built in the server, the accuracy of the data stored in the newly built data table is to be tested, and the terminal sends a test request for testing the accuracy of the data to the server. The terminal can initiate a plurality of service operation requests to the server at the same time, the debugging identification corresponding to each service operation request is different, and in one service operation process, each service operation request can have at least one request, and the debugging identification corresponding to each request is the same.
The debugging identification is used for identifying the request thread corresponding to the service operation request, different operation requests can correspond to different request threads, the debugging identification and the request thread have a corresponding relation, and the debugging identification is used for identifying the request thread corresponding to the current service operation request. For example, the debug identifier may be a series of numerical combinations or letter combinations, character strings of numerical letter combinations, or the like. For example, when the server receives the service operation request a, the debug flag 1 of the request Thread 1 corresponding to the service operation request a (Thread a) is acquired, and the debug flag 1 is "Thread a id=123456". The form of the debug flag is not limited herein.
Specifically, in a debug mode (debug), when a server receives a service operation request sent by a terminal, and when response information corresponding to the service operation request is preset response information, a request thread corresponding to the received service operation request is generated or invoked, a debug identifier of the request thread corresponding to the service operation request is obtained, and the service operation request is accessed to the corresponding debug thread through the request thread. The response information is a processing result obtained after the server processes the service operation request of the receiving terminal; the server can process the service operation request of the terminal through a response protocol; the received response information may be in the form of binary values, for example, the returned response message may be 0000 or 0001.
Step 204, obtaining, by the first debug thread, a corresponding first thread lock according to the debug identifier, so that the first debug thread enters a waiting state.
Where a thread lock is the right of a thread to access a shared resource. For example, ten threads need to access the same database, the database has a corresponding thread lock, one thread can access the database after acquiring the thread lock, and the other nine threads need to wait until the thread with the thread lock releases the lock and then acquire the thread lock to access the database.
The debug thread is a processing unit that processes debug tasks in sequence according to received debug instructions in a debug (debug) mode selected by a container. For example, when a test instruction that whether the database is successfully connected is received by the terminal, the terminal executes corresponding test codes, including detecting whether the connected database name is a target database name, whether the acquired login password is a preset login password, and the like. The container start needs to start a corresponding process, and a process may include a plurality of debug threads, for example, in a debug mode, the debug threads may include a first debug thread and a second debug thread, where the first debug thread may be used to obtain data in a script file, and the second debug thread may be used to execute a corresponding thread script, and the first debug thread and the second debug thread are not specifically limited herein. The container (Docker) is an open-source application engine container engine, and can release developed applications and dependent packages to a portable storage mirror image (registry) place to a terminal, wherein the container can select a debug mode and a non-debug mode in a distributed environment.
Specifically, selecting a debug mode in a container in the development process, and accessing a service operation request into a corresponding first debug thread through a request thread to obtain a debug identifier corresponding to the service operation request; and acquiring a corresponding first thread lock by the first debugging thread according to the debugging identification so as to enable the first debugging thread to enter a waiting state.
Step 206, when the second debug thread transmits the start command, the first debug thread is awakened from the waiting state, the first thread lock corresponding to the first debug thread is released, and the service script code is executed by the first debug thread.
The second debug thread is a debug thread corresponding to the first debug thread in the debug mode, and the debug identifier of the first debug thread is the same as the debug identifier corresponding to the second debug thread.
Specifically, in the debug mode, when a first debug thread acquires a corresponding first thread lock according to a debug identifier so that the first debug thread enters a waiting state, a debug request corresponding to a service operation request is triggered, the debug thread corresponding to the first debug thread is transferred to a second debug thread corresponding to the debug operation request, when the second debug thread transfers a start command, the first debug thread is awakened from the waiting state, the first thread lock corresponding to the first debug thread is released, and service script codes are executed through the first debug thread; wherein the start command may input a start control command through the end user interface. For example, the first debug thread is thread a, the second debug thread is thread B, when thread a obtains the corresponding first thread lock (lock), the state of waiting wait is entered, thread B obtains the debug identifier corresponding to thread a, when thread B executes the instruction start command, thread B injects a required callable to wake thread a from the waiting state into thread a, and releases the corresponding first thread lock of thread a.
And step 208, when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, and the breakpoint position information is set through the second debug thread.
Wherein, the breakpoint is the trace point of the program code, and the breakpoint position information is the specific position of the trace point in the program code. For example, to observe the values of variables or expressions on lines 10 and 30 of the code, break points are set on lines 10 and 30 of the code, respectively, i.e., lines 10 and 30 are break point location information. The code of one program may set a plurality of break points, that is, there may be a plurality of break point position information. Breakpoint location information may be added by clicking an ADD breakpoint button, double clicking a target breakpoint location, or by an ADD instruction. The breakpoint position information can acquire a judging position information setting instruction input by the debugging interface through the second debugging thread.
Specifically, when the second debugging thread transmits a start command, the first debugging thread is awakened from a waiting state, a first thread lock corresponding to the first debugging thread is released, a business script code is executed through the first debugging thread, the second debugging thread acquires the corresponding thread lock, and the second debugging thread enters the waiting state; when the first debugging thread executes to the code position corresponding to the breakpoint position information, an execution result is obtained, the execution result is put into a shared cache, the first debugging thread enters a waiting state, and the second debugging thread is awakened; wherein, the execution result may be current frame information. For example, the first debug Thread executes a run () method in the corresponding Thread class, obtains breakpoint position information of the service script code, executes the Thread script according to the breakpoint position information to obtain an execution result, and ends; when a plurality of breakpoint position information exists, an execution instruction, such as stepOver, can be acquired through the second debug thread, and the next line is continuously executed until the execution of the received breakpoint position information is finished or a termination instruction is finished after the execution of the received breakpoint position information is finished.
In the thread script debugging method, when a service operation request is received, a debugging identifier corresponding to the service operation request is acquired; acquiring a corresponding first thread lock according to the debugging identification through the first debugging thread so as to enable the first debugging thread to enter a waiting state; when the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and business script codes are executed through the first debugging thread; and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, and the breakpoint position information is set through the second debugging thread. The first debugging thread enters a waiting state only after the first thread lock corresponding to the debugging identification is obtained, and a corresponding relation exists between the debugging identification and the first thread lock, and after the first debugging thread wakes up through the second debugging thread, service script codes are executed, namely, the execution result is obtained when the code positions corresponding to breakpoint position information are executed through coordination interaction between the first debugging thread and the second debugging thread, script debugging is completed, interference of threads corresponding to other service requests is avoided, and the safety of thread script debugging is improved.
In one embodiment, the breakpoint location information is stored in a memory that includes at least one breakpoint location information.
The memory may be used to store programs and data, and may be a buffer memory, a register, or a main memory. By setting the breakpoint position information, the first debugging thread can hear the corresponding execution result obtained by executing the business script code corresponding to each breakpoint position information, and the thread debugging accuracy is improved.
In one embodiment, the execution result is put into the memory through the first debug thread, and after the execution result is obtained when the execution is performed to the code position corresponding to the breakpoint position information, the method further includes:
and sending the execution result to the terminal interface for rendering and displaying through the second debugging thread.
The execution result may be a numerical value of a function variable in the execution result or an actual value of a function expression in the execution result in the service script code. For example, the variables a=5, a+b=8.
Specifically, the second debugging thread is awakened, the execution result is read from the shared cache through the interactive interface, and the execution result is sent to the terminal interface for rendering and displaying; the interactive interface is a transmission medium for transmitting data, and the transmitted data can be breakpoint position information, an execution result of a return thread script, a called function method and the like. The execution result is rendered and displayed, so that the debugging result can be checked, and the accuracy of thread script debugging is improved.
In one embodiment, when a service operation request is received, obtaining a debug identifier corresponding to the service operation request; acquiring a corresponding first thread lock according to the debugging identification through the first debugging thread so that the first debugging thread is suspended to enter a waiting state; when the second debugging thread transmits a start command, the first debugging thread is awakened from a waiting state, the first debugging thread releases and releases a corresponding first thread lock, and after breakpoint position information is acquired from a memory through the first debugging thread, service script codes are executed; when the execution is performed to the code position corresponding to the breakpoint position information, an execution result is obtained, the execution result is sent to the terminal interface for rendering and displaying through the second debugging thread, the second debugging thread enters a waiting state and waits for receiving a next execution command, wherein the execution command can be instructions of resuming execution, executing the next row, tracking a function, designating the execution to the nth row, setting a breakpoint, checking an expression, stopping and the like.
In one embodiment, after sending the execution result to the terminal interface for rendering display by the second debug thread, the method further comprises:
acquiring a breakpoint adding instruction, wherein the breakpoint adding instruction carries breakpoint position information to be added; executing a breakpoint adding instruction, and storing breakpoint position information to be added in a memory.
Specifically, the breakpoint adding instruction is used for inputting the breakpoint position information adding instruction through the debugging interaction interface. When a breakpoint adding instruction input by a debugging interface is obtained, the breakpoint adding instruction is executed, the added breakpoint position information is stored in a memory, and the breakpoint position information is added through the breakpoint adding instruction, so that the debugging can be carried out aiming at abnormal errors in the debugging process, and the thread debugging efficiency is improved.
In one embodiment, as shown in FIG. 3, a thread script debugging schematic block diagram is provided, comprising a business operation request 302, a request thread 304, a first debug thread 306, a cache 308, a second debug thread 310, a debug request thread 312, and a debug command request 314.
After receiving the service operation request 302, the server request thread 304 acquires a corresponding debug identifier; accessing the business operation request 302 into a first debugging thread 306, wherein the first debugging thread 306 acquires a first thread lock corresponding to a debugging identification, and the first debugging thread 306 enters a waiting state; after receiving the service operation request 302, triggering a debugging request thread 312 of a debugging command request 314 corresponding to the service operation request 302, transmitting a debugging identification corresponding to the request thread 304 to the debugging request thread 312, waking up a first debugging thread 306 from a waiting state when a second debugging thread 310 transmits a starting command, releasing a first thread lock corresponding to the first debugging thread 306, reading debugged breakpoint position information from a cache 308 by the first debugging thread 306, executing service script codes through the first debugging thread 306, and obtaining an execution result when executing a code position corresponding to the breakpoint position information; and sending the execution result to a terminal interface for rendering and displaying through a second debugging thread, wherein the request thread 304 can simultaneously receive at least one service request operation, and the debugging request thread 312 can simultaneously receive at least one debugging request operation. Through coordination interaction between the first debugging thread 306 and the second debugging thread 310, script debugging is completed, interference of threads corresponding to other service operation requests is avoided, and isolation and safety of thread script debugging are improved.
In another embodiment, as shown in fig. 4, a method for debugging a thread script is provided, and the method is applied to the terminal 102 in fig. 1 for illustration, and includes the following steps:
step 402, when a service operation request is received, obtaining a debug identifier corresponding to the service operation request.
Step 404, obtaining, by the first debug thread, a corresponding first thread lock according to the debug identifier, so that the first debug thread enters a waiting state.
Step 406, obtaining, by the second debug thread, a corresponding second thread lock according to the debug identifier, so that the second debug thread enters a waiting state.
Step 408, when the second debug thread receives the start command, the second debug thread is awakened from the waiting state, and the second thread lock corresponding to the second debug thread is released.
Step 410, when the second debug thread transmits the start command, the first debug thread is awakened from the waiting state, the first thread lock corresponding to the first debug thread is released, and the service script code is executed by the first debug thread.
And step 412, when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, and the breakpoint position information is set through the second debug thread.
In the thread script debugging method, when a service operation request is received, a debugging identifier corresponding to the service operation request is obtained; acquiring a corresponding first thread lock according to the debugging identification through the first debugging thread so as to enable the first debugging thread to enter a waiting state; when the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and business script codes are executed through the first debugging thread; and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, and the breakpoint position information is set through the second debugging thread. The first debugging thread only enters a waiting state after acquiring a first thread lock corresponding to the debugging identification, and a corresponding relation exists between the debugging identification and the first thread lock, and the first debugging thread is awakened by the second debugging thread to execute business script codes, namely, the execution result is obtained when the first debugging thread and the second debugging thread need to execute the code positions corresponding to breakpoint position information through coordination interaction, so that script debugging is completed; breakpoint position information is transmitted between the second debugging thread and the first debugging thread through the interactive interface, the breakpoint position information is not required to be transmitted through a port, interference of other threads is avoided, and isolation and safety of thread script debugging are improved.
In one embodiment, the method further comprises:
receiving an ending instruction; and executing closing operation on the first debugging thread and the second debugging thread according to the ending instruction.
The ending instruction is used for ending the thread debugging. For example, the end instruction may be a stop instruction.
Specifically, after the second debugging thread end instruction is transmitted to the first debugging thread, breakpoint position information stored in the cache is removed; the first debugging thread shields breakpoint position information, after the business script code is executed, an execution result is obtained, the execution result is sent to a terminal interface for rendering and displaying through the second debugging thread, the first debugging thread and the second debugging thread are closed, interference of other threads is avoided, and accuracy of the execution result is affected.
In one embodiment, the first Debug Thread is Main-Debug-Thread and the second Debug Thread is CMD-Debug-Thread. In a debugging mode, when a request service thread of a server receives a service operation request, obtaining a debugging identification corresponding to the service operation request; accessing a service operation request into a Thread Main-Debug-Thread through a request service Thread, and acquiring a corresponding first Thread lock by the Thread Main-Debug-Thread according to a debugging identifier corresponding to the service operation request, and entering a waiting state; when a request service Thread of a server receives a debugging operation request corresponding to a business operation request, accessing the debugging operation request into a CMD-Debug-Thread through the request service Thread, acquiring a debugging identification corresponding to the business operation request and acquiring a second Thread lock corresponding to the debugging identification, and entering a waiting state; when the CMD-Debug-Thread executes starting operation, the CMD-Debug-Thread enters an awake state from a waiting state, the Main-Debug-Thread wakes up from the waiting state, a first Thread lock corresponding to the Main-Debug-Thread is released, the Main-Debug-Thread starts to execute business script codes, when the Main-Debug-Thread executes to a code position corresponding to breakpoint position information, an execution result is obtained, and the execution result is put into a cache; the Main-Debug-Thread enters a waiting state from a wake-up state, and the CMD-Debug-Thread acquires an execution result from the cache and sends the execution result to a terminal interface for rendering and displaying.
It should be understood that, although the steps in the flowcharts of fig. 2-4 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2-4 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the sub-steps or stages are performed necessarily occur sequentially, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or steps.
In one embodiment, as shown in FIG. 5, there is provided a thread script debugging apparatus 500 comprising: a first acquisition module 502, a second acquisition module 504, a lock release module 506, and an execution module 508, wherein:
the first obtaining module 502 is configured to obtain, when receiving a service operation request, a debug identifier corresponding to the service operation request.
The second obtaining module 504 is configured to obtain, by the first debug thread, a corresponding first thread lock according to the debug identifier, so that the first debug thread enters a waiting state.
In one embodiment, the second obtaining module 504 is further configured to obtain, by the second debug thread, a corresponding second thread lock according to the debug identifier, so that the second debug thread enters a waiting state.
And the releasing module 506 is configured to wake the first debug thread from the waiting state when the second debug thread transmits the start command, release the first thread lock corresponding to the first debug thread, and execute the service script code by the first debug thread.
In one embodiment, the releasing module 506 is further configured to wake up the second debug thread from the waiting state when the second debug thread receives the start command, and release a second thread lock corresponding to the second debug thread.
And the execution module 508 is configured to obtain an execution result when executing the code location corresponding to the breakpoint location information, where the breakpoint location information is set by the second debug thread.
In the thread script debugging device, when a service operation request is received, a debugging identifier corresponding to the service operation request is acquired; acquiring a corresponding first thread lock according to the debugging identification through the first debugging thread so as to enable the first debugging thread to enter a waiting state; when the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and business script codes are executed through the first debugging thread; and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained. The breakpoint position information is set through a second debugging thread, the first debugging thread enters a waiting state only after acquiring a first thread lock corresponding to a debugging identification, a corresponding relation exists between the debugging identification and the first thread lock, the first debugging thread is awakened through the second debugging thread and executes service script codes, namely, the execution result is obtained when the code position corresponding to the breakpoint position information is executed through coordination interaction between the first debugging thread and the second debugging thread, script debugging is completed, interference of threads corresponding to other service requests is avoided, and the interaction between threads does not need to expose a debugging port; isolation and security of thread script debugging are improved.
In another embodiment, as shown in fig. 6, a thread script debugging apparatus 500 is provided, which comprises, in addition to a first acquisition module 502, a second acquisition module 504, a lock release module 506, and an execution module 508, further comprises: instruction addition module 510, rendering module 512, and receiving module 514, wherein:
the instruction adding module 510 is configured to obtain a breakpoint adding instruction, where the breakpoint adding instruction carries breakpoint position information to be added; executing a breakpoint adding instruction, and storing breakpoint position information to be added in a memory.
Specifically, errors occurring in the debugging process are timely processed according to the newly added breakpoint position information by adding the corresponding breakpoints through the breakpoint adding instruction, and the thread debugging efficiency is improved.
And the rendering module 512 is configured to send the execution result to the terminal interface for rendering and displaying through the second debug thread.
A receiving module 514, configured to receive an end instruction; and executing closing operation on the first debugging thread and the second debugging thread according to the ending instruction.
The specific limitation of the thread script debugging device can be referred to the limitation of the thread script debugging method hereinabove, and will not be repeated here. The various modules in the thread script debugging device described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a thread script debugging method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
when a service operation request is received, acquiring a debugging identifier corresponding to the service operation request;
acquiring a corresponding first thread lock according to the debugging identification through the first debugging thread so as to enable the first debugging thread to enter a waiting state;
when the second debugging thread transmits the start command, the first debugging thread is awakened from the waiting state, the first thread lock corresponding to the first debugging thread is released, and
executing service script codes through a first debugging thread;
and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, and the breakpoint position information is set through the second debugging thread.
In one embodiment, the processor when executing the computer program also implements the following:
the breakpoint location information is stored in a memory that includes at least one breakpoint location information.
In one embodiment, the processor when executing the computer program further performs the steps of:
before waking the first debug thread from the wait state when the second debug thread passes the start command, the method further comprises:
acquiring a corresponding second thread lock through a second debugging thread according to the debugging identification so as to enable the second debugging thread to enter a waiting state;
when the second debugging thread receives the starting command, the second debugging thread is awakened from the waiting state, and a second thread lock corresponding to the second debugging thread is released.
In one embodiment, the processor when executing the computer program further performs the steps of:
the execution result is put into a memory through a first debugging thread, and after the execution result is obtained when the execution is performed to the code position corresponding to the breakpoint position information, the method further comprises:
and sending the execution result to the terminal interface for rendering and displaying through the second debugging thread.
In one embodiment, the processor when executing the computer program further performs the steps of:
After sending the execution result to the terminal interface for rendering display through the second debugging thread, the method further comprises the following steps:
acquiring a breakpoint adding instruction, wherein the breakpoint adding instruction carries breakpoint position information to be added;
executing a breakpoint adding instruction, and storing breakpoint position information to be added in a memory.
In one embodiment, the processor when executing the computer program further performs the steps of:
receiving an ending instruction;
and executing closing operation on the first debugging thread and the second debugging thread according to the ending instruction.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
when a service operation request is received, acquiring a debugging identifier corresponding to the service operation request;
acquiring a corresponding first thread lock according to the debugging identification through the first debugging thread so as to enable the first debugging thread to enter a waiting state;
when the second debugging thread transmits the start command, the first debugging thread is awakened from the waiting state, the first thread lock corresponding to the first debugging thread is released, and
executing service script codes through a first debugging thread;
And when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, and the breakpoint position information is set through the second debugging thread.
In one embodiment, the computer program when executed by the processor further implements the following:
the breakpoint location information is stored in a memory that includes at least one breakpoint location information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
before waking the first debug thread from the wait state when the second debug thread passes the start command, the method further comprises:
acquiring a corresponding second thread lock through a second debugging thread according to the debugging identification so as to enable the second debugging thread to enter a waiting state;
when the second debugging thread receives the starting command, the second debugging thread is awakened from the waiting state, and a second thread lock corresponding to the second debugging thread is released.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the execution result is put into a memory through a first debugging thread, and after the execution result is obtained when the execution is performed to the code position corresponding to the breakpoint position information, the method further comprises:
And sending the execution result to the terminal interface for rendering and displaying through the second debugging thread.
In one embodiment, the computer program when executed by the processor further performs the steps of:
after sending the execution result to the terminal interface for rendering display through the second debugging thread, the method further comprises the following steps:
acquiring a breakpoint adding instruction, wherein the breakpoint adding instruction carries breakpoint position information to be added;
executing a breakpoint adding instruction, and storing breakpoint position information to be added in a memory.
In one embodiment, the computer program when executed by the processor further performs the steps of:
receiving an ending instruction;
and executing closing operation on the first debugging thread and the second debugging thread according to the ending instruction.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A method of thread script debugging, the method comprising:
when a service operation request is received, acquiring a debugging identifier corresponding to the service operation request;
acquiring a corresponding first thread lock through a first debugging thread according to the debugging identification, triggering a debugging request corresponding to the service operation request when the first debugging thread enters a waiting state, and transmitting the debugging thread corresponding to the first debugging thread to a second debugging thread corresponding to the debugging request;
When the second debugging thread transmits a start command, the first debugging thread is awakened from the waiting state, a first thread lock corresponding to the first debugging thread is released, and
executing service script codes through the first debugging thread;
and when the code position corresponding to the breakpoint position information is executed, an execution result is obtained, wherein the breakpoint position information is set through the second debugging thread.
2. The method of claim 1, wherein the breakpoint location information is stored in a memory, the memory including at least one breakpoint location information.
3. The method of claim 1, wherein prior to waking the first debug thread from the wait state when the second debug thread passes a start command, the method further comprises:
acquiring a corresponding second thread lock by the second debugging thread according to the debugging identification so as to enable the second debugging thread to enter a waiting state;
when the second debugging thread receives a starting command, the second debugging thread is awakened from the waiting state, and a second thread lock corresponding to the second debugging thread is released.
4. The method of claim 1, wherein the execution result is placed into a memory by the first debug thread, and after the execution result is obtained when executing to the code location corresponding to the breakpoint location information, the method further comprises:
and sending the execution result to a terminal interface for rendering and displaying through the second debugging thread.
5. The method of claim 4, wherein after the sending, by the second debug thread, the execution result to a terminal interface for rendering display, the method further comprises:
acquiring a breakpoint adding instruction, wherein the breakpoint adding instruction carries breakpoint position information to be added;
executing the breakpoint adding instruction, and storing the breakpoint position information to be added in the memory.
6. The method according to claim 1, wherein the method further comprises:
receiving an ending instruction;
and executing closing operation on the first debugging thread and the second debugging thread according to the ending instruction.
7. A thread script debugging apparatus, the apparatus comprising:
the first acquisition module is used for acquiring a debugging identifier corresponding to a service operation request when the service operation request is received;
The second acquisition module is used for acquiring a corresponding first thread lock through a first debugging thread according to the debugging identification, triggering a debugging request corresponding to the service operation request when the first debugging thread enters a waiting state, and transmitting the debugging thread corresponding to the first debugging thread to a second debugging thread corresponding to the debugging request;
the release module is used for waking up the first debugging thread from the waiting state when the second debugging thread transmits a start command, releasing a first thread lock corresponding to the first debugging thread and executing service script codes by the first debugging thread;
and the execution module is used for obtaining an execution result when executing the code position corresponding to the breakpoint position information, wherein the breakpoint position information is set by the second debugging thread.
8. The apparatus of claim 7, wherein the apparatus further comprises:
the instruction adding module is used for obtaining a breakpoint adding instruction, wherein the breakpoint adding instruction carries breakpoint position information to be added; executing the breakpoint adding instruction, and storing the breakpoint position information to be added in a memory.
9. A computer device comprising a memory and a processor, the memory having stored therein a computer program, characterized in that the processor, when executing the computer program, carries out the steps of the method according to any one of claims 1 to 6.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN201911292192.7A 2019-12-16 2019-12-16 Thread script debugging method and device, computer equipment and storage medium Active CN111176986B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911292192.7A CN111176986B (en) 2019-12-16 2019-12-16 Thread script debugging method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911292192.7A CN111176986B (en) 2019-12-16 2019-12-16 Thread script debugging method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111176986A CN111176986A (en) 2020-05-19
CN111176986B true CN111176986B (en) 2023-12-29

Family

ID=70650227

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911292192.7A Active CN111176986B (en) 2019-12-16 2019-12-16 Thread script debugging method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111176986B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4027246B1 (en) * 2020-11-16 2023-12-06 Baidu Online Network Technology (Beijing) Co., Ltd. Method and apparatus for debugging applet, electronic device and storage medium
CN113342654B (en) * 2021-06-08 2024-04-09 广州博冠信息科技有限公司 Script language code debugging method and device, readable storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9405658B1 (en) * 2008-05-27 2016-08-02 Oracle America, Inc. Method and apparatus for debugging applications in development environments
CN106254436A (en) * 2016-07-28 2016-12-21 腾讯科技(深圳)有限公司 A kind of method of remote debugging, relevant device and system
CN107948317A (en) * 2017-12-26 2018-04-20 金蝶软件(中国)有限公司 Adjustment method, device, storage medium and the computer equipment of Distributed Services
CN109783342A (en) * 2017-11-10 2019-05-21 华为技术有限公司 Script debugging method, equipment and computer storage medium
CN110032512A (en) * 2019-03-28 2019-07-19 腾讯科技(深圳)有限公司 A kind of adjustment method of small routine, relevant device and terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
ITTO20120851A1 (en) * 2012-09-28 2014-03-29 St Microelectronics Grenoble 2 DEBUG SYSTEM, AND ITS INTEGRATED CIRCUIT AND PROCEDURE

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9405658B1 (en) * 2008-05-27 2016-08-02 Oracle America, Inc. Method and apparatus for debugging applications in development environments
CN106254436A (en) * 2016-07-28 2016-12-21 腾讯科技(深圳)有限公司 A kind of method of remote debugging, relevant device and system
CN109783342A (en) * 2017-11-10 2019-05-21 华为技术有限公司 Script debugging method, equipment and computer storage medium
CN107948317A (en) * 2017-12-26 2018-04-20 金蝶软件(中国)有限公司 Adjustment method, device, storage medium and the computer equipment of Distributed Services
CN110032512A (en) * 2019-03-28 2019-07-19 腾讯科技(深圳)有限公司 A kind of adjustment method of small routine, relevant device and terminal

Also Published As

Publication number Publication date
CN111176986A (en) 2020-05-19

Similar Documents

Publication Publication Date Title
US20220050769A1 (en) Program testing method and apparatus, computer device, and storage medium
WO2019227708A1 (en) Online debugging apparatus and method for test case, and computer-readable storage medium
CN111176986B (en) Thread script debugging method and device, computer equipment and storage medium
CN110162453B (en) Test method, test device, computer readable storage medium and computer equipment
CN110888709A (en) Intelligent operation method and device of monitoring screen, computer equipment and storage medium
CN111475390A (en) Log collection system deployment method, device, equipment and storage medium
CN111414309B (en) Automatic test method of application program, computer equipment and storage medium
CN111782505A (en) Train system simulation test method and device, computer equipment and storage medium
CN113505895B (en) Machine learning engine service system, model training method and configuration method
CN110232018A (en) Interface test method, device, computer equipment
CN112989740B (en) Simulation method and device, computer equipment and storage medium
CN113220566A (en) Interface performance test script generation method and device and computer equipment
CN103838651A (en) Mainboard function test management and control system and method
KR101689984B1 (en) Programmable controller, programmable controller system, and execute error information creation method
CN112650674A (en) Method for remotely acquiring and debugging webpage log, computer equipment and storage medium
CN113220584A (en) Page testing method and device, computer equipment and readable storage medium
CN112817831A (en) Application performance monitoring method, device, computer system and readable storage medium
CN115656788B (en) Chip testing system, method, equipment and storage medium
CN116431731A (en) Data asynchronous export method, device, equipment and storage medium thereof
CN112631949B (en) Debugging method and device, computer equipment and storage medium
CN113868127A (en) Online debugging method and device, computer equipment and storage medium
CN111414525B (en) Method, device, computer equipment and storage medium for acquiring data of applet
CN111045891B (en) Monitoring method, device, equipment and storage medium based on java multithreading
CN113722225A (en) Page testing method and device, computer equipment and storage medium
CN114968751A (en) Program debugging method and program debugging device of code-free development platform

Legal Events

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