WO2020134634A1 - 程序调试方法、程序调试装置、终端设备及存储介质 - Google Patents

程序调试方法、程序调试装置、终端设备及存储介质 Download PDF

Info

Publication number
WO2020134634A1
WO2020134634A1 PCT/CN2019/116297 CN2019116297W WO2020134634A1 WO 2020134634 A1 WO2020134634 A1 WO 2020134634A1 CN 2019116297 W CN2019116297 W CN 2019116297W WO 2020134634 A1 WO2020134634 A1 WO 2020134634A1
Authority
WO
WIPO (PCT)
Prior art keywords
preset
debugging
instruction
program
operation instruction
Prior art date
Application number
PCT/CN2019/116297
Other languages
English (en)
French (fr)
Inventor
刘小强
朱剑虹
张方方
洪斌
Original Assignee
百富计算机技术(深圳)有限公司
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 百富计算机技术(深圳)有限公司 filed Critical 百富计算机技术(深圳)有限公司
Publication of WO2020134634A1 publication Critical patent/WO2020134634A1/zh

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

Definitions

  • This application relates to the technical field of software testing, and in particular, to a program debugging method, a program debugging device, a terminal device, and a storage medium.
  • WML Wi-Fi Markup Language
  • WMLS Wielss Mark Languane Script, wireless markup language script
  • the embodiments of the present application provide a program debugging method, a program debugging device, a terminal device, and a storage medium, to solve the problem of low program debugging efficiency in the prior art.
  • the first aspect of the embodiments of the present application provides a program debugging method, including:
  • the operation instruction is suspended, and monitoring is received whether the debug instruction sent by the preset debugger is received;
  • the debugging instruction is executed, and the debugging instruction is used to obtain a first debugging result
  • the abnormal result is reported to the preset debugger as a second debugging result.
  • a second aspect of an embodiment of the present application provides a program debugging device, including:
  • the judging unit is used to judge whether the preset pause condition is satisfied before running each operation instruction in the program to be debugged;
  • the monitoring unit is configured to suspend running the operation instruction if the preset suspension condition is met, and monitor whether the debugging instruction sent by the preset debugger is received;
  • An execution unit configured to execute the debugging instruction if receiving a debugging instruction sent by a preset debugger, and the debugging instruction is used to obtain a first debugging result
  • An operation unit configured to execute the operation instruction after executing the debugging instruction, and monitor whether an abnormal result is generated during the operation of the operation instruction
  • the reporting unit is configured to report the abnormal result as a second debugging result to the preset debugger if it is detected that an abnormal result is generated during the operation of the operation instruction.
  • a third aspect of the embodiments of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, when the processor executes the computer program
  • the steps of the method provided in the first aspect of the embodiments of the present application are implemented.
  • a fourth aspect of the embodiments of the present application provides a computer-readable storage medium that stores a computer program that is executed by one or more processors to implement the first embodiment of the present application Aspects provide the steps of the method.
  • the embodiment of the present application determines whether it is necessary to suspend the operation of the current operation instruction before running each operation instruction of the program to be debugged, to determine whether it is necessary to suspend the operation of the current operation instruction;
  • the device maintains remote communication and monitors the debugging instructions of the preset debugger.
  • FIG. 1 is a schematic diagram of an implementation process of a program debugging method provided by an embodiment of the present application
  • FIG. 2 is a flowchart of a method for executing a debugging instruction provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of a program debugging device provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a terminal device provided by an embodiment of the present application.
  • the term “if” may be interpreted as “when” or “once” or “in response to determination” or “in response to detection” depending on the context .
  • the phrase “if determined” or “if [described condition or event] is detected” may be interpreted in the context to mean “once determined” or “in response to a determination” or “once detected [described condition or event ]” or “In response to detection of [the described condition or event]”.
  • an application scenario of the present application is introduced first.
  • Integrated There is a debugger on the Development Environment (IDE) which encapsulates the debugging instructions in the debugger, and sends the debugging instructions to the wireless markup language script (Wireless Mark Language Script (WMLS) WMLS script parser, the WMLS script parser executes the debugging instruction after receiving the debugging instruction, and returns the debugging result to the IDE's debugger.
  • IDE integrated development environment
  • WMLS Wireless Mark Language Script
  • FIG. 1 is a schematic diagram of an implementation process of a program debugging method provided by an embodiment of the present application. As shown in the figure, the method may include the following steps:
  • Step S101 Before running each operation instruction in the program to be debugged, determine whether the preset pause condition is satisfied.
  • determining whether the preset pause condition is satisfied includes:
  • the preset flag bit is used to indicate that the operation instruction at the code position corresponding to the preset flag bit is suspended.
  • the debugger in the IDE sets a breakpoint during the running of the program to be debugged. Specifically, during the running of the program to be debugged, the script parser obtains the debugger through remote communication with the debugger Pre-set breakpoint information. Therefore, the program to be debugged needs to be started first so that the communication process can start to work. However, the breakpoint in the initial running stage of the program to be debugged may be ignored, then a flag bit needs to be set at the initial position of the program to be debugged (the flag bit indicates that a pause is required). While the program to be debugged is paused at the initial position, the IDE sends all pre-set breakpoint information to the script parser. After all the breakpoint information is sent, the IDE sends a command to complete the initialization, and the script parser starts to run the program to be debugged. And clear the flag bit.
  • the nth operation instruction Before running the nth operation instruction, first determine whether the preset suspension condition is met. If the preset suspension is met, the nth operation instruction is suspended. If the preset suspension condition is not met, the nth operation instruction is directly run. Operation instructions.
  • the judging whether the preset pause condition is satisfied may be judging whether the breakpoint has been set, and specifically includes the following steps:
  • the preset database includes all the breakpoints in the program to be debugged Code location.
  • the user can set a breakpoint during the running of the program to be debugged through the preset debugger.
  • the communication process of the script parser will add new breakpoint information (that is, the breakpoint is in the Add the code location in the program to be debugged to the preset database (the preset database can be the storage space in the script parser or a third-party storage space), or delete the existing breakpoint information in the preset database.
  • the running process of the script parser matches the code position of the current operation instruction with the breakpoint information in the current preset database before running each operation instruction of the program, if there is a code in the preset database that matches the current operation instruction
  • the position-matching breakpoint information indicates that the current operation instruction code position is the breakpoint position, that is, the pause condition is satisfied.
  • the establishing a remote communication connection with the preset debugger includes:
  • the user may also send an interrupt command at any time, and the judgment whether the preset pause condition is met may be an interrupt command sent by the user, which specifically includes the following steps:
  • nth operation instruction when the nth operation instruction is executed and the user's interruption command is not received, it means that the user has not sent the interruption command, and then directly runs the n+1th operation instruction; if the user's interruption command is received, it means that the user has sent If the command is interrupted, the n+1th operation instruction will be suspended.
  • step S102 if the preset pause condition is satisfied, the operation instruction is suspended, and it is monitored whether the debug instruction sent by the preset debugger is received.
  • the communication process of the script parser is responsible for communicating with the preset debugger and monitoring the debugging instructions sent by the debugger; the running process of the script parser is responsible for running the program to be debugged and debugging work.
  • the communication process and the running process work in parallel, so that you can use the IDE debugger to set the breakpoint of the debug program at any time, and send the breakpoint setting information to the script parser through communication.
  • the running process of the script parser can also be updated according to the latest The breakpoint setting scheme performs interrupt processing on the program to be debugged. The two threads work independently without affecting each other.
  • IDE debugger and script parser to communicate the breakpoint information, you can implement remote debugging or cross-platform debugging.
  • users can set breakpoint information on the IDE debugger without writing debugging code directly in the program to be debugged, which simplifies the debugging process and improves debugging efficiency.
  • Step S103 If a debugging instruction sent by a preset debugger is received, the debugging instruction is executed, and the debugging instruction is used to obtain a first debugging result.
  • the debugging instruction is not limited to the running instruction, the query instruction and the jump-in and jump-out instruction, and the debugging instruction may also include other instructions.
  • the first debugging result is a result corresponding to the debugging instruction.
  • the first debugging result may be a certain value, a certain data or information, or a certain execution action.
  • the first debugging result is a running operation instruction
  • the first debugging result is the variable value of the queried operation instruction
  • the debugging instruction is a single-step jump instruction
  • the first debugging result is the calculated position of the next breakpoint.
  • FIG. 2 is a flowchart of a method for executing a debugging instruction provided by an embodiment of the present application. As shown in the figure, executing the debugging instruction includes:
  • Step S201 if the debugging instruction is a single-step operation instruction, the operation instruction is executed.
  • Step S202 if the debugging instruction is a query instruction, query the variable value in the operation instruction, and monitor the next debugging instruction.
  • variable value in the operation instruction is set to the expected value.
  • the preset result refers to the result when the program to be debugged runs normally to the current position.
  • Step S203 if the debugging instruction is a single-step jump-in instruction or a single-step jump-out instruction, the code position of the next breakpoint is calculated, and the code position is stored in the preset database.
  • the execution of the debugging instruction is to observe whether the running state of the program meets expectations at a certain position of the program to be debugged. Therefore, the first debugging instruction may also be the running state of the current program.
  • Step S104 After executing the debugging instruction, run the operation instruction, and monitor whether an abnormal result is generated during the operation of the operation instruction.
  • the method further includes:
  • a mark is made at the code position, and the mark is used to indicate that the operation instruction at the code position has been suspended for execution.
  • Step S105 If it is detected that an abnormal result is generated during the operation of the operation instruction, the abnormal result is reported to the preset debugger as a second debugging result.
  • step S101 is repeated, that is, debugging the next operation instruction is continued.
  • the work of reporting abnormal results can be performed by the communication process of the script parser.
  • the embodiment of the present application determines whether it is necessary to suspend the operation of the current operation instruction by running each operation instruction of the program to be debugged before running each operation instruction of the program to be debugged; Maintain communication and monitor the debugging instructions of the preset debugger.
  • This method saves the tediousness of writing the debugging code into the program to be debugged in advance, but directly debugs the program according to the debugging instructions of the preset debugger through remote communication. , More efficient and more flexible; after executing the debugging instruction, continue to run the operation instruction and catch the exception. When the abnormal result is caught, report the abnormal result to the preset debugger, so that the preset debugger can understand the program in time Operational status. Through the above method, the efficiency of program debugging is effectively improved.
  • FIG. 3 is a schematic diagram of a program debugging device provided by an embodiment of the present application. For convenience of description, only parts related to the embodiment of the present application are shown.
  • the program debugging device shown in FIG. 3 may be a software unit, a hardware unit, or a combination of software and hardware built into an existing terminal device, or may be integrated into the terminal device as an independent pendant, or may be used as an independent Of terminal devices exist.
  • the program debugging device 3 includes:
  • the judging unit 31 is used to judge whether the preset pause condition is satisfied before running each operation instruction in the program to be debugged;
  • the monitoring unit 32 is configured to suspend running the operation instruction if the preset suspension condition is met, and monitor whether a debugging instruction sent by a preset debugger is received;
  • the execution unit 33 is configured to execute the debugging instruction if receiving a debugging instruction sent by a preset debugger, and the debugging instruction is used to obtain a first debugging result;
  • the running unit 34 is configured to run the operation instruction after executing the debugging instruction, and monitor whether abnormal results are generated during the operation of the operation instruction;
  • the reporting unit 35 is configured to report the abnormal result as a second debugging result to the preset debugger if it is detected that an abnormal result is generated during the operation of the operation instruction.
  • the judgment unit 31 includes:
  • the detection module is used to detect whether an interrupt command is received after running the last operation instruction.
  • the first determination module is used to determine that the preset pause condition is met if an interrupt command is received after running the last operation instruction.
  • the judgment unit 31 further includes:
  • the obtaining module is used to obtain the code position of the current operation instruction in the program to be debugged, and determine whether there is preset breakpoint information matching the code position in the preset database.
  • the second determination module is configured to determine that the preset pause condition is satisfied if preset breakpoint information matching the code position exists in the preset database.
  • the judgment unit 31 further includes:
  • the judgment module is used to judge whether there is a preset flag before running the first operation instruction in the program to be debugged, the preset flag is used to indicate that the code position corresponding to the preset flag is suspended Operating instructions.
  • the pause module is used to pause running the first operation instruction in the program to be debugged if there is a preset flag, establish a remote communication connection with the preset debugger, and receive a message sent by the preset debugger Preset breakpoint information.
  • the storage module is configured to store the preset breakpoint information in a preset database after receiving all the preset breakpoint information.
  • the clearing module is used to clear the preset flag and determine whether the preset pause condition is met.
  • the pause module includes:
  • the establishment sub-module has a remote communication connection established with the preset debugger based on the transmission control protocol.
  • the execution unit 33 includes:
  • the operation module is configured to execute the operation instruction if the debugging instruction is a single-step operation instruction.
  • the query module is used to query the variable value in the operation instruction and monitor the next debugging instruction if the debugging instruction is a query instruction.
  • the calculation module is used to calculate the code position of the next breakpoint and store the code position in the preset database if the debugging instruction is a step-in instruction or step-out instruction.
  • the device 3 further includes:
  • the deleting unit is configured to delete the preset breakpoint position corresponding to the code position from the preset database after executing the debugging instruction.
  • each functional unit and module is used as an example for illustration.
  • the above-mentioned functions may be allocated by different functional units
  • Module completion means that the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
  • the functional units and modules in the embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above integrated unit may use hardware It can also be implemented in the form of software functional units.
  • the specific names of each functional unit and module are only for the purpose of distinguishing each other, and are not used to limit the protection scope of the present application.
  • the terminal device 4 of this embodiment includes: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40.
  • the steps in the above embodiments of the program debugging method are implemented, for example, steps S101 to S105 shown in FIG. 1.
  • the processor 40 executes the computer program 42 the functions of the modules/units in the foregoing device embodiments are realized, for example, the functions of the modules 31 to 35 shown in FIG. 3.
  • the computer program 42 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 41 and executed by the processor 40 to complete This application.
  • the one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 42 in the terminal device 4.
  • the computer program 42 may be divided into a judgment unit, a monitoring unit, an execution unit, an operation unit, and a reporting unit.
  • the specific functions of each unit are as follows:
  • the judging unit is used to judge whether the preset pause condition is satisfied before running each operation instruction in the program to be debugged;
  • the monitoring unit is configured to suspend running the operation instruction if the preset suspension condition is met, and monitor whether the debugging instruction sent by the preset debugger is received;
  • An execution unit configured to execute the debugging instruction if receiving a debugging instruction sent by a preset debugger, and the debugging instruction is used to obtain a first debugging result
  • An operation unit configured to execute the operation instruction after executing the debugging instruction, and monitor whether abnormal results are generated during the operation of the operation instruction;
  • the reporting unit is configured to report the abnormal result as a second debugging result to the preset debugger if it is detected that an abnormal result is generated during the operation of the operation instruction.
  • the judgment unit includes:
  • the detection module is used to detect whether an interrupt command is received after running the last operation instruction.
  • the first determination module is used to determine that the preset pause condition is met if an interrupt command is received after running the last operation instruction.
  • the judgment unit further includes:
  • the obtaining module is used to obtain the code position of the current operation instruction in the program to be debugged, and determine whether there is preset breakpoint information matching the code position in the preset database.
  • the second determination module is configured to determine that the preset pause condition is satisfied if preset breakpoint information matching the code position exists in the preset database.
  • the judgment unit further includes:
  • the judgment module is used to judge whether there is a preset flag before running the first operation instruction in the program to be debugged, the preset flag is used to indicate that the code position corresponding to the preset flag is suspended Operating instructions.
  • the pause module is used to pause running the first operation instruction in the program to be debugged if there is a preset flag, establish a remote communication connection with the preset debugger, and receive a message sent by the preset debugger Preset breakpoint information.
  • the storage module is configured to store the preset breakpoint information in a preset database after receiving all the preset breakpoint information.
  • the clearing module is used to clear the preset flag and determine whether the preset pause condition is met.
  • the pause module includes:
  • the establishment sub-module has a remote communication connection established with the preset debugger based on the transmission control protocol.
  • the execution unit includes:
  • the operation module is configured to execute the operation instruction if the debugging instruction is a single-step operation instruction.
  • the query module is used to query the variable value in the operation instruction and monitor the next debugging instruction if the debugging instruction is a query instruction.
  • the calculation module is used to calculate the code position of the next breakpoint and store the code position in the preset database if the debugging instruction is a step-in instruction or step-out instruction.
  • the computer program further includes:
  • the deleting unit is configured to delete the preset breakpoint position corresponding to the code position from the preset database after executing the debugging instruction.
  • the terminal device 4 may be a computing device such as a desktop computer, a notebook, a palmtop computer and a cloud server.
  • the terminal device may include, but is not limited to, the processor 40 and the memory 41.
  • FIG. 4 is only an example of the terminal device 4 and does not constitute a limitation on the terminal device 4, and may include more or less components than the illustration, or a combination of certain components or different components.
  • the terminal device may further include an input and output device, a network access device, a bus, and the like.
  • the so-called processor 40 may be a central processing unit (Central Processing Unit (CPU), can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application-specific integrated circuits (Application Specific Integrated Circuit (ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 41 may be an internal storage unit of the terminal device 4, such as a hard disk or a memory of the terminal device 4.
  • the memory 41 may also be an external storage device of the terminal device 4, such as a plug-in hard disk equipped on the terminal device 4, a smart memory card (Smart Media Card, SMC), and secure digital (SD) Flash card Card) etc. Further, the memory 41 may also include both an internal storage unit of the terminal device 4 and an external storage device.
  • the memory 41 is used to store the computer program and other programs and data required by the terminal device.
  • the memory 41 can also be used to temporarily store data that has been or will be output.
  • the disclosed device/terminal device and method may be implemented in other ways.
  • the device/terminal device embodiments described above are only schematic.
  • the division of the module or unit is only a logical function division, and in actual implementation, there may be another division manner, such as multiple units Or components can be combined or integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or software function unit.
  • the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the present application can implement all or part of the processes in the methods of the above embodiments, or it can be completed by a computer program instructing related hardware.
  • the computer program can be stored in a computer-readable storage medium. When the program is executed by the processor, the steps of the foregoing method embodiments may be implemented.
  • the computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file, or some intermediate form, etc.
  • the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals and software distribution media, etc.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • electrical carrier signals telecommunications signals and software distribution media, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

一种程序调试方法、程序调试装置、终端设备及存储介质,适用于软件测试技术领域,所述方法包括:在运行待调试程序的每一条操作指令之前,判断是否满足预设的暂停条件(S101);若满足预设的暂停条件,则暂停运行所述操作指令,并监测是否接收到预设调试器发送的调试指令(S102);若接收到预设调试器发送的调试指令,则执行所述调试指令,所述调试指令用于获得第一调试结果(S103);在执行所述调试指令之后,运行所述操作指令,并监测运行所述操作指令的过程中是否产生异常结果(S104);若监测到运行所述操作指令的过程中产生异常结果,则将所述异常结果作为第二调试结果上报给所述预设调试器(S105)。通过上述方法,能够有效提高程序的调试效率。

Description

程序调试方法、程序调试装置、终端设备及存储介质 技术领域
本申请涉及软件测试技术领域,尤其涉及一种程序调试方法、程序调试装置、终端设备及存储介质。
背景技术
随着移动互联网时代的来临,越来越多的用户通过移动终端进行网页访问。传统的网页访问技术采用HTML(Hypertext Markup Language,超文本标记语言)。由于无线网络系统和固定网络系统不同,所以移动终端的网页访问技术通常采用WML(Wirelss Mark Languane,无线标记语言),相应的,利用WMLS(Wirelss Mark Languane Script,无线标记语言脚本)来增加WML页面的交互行为。
现有技术中,开发人员对WMLS程序的调试,通常是通过打印日志的方式来跟踪代码。这样的调试方法需要针对每一行日志输入相应的调试代码,且需要不断地修改代码并重新编译。因此,目前的基于WMLS的程序调试方法效率较低。
技术问题
有鉴于此,本申请实施例提供了一种程序调试方法、程序调试装置、终端设备及存储介质,以解决现有技术中程序的调试效率较低的问题。
技术解决方案
本申请实施例的第一方面提供了一种程序调试方法,包括:
在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件;
若满足预设的暂停条件,则暂停运行所述操作指令,并监测是否接收到预设调试器发送的调试指令;
若接收到预设调试器发送的调试指令,则执行所述调试指令,所述调试指令用于获得第一调试结果;
在执行所述调试指令之后,运行所述操作指令,并监测运行所述操作指令的过程中是否产生异常结果;
若监测到运行所述操作指令的过程中产生异常结果,则将所述异常结果作为第二调试结果上报给所述预设调试器。
本申请实施例的第二方面提供了一种程序调试装置,包括:
判断单元,用于在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件;
监测单元,用于若满足预设的暂停条件,则暂停运行所述操作指令,并监测是否接收到预设调试器发送的调试指令;
执行单元,用于若接收到预设调试器发送的调试指令,则执行所述调试指令,所述调试指令用于获得第一调试结果;
运行单元,用于在执行所述调试指令之后,运行所述操作指令,并监测运行所述操作指令的过程中是否产生异常结果;
上报单元,用于若监测到运行所述操作指令的过程中产生异常结果,则将所述异常结果作为第二调试结果上报给所述预设调试器。
本申请实施例的第三方面提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现本申请实施例第一方面提供的所述方法的步骤。
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被一个或多个处理器执行时实现本申请实施例第一方面提供的所述方法的步骤。
有益效果
本申请实施例与现有技术相比存在的有益效果是:
本申请实施例通过在在运行待调试程序的每一条操作指令之前,判断是否满足预设的暂停条件,以此确定是否需要暂停运行当前的操作指令;在暂停运行操作指令后,与预设调试器保持远程通信,监测预设调试器的调试指令,通过此方法,省去了预先将调试代码写入待调试的程序的繁琐,而是直接根据预设调试器的调试指令对程序进行调试,更高效、更灵活性;在执行调试指令后,继续运行操作指令,并捕获异常,当捕获到异常结果时,将异常结果上报给预设调试器,使得通过预设调试器能够及时了解程序运行情况。通过上述方法,有效提高了程序调试的效率。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的程序调试方法的实现流程示意图;
图2是本申请实施例提供的执行调试指令的方法实现流程图;
图3是本申请实施例提供的程序调试装置的示意图;
图4是本申请实施例提供的终端设备的示意图。
本发明的实施方式
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
如在本说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。
在介绍本申请实施例之前,先介绍本申请的一个应用场景。在集成开发环境(Integrated Development Environment,IDE)上有一个调试器,在调试器中封装调试指令,通过TCP/IP等通信方式将调试指令发送到无线标记语言脚本(Wireless Mark Language Script ,WMLS)应用的WMLS脚本解析器中,WMLS脚本解析器接收到调试指令后执行该调试指令,并将调试结果返回给IDE的调试器。
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。
图1是本申请实施例提供的程序调试方法的实现流程示意图,如图所示,所述方法可以包括以下步骤:
步骤S101,在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件。
在一个实施例中,所述在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件,包括:
在运行所述待调试程序中的第一条操作指令之前,判断是否存在预设标志位,所述预设标志位用于表示暂停运行所述预设标志位对应的代码位置处的操作指令。
若存在预设标志位,则暂停运行所述待调试程序中的第一条操作指令,并与所述预设调试器建立远程通信连接,接收所述预设调试器发送的预设断点信息。
在接收到所有的预设断点信息后,将所述预设断点信息存储到预设数据库中。
清除所述预设标志位,并判断是否满足预设的暂停条件。
在实际应用中,IDE中的调试器是在待调试程序运行的过程中设置断点,具体的,是在待调试程序的运行过程中,脚本解析器通过与调试器进行远程通信来获取调试器中预先设置的断点信息。因此需要先启动待调试的程序,这样通信进程才能开始工作。但是在待调试程序的初始运行阶段的断点可能被忽略,那么就需要在待调试程序的初始位置设置一个标志位(该标志位表示需要暂停)。待调试程序在初始位置暂停的同时,IDE向脚本解析器发送所有预先设置的断点信息,当所有断点信息发送完毕后,IDE发送一个初始化完成的命令,脚本解析器开始运行待调试程序,并将该标志位清除。
在运行第n条操作指令之前,先判断是否满足预设的暂停条件,如果满足预设的暂停,则暂停运行第n条操作指令,如果不满足预设的暂停条件,则直接运行第n条操作指令。
如何判断是否满足预设的暂停条件,可以有两种方法,一种是匹配预设数据库中已设置的断点,另一种是用户发送中断指令。具体步骤如下所示。
在一个实施例中,所述判断是否满足预设的暂停条件,可以是判断是否匹配已设置的断点,具体包括以下步骤:
获取当前的操作指令在所述待调试程序中的代码位置,并判断预设数据库中是否存在与所述代码位置匹配的信息,所述预设数据库包括所述待调试程序中的所有断点的代码位置。
若预设数据库中存在与所述代码位置匹配的信息,则判定满足预设的暂停条件。
在实际应用中,用户可以通过预设调试器在待调试程序运行的过程中设置断点,脚本解析器的通信进程根据预设调试器的设置断点指令将新增断点信息(即断点在待调试程序中的代码位置)添加到预设数据库(预设数据库可以是脚本解析器中的存储空间,也可以是第三方存储空间),或将预设数据库中已有的断点信息删除。脚本解析器的运行进程在运行程序的每个操作指令之前,将当前的操作指令的代码位置与目前预设数据库中的断点信息进行匹配,若预设数据库中存在与当前的操作指令的代码位置匹配的断点信息,说明当前的操作指令的代码位置为断点位置,即满足暂停条件。
在一个实施例中,所述与所述预设调试器建立远程通信连接,包括:
基于传输控制协议与所述预设调试器建立远程通信连接。
当然,在实际应用中,除了基于传输控制协议于预设调试器建立远程通信连接之外,还可以有其他的方式于预设调试器建立远程通信连接,如串口通信等。
在一个实施例中,用户也可以随时发送中断命令,所述判断是否满足预设的暂停条件,可以是用户发送的中断指令,具体包括以下步骤:
在运行上一条操作指令后,检测是否接收到中断命令。
若在运行上一条操作指令后,接收到中断命令,则判定满足预设的暂停条件。
例如,当执行第n条操作指令后,未接收到用户的中断命令,则说明用户未发送中断命令,则直接运行第n+1条操作指令;若接收到用户的中断命令,则说明发送了中断命令,则暂停运行第n+1条操作指令。
步骤S102,若满足预设的暂停条件,则暂停运行所述操作指令,并监测是否接收到预设调试器发送的调试指令。
在暂停运行操作指令后,始终保持与IDE的调试器的远程通信,监测调试器发送的调试指令。
脚本解析器的通信进程负责与预设调试器进行通信,监测调试器发送的调试指令;脚本解析器的运行进程负责运行待调试程序和调试工作。通信进程和运行进程并行工作,这样,可以随时利用IDE调试器对待调试程序进行断点设置,并通过通信进行将断点设置信息发送给脚本解析器,脚本解析器的运行进程也可以随时根据最新的断点设置方案对待调试的程序进行中断处理。两个线程各自工作,互不影响。利用IDE调试器与脚本解析器通信的方式传递断点信息,可以实现远程调试,也可以是实现跨平台调试。另外,用户可以在IDE调试器上设置断点信息,而无需直接在待调试程序中编写调试代码,简化了调试过程,提高了调试效率。
步骤S103,若接收到预设调试器发送的调试指令,则执行所述调试指令,所述调试指令用于获得第一调试结果。
调试指令不限于运行指令、查询指令和跳入跳出指令,调试指令还可以包括其他的指令。第一调试结果是与调试指令对应的结果,第一调试结果可以是某个值、某个数据或信息,也可以是某个执行动作。
例如,当调试指令为单步运行指令时,第一调试结果为运行操作指令;当调试指令为查询指令时,第一调试结果为查询到的操作指令的变量值;当调试指令为单步跳入指令或单步跳出指令时,第一调试结果为计算出的下一个断点的位置。
参见图2,图2是本申请实施例提供的执行调试指令的方法实现流程图,如图所示,所述执行所述调试指令,包括:
步骤S201,若所述调试指令为单步运行指令,则运行所述操作指令。
步骤S202,若所述调试指令为查询指令,则查询所述操作指令中的变量值,并监测下一个调试指令。
在一个实施例中,所述查询所述操作指令中的变量值之后,包括:
判断所述待调试程序当前的运行结果是否符合预设结果。
若所述待调试程序当前的运行结果不符合预设结果,则将所述操作指令中的变量值设置为预期值。
可以根据局部变量在内存中的位置来查找局部变量,然后通过WMLS脚本解析器自带的函数接口进行查询或设置。对于全局变量,可以直接使用WMLS脚本解析器自带的函数接口进行查询或设置。
当待调试程序当前的运行结果不符合预设结果时,可以临时改变变量值,再查看相应的运行结果。其中,预期值可以由用户输入。预设结果是指当待调试程序正常运行到当前位置时的结果。
步骤S203,若所述调试指令为单步跳入指令或单步跳出指令,则计算下一个断点的代码位置,并将该代码位置存储到所述预设数据库中。
执行调试指令是为了在待调试程序的某个位置,观察程序的运行状态是否符合预期,因此,第一调试指令也可以是当前程序的运行状态。
步骤S104,在执行所述调试指令之后,运行所述操作指令,并监测运行所述操作指令的过程中是否产生异常结果。
在一个实施例中,在执行所述调试指令之后,还包括:
在所述代码位置处进行标记,所述标记用于表示所述代码位置处的操作指令已经被执行暂停。
步骤S105,若监测到运行所述操作指令的过程中产生异常结果,则将所述异常结果作为第二调试结果上报给所述预设调试器。
若运行操作指令的过程中产生异常结果,则捕获异常结果,并将异常结果上报给IDE。若无异常,则重复步骤S101,即继续调试下一条操作指令。
为了不影响程序的运行,上报异常结果的工作可以由脚本解析器的通信进程执行。
本申请实施例通过在运行待调试程序的每一条操作指令之前,判断是否满足预设的暂停条件,以此确定是否需要暂停运行当前的操作指令;在暂停运行操作指令后,与预设调试器保持通信,监测预设调试器的调试指令,通过此方法,省去了预先将调试代码写入待调试的程序的繁琐,而是通过远程通信直接根据预设调试器的调试指令对程序进行调试,更高效、更灵活性;在执行调试指令后,继续运行操作指令,并捕获异常,当捕获到异常结果时,将异常结果上报给预设调试器,使得通过预设调试器能够及时了解程序运行情况。通过上述方法,有效提高了程序调试的效率。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
图3是本申请实施例提供的程序调试装置的示意图,为了便于说明,仅示出与本申请实施例相关的部分。
图3所示的程序调试装置可以是内置于现有的终端设备内的软件单元、硬件单元、或软硬结合的单元,也可以作为独立的挂件集成到所述终端设备中,还可以作为独立的终端设备存在。
所述程序调试装置3包括:
判断单元31,用于在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件;
监测单元32,用于若满足预设的暂停条件,则暂停运行所述操作指令,并监测是否接收到预设调试器发送的调试指令;
执行单元33,用于若接收到预设调试器发送的调试指令,则执行所述调试指令,所述调试指令用于获得第一调试结果;
运行单元34,用于在执行所述调试指令之后,运行所述操作指令,并监测运行所述操作指令的过程中是否产生异常结果;
上报单元35,用于若监测到运行所述操作指令的过程中产生异常结果,则将所述异常结果作为第二调试结果上报给所述预设调试器。
可选的,所述判断单元31包括:
检测模块,用于在运行上一条操作指令后,检测是否接收到中断命令。
第一判定模块,用于若在运行上一条操作指令后,接收到中断命令,则判定满足预设的暂停条件。
可选的,所述判断单元31还包括:
获取模块,用于获取当前的操作指令在所述待调试程序中的代码位置,并判断所述预设数据库中是否存在与所述代码位置匹配的预设断点信息。
第二判定模块,用于若预设数据库中存在与所述代码位置匹配的预设断点信息,则判定满足预设的暂停条件。
可选的,所述判断单元31还包括:
判断模块,用于在运行所述待调试程序中的第一条操作指令之前,判断是否存在预设标志位,所述预设标志位用于表示暂停运行所述预设标志位对应的代码位置处的操作指令。
暂停模块,用于若存在预设标志位,则暂停运行所述待调试程序中的第一条操作指令,并与所述预设调试器建立远程通信连接,接收所述预设调试器发送的预设断点信息。
存储模块,用于在接收到所有的预设断点信息后,将所述预设断点信息存储到预设数据库中。
清除模块,用于清除所述预设标志位,并判断是否满足预设的暂停条件。
可选的,所述暂停模块包括:
建立子模块,拥有基于传输控制协议与所述预设调试器建立远程通信连接。
可选的,所述执行单元33包括:
运行模块,用于若所述调试指令为单步运行指令,则运行所述操作指令。
查询模块,用于若所述调试指令为查询指令,则查询所述操作指令中的变量值,并监测下一个调试指令。
计算模块,用于若所述调试指令为单步跳入指令或单步跳出指令,则计算下一个断点的代码位置,并将该代码位置存储到所述预设数据库中。
可选的,所述装置3还包括:
删除单元,用于在执行所述调试指令之后,将所述代码位置对应的预设断点位置从所述预设数据库中删除。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
图4是本申请实施例提供的终端设备的示意图。如图4所示,该实施例的终端设备4包括:处理器40、存储器41以及存储在所述存储器41中并可在所述处理器40上运行的计算机程序42。所述处理器40执行所述计算机程序42时实现上述各个程序调试方法实施例中的步骤,例如图1所示的步骤S101至S105。或者,所述处理器40执行所述计算机程序42时实现上述各装置实施例中各模块/单元的功能,例如图3所示模块31至35的功能。
示例性的,所述计算机程序42可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器41中,并由所述处理器40执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序42在所述终端设备4中的执行过程。例如,所述计算机程序42可以被分割成判断单元、监测单元、执行单元、运行单元、上报单元,各单元具体功能如下:
判断单元,用于在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件;
监测单元,用于若满足预设的暂停条件,则暂停运行所述操作指令,并监测是否接收到预设调试器发送的调试指令;
执行单元,用于若接收到预设调试器发送的调试指令,则执行所述调试指令,所述调试指令用于获得第一调试结果;
运行单元,用于在执行所述调试指令之后,运行所述操作指令,并监测运行所述操作指令的过程中是否产生异常结果;
上报单元,用于若监测到运行所述操作指令的过程中产生异常结果,则将所述异常结果作为第二调试结果上报给所述预设调试器。
可选的,所述判断单元包括:
检测模块,用于在运行上一条操作指令后,检测是否接收到中断命令。
第一判定模块,用于若在运行上一条操作指令后,接收到中断命令,则判定满足预设的暂停条件。
可选的,所述判断单元还包括:
获取模块,用于获取当前的操作指令在所述待调试程序中的代码位置,并判断所述预设数据库中是否存在与所述代码位置匹配的预设断点信息。
第二判定模块,用于若预设数据库中存在与所述代码位置匹配的预设断点信息,则判定满足预设的暂停条件。
可选的,所述判断单元还包括:
判断模块,用于在运行所述待调试程序中的第一条操作指令之前,判断是否存在预设标志位,所述预设标志位用于表示暂停运行所述预设标志位对应的代码位置处的操作指令。
暂停模块,用于若存在预设标志位,则暂停运行所述待调试程序中的第一条操作指令,并与所述预设调试器建立远程通信连接,接收所述预设调试器发送的预设断点信息。
存储模块,用于在接收到所有的预设断点信息后,将所述预设断点信息存储到预设数据库中。
清除模块,用于清除所述预设标志位,并判断是否满足预设的暂停条件。
可选的,所述暂停模块包括:
建立子模块,拥有基于传输控制协议与所述预设调试器建立远程通信连接。
可选的,所述执行单元包括:
运行模块,用于若所述调试指令为单步运行指令,则运行所述操作指令。
查询模块,用于若所述调试指令为查询指令,则查询所述操作指令中的变量值,并监测下一个调试指令。
计算模块,用于若所述调试指令为单步跳入指令或单步跳出指令,则计算下一个断点的代码位置,并将该代码位置存储到所述预设数据库中。
可选的,所述计算机程序还包括:
删除单元,用于在执行所述调试指令之后,将所述代码位置对应的预设断点位置从所述预设数据库中删除。
所述终端设备4可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器40、存储器41。本领域技术人员可以理解,图4仅仅是终端设备4的示例,并不构成对终端设备4的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入输出设备、网络接入设备、总线等。
所称处理器40可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application Specific Integrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器41可以是所述终端设备4的内部存储单元,例如终端设备4的硬盘或内存。所述存储器41也可以是所述终端设备4的外部存储设备,例如所述终端设备4上配备的插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字(Secure Digital, SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器41还可以既包括所述终端设备4的内部存储单元也包括外部存储设备。所述存储器41用于存储所述计算机程序以及所述终端设备所需的其他程序和数据。所述存储器41还可以用于暂时地存储已经输出或者将要输出的数据。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括是电载波信号和电信信号。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (10)

  1. 一种程序调试方法,其特征在于,包括:
    在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件;
    若满足预设的暂停条件,则暂停运行所述操作指令,并监测是否接收到预设调试器发送的调试指令;
    若接收到预设调试器发送的调试指令,则执行所述调试指令,所述调试指令用于获得第一调试结果;
    在执行所述调试指令之后,运行所述操作指令,并监测运行所述操作指令的过程中是否产生异常结果;
    若监测到运行所述操作指令的过程中产生异常结果,则将所述异常结果作为第二调试结果上报给所述预设调试器。
  2. 如权利要求1所述的程序的调试方法,其特征在于,所述判断是否满足预设的暂停条件,包括:
    在运行上一条操作指令后,检测是否接收到中断命令;
    若在运行上一条操作指令后,接收到中断命令,则判定满足预设的暂停条件。
  3. 如权利要求1所述的程序调试方法,其特征在于,所述判断是否满足预设的暂停条件,还包括:
    获取当前的操作指令在所述待调试程序中的代码位置,并判断预设数据库中是否存在与所述代码位置匹配的预设断点信息;
    若预设数据库中存在与所述代码位置匹配的预设断点信息,则判定满足预设的暂停条件。
  4. 如权利要求3所述的程序调试方法,其特征在于,所述在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件,包括:
    在运行所述待调试程序中的第一条操作指令之前,判断是否存在预设标志位,所述预设标志位用于表示暂停运行所述预设标志位对应的代码位置处的操作指令;
    若存在预设标志位,则暂停运行所述待调试程序中的第一条操作指令,并与所述预设调试器建立远程通信连接,接收所述预设调试器发送的预设断点信息;
    在接收到所有的预设断点信息后,将所述预设断点信息存储到预设数据库中;
    清除所述预设标志位,并判断是否满足预设的暂停条件。
  5. 如权利要求4所述的程序调试方法,其特征在于,所述与所述预设调试器建立远程通信连接,包括:
    基于传输控制协议与所述预设调试器建立远程通信连接。
  6. 如权利要求3所述的程序调试方法,其特征在于,所述执行所述调试指令,包括:
    若所述调试指令为单步运行指令,则运行所述操作指令;
    若所述调试指令为查询指令,则查询所述操作指令中的变量值,并监测下一个调试指令;
    若所述调试指令为单步跳入指令或单步跳出指令,则计算下一个断点的代码位置,并将该代码位置存储到所述预设数据库中。
  7. 如权利要求3所述的程序调试方法,其特征在于,在执行所述调试指令之后,还包括:
    将所述代码位置对应的预设断点位置从所述预设数据库中删除。
  8. 一种程序调试装置,其特征在于,包括:
    判断单元,用于在运行待调试程序中的每一条操作指令之前,判断是否满足预设的暂停条件;
    监测单元,用于若满足预设的暂停条件,则暂停运行所述操作指令,并监测是否接收到预设调试器发送的调试指令;
    执行单元,用于若接收到预设调试器发送的调试指令,则执行所述调试指令,所述调试指令用于获得第一调试结果;
    运行单元,用于在执行所述调试指令之后,运行所述操作指令,并监测运行所述操作指令的过程中是否产生异常结果;
    上报单元,用于若监测到运行所述操作指令的过程中产生异常结果,则将所述异常结果作为第二调试结果上报给所述预设调试器。
  9. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述方法的步骤。
  10. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述方法的步骤。
PCT/CN2019/116297 2018-12-27 2019-11-07 程序调试方法、程序调试装置、终端设备及存储介质 WO2020134634A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811609533.4 2018-12-27
CN201811609533.4A CN109800159B (zh) 2018-12-27 2018-12-27 程序调试方法、程序调试装置、终端设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020134634A1 true WO2020134634A1 (zh) 2020-07-02

Family

ID=66557616

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/116297 WO2020134634A1 (zh) 2018-12-27 2019-11-07 程序调试方法、程序调试装置、终端设备及存储介质

Country Status (2)

Country Link
CN (1) CN109800159B (zh)
WO (1) WO2020134634A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210263817A1 (en) * 2020-11-09 2021-08-26 Beijing Baidu Netcom Science And Technology Co., Ltd. Method and apparatus for sending debugging instruction

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109800159B (zh) * 2018-12-27 2021-02-23 百富计算机技术(深圳)有限公司 程序调试方法、程序调试装置、终端设备及存储介质
CN110162336B (zh) * 2019-05-27 2023-07-07 深圳市康冠商用科技有限公司 一种串口指令发送方法、装置和计算机可读存储介质
CN110162479B (zh) * 2019-05-29 2023-09-29 Oppo广东移动通信有限公司 异常应用检测方法、装置及终端设备
CN110515849B (zh) * 2019-08-29 2020-06-12 上海燧原智能科技有限公司 一种断点调试方法、装置、系统、设备及存储介质
CN110543429B (zh) * 2019-09-10 2023-05-16 深圳前海微众银行股份有限公司 测试用例调试方法、装置及存储介质
CN112527571B (zh) * 2019-09-18 2024-02-02 珠海零边界集成电路有限公司 一种cpu指令集覆盖率计算方法及装置
CN110795354A (zh) * 2019-10-30 2020-02-14 北京小米移动软件有限公司 信息处理方法、装置及存储介质
CN110865630B (zh) * 2019-11-14 2022-07-05 深圳供电局有限公司 智能变电站内置程序的验收方法和系统
CN111198790B (zh) * 2019-12-23 2023-09-08 深圳市优必选科技股份有限公司 机器人测试方法、机器人测试装置及机器人
CN111083563B (zh) * 2019-12-30 2021-09-07 深圳市康冠智能科技有限公司 电视ui控件的调试方法、装置、电视机及存储介质
CN113835990B (zh) * 2020-06-23 2024-01-30 中科寒武纪科技股份有限公司 检测方法、装置、计算机设备和存储介质
CN111736814A (zh) * 2020-06-24 2020-10-02 武汉精立电子技术有限公司 一种测试文件脚本编辑器、测试方法及系统
CN112486836B (zh) * 2020-12-09 2024-04-09 北京展心展力信息科技有限公司 调试发布包的方法、装置、电子设备及介质
CN113111001B (zh) * 2021-04-29 2023-10-24 苏州大学 一种嵌入式终端远程软件调试方法
CN113986771B (zh) * 2021-12-29 2022-04-08 北京壁仞科技开发有限公司 用于调试目标程序代码的方法及装置、电子设备
CN114116523A (zh) * 2022-01-28 2022-03-01 广东睿江云计算股份有限公司 一种框架调试方法以及框架调试系统
CN115481021B (zh) * 2022-09-01 2023-07-21 上海弘玑信息技术有限公司 自动化流程的调试方法、电子设备及存储介质
CN117032903B (zh) * 2023-10-07 2024-01-26 之江实验室 一种仿真调试方法、装置、存储介质及电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020116699A1 (en) * 2000-12-18 2002-08-22 Armin Amrhein Apparatus and method for checking the status of control systems
CN102301344A (zh) * 2011-07-06 2011-12-28 华为技术有限公司 一种操作系统内核调试方法和虚拟调试服务模块
CN105955886A (zh) * 2016-04-23 2016-09-21 珠海保税区星汉智能卡股份有限公司 一种基于解释型语言的异常断点调试方法
CN109800159A (zh) * 2018-12-27 2019-05-24 百富计算机技术(深圳)有限公司 程序调试方法、程序调试装置、终端设备及存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719093B (zh) * 2009-12-09 2011-11-23 上海普元信息技术股份有限公司 企业Web应用系统中实现跨浏览器Javascript调试的系统及其方法
US8689196B2 (en) * 2010-12-10 2014-04-01 Microsoft Corporation Display of data from parallel programming contexts
CN102955737B (zh) * 2012-11-06 2015-08-12 无锡江南计算技术研究所 异构处理器体系的程序调试方法和系统
CN103593292A (zh) * 2013-11-19 2014-02-19 北京深思数盾科技有限公司 调试程序的系统及方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020116699A1 (en) * 2000-12-18 2002-08-22 Armin Amrhein Apparatus and method for checking the status of control systems
CN102301344A (zh) * 2011-07-06 2011-12-28 华为技术有限公司 一种操作系统内核调试方法和虚拟调试服务模块
CN105955886A (zh) * 2016-04-23 2016-09-21 珠海保税区星汉智能卡股份有限公司 一种基于解释型语言的异常断点调试方法
CN109800159A (zh) * 2018-12-27 2019-05-24 百富计算机技术(深圳)有限公司 程序调试方法、程序调试装置、终端设备及存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210263817A1 (en) * 2020-11-09 2021-08-26 Beijing Baidu Netcom Science And Technology Co., Ltd. Method and apparatus for sending debugging instruction
US11860749B2 (en) * 2020-11-09 2024-01-02 Beijing Baidu Netcom Science and Technology Co., Ltd Method and apparatus for sending debugging instruction

Also Published As

Publication number Publication date
CN109800159B (zh) 2021-02-23
CN109800159A (zh) 2019-05-24

Similar Documents

Publication Publication Date Title
WO2020134634A1 (zh) 程序调试方法、程序调试装置、终端设备及存储介质
KR102493449B1 (ko) 엣지 컴퓨팅 테스트 방법, 장치, 전자 장치 및 컴퓨터 판독 가능 매체
US8572577B2 (en) Monitoring changes to data within a critical section of a threaded program
US8752024B2 (en) Resuming a prior debug session
US9176848B2 (en) Program debugger and program debugging
US8423970B2 (en) Method, computer program product, and hardware product for handling breakpoints in an asynchronous debug model
US8832504B2 (en) On demand tracing of application code execution
JP2008523456A (ja) トレースコプロセッサを備えたデータ処理システム
CN108763060A (zh) Android系统中Native层崩溃溯源方法、装置、存储介质及终端
WO2020087954A1 (zh) 抓取NVME硬盘trace的方法、装置、设备及系统
US20140245085A1 (en) Managing error logs in a distributed network fabric
US8607199B2 (en) Techniques for debugging code during runtime
CN111782522B (zh) 追踪消息的输出方法、电子设备及存储介质
CN105511937A (zh) 一种适用于云平台的批量虚拟机蓝屏监控方法
WO2021244088A1 (zh) 程序控制方法、装置、计算机设备及存储介质
CN107872363B (zh) 数据包丢失的处理方法、系统、可读存储介质及电子设备
US7296187B1 (en) Hardware debug device having script-based host interface
CN111309606A (zh) 页面异常处理方法、装置、计算机设备及存储介质
CN111168668A (zh) 一种机器人的控制方法及机器人
CN112764995B (zh) 一种服务器硬件资源监控方法、装置和介质
CN116414634A (zh) 设备调试方法、系统、装置、调试设备和可读存储介质
CN108509223B (zh) 一种数据处理方法、装置、系统及存储介质
KR20120072117A (ko) 태스크 스크립트의 실행 방법 및 원격 실행 방법
US10162731B2 (en) Conditional breakpoint on call stack during debugging at runtime
WO2021081730A1 (zh) 直接内存访问控制方法、系统、计算机设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19905420

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19905420

Country of ref document: EP

Kind code of ref document: A1