A program code debugging method and related device
By setting debug tags in distributed devices and utilizing distributed communication protocols, function breakpoints are automatically added at the application framework communication interface of the target device, solving the problem of cumbersome manual switching operations during program code debugging and achieving efficient and accurate debugging across devices.
Patent Information
- Application Number
- CN202110579713.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-26
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2041-05-26
AI Technical Summary
In distributed devices, program code debugging requires manual management of debugging sessions on multiple devices and frequent switching, resulting in cumbersome operations and low efficiency.
By setting debug tags at remote interface calls and using distributed communication protocols to transmit debug tags along with the business process call chain, function breakpoints are automatically added at the application framework communication interface of the target device, and a session connection is established with the debug server to achieve automatic debugging across devices.
It eliminates the need for manual switching, improves the accuracy and efficiency of program code debugging, and is suitable for various application scenarios.
Smart Images

Figure CN115408254B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, in particular to a program code debugging method and related equipment. BACKGROUND
[0002] With the rapid development of the 5th-Generation (5G) technology, 1+8+N (1: mobile phone, 8: tablet, television, PC, smart cockpit, earphone, sound box, watch, router, N: Internet of Things device) devices begin to support distributed capabilities, remote calls between devices will be very frequent, and the same device will use multiple programming languages to implement applications and corresponding system services (JavaScript, Java, C / C++), which leads to the need for third-party developers to manually manage a large number of debugging sessions of different devices during the debugging process, and frequent manual switching between different devices, which is very cumbersome and leads to low debugging efficiency. SUMMARY
[0003] Embodiments of the present application provide a program code debugging method and related equipment, which can improve the accuracy of program code debugging and improve the efficiency of program code debugging.
[0004] In a first aspect, embodiments of the present application provide a program code debugging method, including: a first device receiving a first message sent by a second device, the first message including a debugging tag, the debugging tag including address information of a debugging server, the first message being sent after the second device stops debugging when calling interface code of the first device in a business execution process; adding a function breakpoint at program code corresponding to an application framework communication interface according to the debugging tag; establishing a debugging session connection with the debugging server according to the address information; and starting debugging at the function breakpoint through the established debugging session connection. By setting a debugging tag at a remote interface call of the second device, the debugging tag is transmitted to the first device along with the communication protocol, so that the first device adds a function breakpoint at program code corresponding to an application framework communication interface according to the debugging tag, and debugging is started at the function breakpoint of the first device, thereby avoiding manual switching operations, improving the accuracy of program code debugging, and improving the efficiency of program code debugging.
[0005] In a possible design, the debugging tag is used to indicate a debugging mode, and the debugging mode is to debug program code in the business execution process. By using the debugging tag to indicate the debugging mode, a function breakpoint is automatically added, manual operations are avoided, and the efficiency of debugging is improved.
[0006] In another possible design, the first device determines the program code corresponding to the application framework communication interface according to the communication interface information corresponding to the first message sent by the second device. The accuracy of setting the function breakpoint is improved by adding the function breakpoint at the program code corresponding to the determined application framework communication interface.
[0007] In another possible design, the first device receives the first message sent by the second device through the distributed communication protocol. The debugging tag is transmitted following the business flow call chain across devices through the distributed communication protocol.
[0008] In another possible design, the first device sends a second message to the second device, where the second message is used to instruct the second device to continue debugging at the next line of the interface code of the first device. The efficiency of debugging is improved by implementing automatic jump of program code debugging following the business.
[0009] In another possible design, the first device sends debugging information to the debugging server through the established debugging session connection, where the debugging information is used to prompt the running condition of the program code.
[0010] In another possible design, the debugging tag is included in the business flow identifier, and the business flow identifier is used to identify the business.
[0011] In a second aspect, an embodiment of the present application provides a program code debugging method, including: the second device configures a debugging tag for a business, and starts debugging; when interface code of the first device is called in the execution process of the business, the debugging is stopped, and a first message is sent to the first device, where the first message includes the debugging tag, the debugging tag includes address information of a debugging server, the address information is used to establish a debugging session connection with the debugging server, and the debugging tag is used to instruct to add a function breakpoint at program code corresponding to an application framework communication interface, and start debugging at the function breakpoint through the established debugging session connection. The debugging tag is set at a remote interface call of the second device, the debugging tag is transmitted to the first device along with a communication protocol, the first device adds a function breakpoint at program code corresponding to an application framework communication interface according to the debugging tag, jumps to the function breakpoint of the first device to start debugging, and thus manual switching operation is avoided, the accuracy of program code debugging is improved, and the efficiency of program code debugging is improved.
[0012] In a possible design, the second device sends the first message to the first device through a distributed communication protocol. The debugging tag is transmitted following a business flow call chain across devices through the distributed communication protocol.
[0013] In another possible design, the second device receives the second message of the first device; and the next line of the interface code of the first device is continued for debugging. The program code debugging is automatically followed by the business automatic jump, thereby improving the efficiency of the debugging.
[0014] In another possible design, the debugging tag is included in a business flow identifier, and the business flow identifier is used to identify the business.
[0015] In a third aspect, an embodiment of the present application provides a program code debugging apparatus, which is configured to implement the method and the functions performed by the first device in the first aspect, and is implemented by hardware / software, and the hardware / software includes a module corresponding to the above functions.
[0016] In a fourth aspect, an embodiment of the present application provides a program code debugging apparatus, which is configured to implement the method and the functions performed by the second device in the second aspect, and is implemented by hardware / software, and the hardware / software includes a module corresponding to the above functions.
[0017] In a fifth aspect, the present application provides a program code debugging apparatus. The apparatus can be the first device, a device in the first device, or a device that can be used in combination with the first device. The program code debugging apparatus can also be a chip system. The program code debugging apparatus can execute the method in the first aspect. The functions of the program code debugging apparatus can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The module can be software and / or hardware. The operations and advantages of the program code debugging apparatus can be found in the method in the first aspect and the advantages, and the repeated parts will not be described herein.
[0018] In a sixth aspect, the present application provides a program code debugging apparatus. The apparatus can be the second device, a device in the second device, or a device that can be used in combination with the second device. The program code debugging apparatus can also be a chip system. The program code debugging apparatus can execute the method in the second aspect. The functions of the program code debugging apparatus can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The module can be software and / or hardware. The operations and advantages of the program code debugging apparatus can be found in the method in the second aspect and the advantages, and the repeated parts will not be described herein.
[0019] In a seventh aspect, the present application provides a program code debugging apparatus, the program code debugging apparatus comprising a processor, when the processor invokes a computer program in a memory, the method in any one of the first aspect and the second aspect is executed.
[0020] In an eighth aspect, the present application provides a program code debugging apparatus, the program code debugging apparatus comprising a processor and a memory, the memory is used to store computer execution instructions; the processor is used to execute the computer execution instructions stored in the memory, so that the program code debugging apparatus executes the method in any one of the first aspect and the second aspect.
[0021] In a ninth aspect, the present application provides a program code debugging apparatus, the program code debugging apparatus comprising a processor, a memory and a transceiver, the transceiver is used to receive a channel or a signal, or send a channel or a signal; the memory is used to store a computer program; the processor is used to invoke the computer program from the memory to execute the method in any one of the first aspect and the second aspect.
[0022] In a tenth aspect, the present application provides a program code debugging apparatus, the program code debugging apparatus comprising a processor and an interface circuit, the interface circuit is used to receive a computer program instruction and transmit to the processor; the processor runs the computer program to execute the method in any one of the first aspect and the second aspect.
[0023] In an eleventh aspect, the present application provides a computer readable storage medium, the computer readable storage medium is used to store a computer program, when the computer program is executed, the method in any one of the first aspect and the second aspect is realized.
[0024] In a twelfth aspect, the present application provides a computer program product, when the computer program is executed, the method in any one of the first aspect and the second aspect is realized.
[0025] In a thirteenth aspect, the present application provides a communication system, the communication system comprising at least one first device and at least one second device, the first device is used to execute the steps in the first aspect, and the second device is used to execute the steps in the second aspect. BRIEF DESCRIPTION OF DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background art, the drawings needed to be used in the embodiments of the present application or the background art will be described below.
[0027] Figure 1 is a schematic diagram of a debugging system provided by the embodiments of the present application;
[0028] Figure 2 This is a diagram illustrating the debugging of heterogeneous applications in a distributed environment;
[0029] Figure 3 This is a flowchart illustrating a program code debugging method provided in an embodiment of this application;
[0030] Figure 4 This is a schematic diagram of a distributed service call tree provided in an embodiment of this application;
[0031] Figure 5 This is a timing diagram of a distributed service provided in an embodiment of this application;
[0032] Figure 6 This is a schematic diagram of program code debugging provided in an embodiment of this application;
[0033] Figure 7 This is a schematic diagram of the structure of a program code debugging device provided in an embodiment of this application;
[0034] Figure 8 This is a schematic diagram of another program code debugging device provided in an embodiment of this application;
[0035] Figure 9 This is a schematic diagram of the structure of a first device provided in an embodiment of this application;
[0036] Figure 10 This is a schematic diagram of the structure of a second device provided in an embodiment of this application. Detailed Implementation
[0037] The embodiments of this application are described below with reference to the accompanying drawings.
[0038] like Figure 1 As shown, Figure 1 This is a schematic diagram of the architecture of a debugging system provided in an embodiment of this application. The system may include multiple devices (e.g., device 1, device 2, ..., device N) and a debugging server. The debugging server can be an integrated development environment (IDE) debugging tool. The debugging server is used to debug the program code of device 1, device 2, ..., device N. The multiple devices can be tablets, televisions, PCs, smart cockpits, headphones, speakers, watches, routers, or IoT devices. The multiple devices can communicate with each other through a distributed communication protocol. This embodiment of the application can be applied to distributed scenarios with multiple devices and multiple languages. The multiple languages can be JavaScript, Java, C / C++, etc.
[0039] like Figure 2As shown, Figure 2 An illustration of debugging a heterogeneous application in a distributed environment. The architecture of debugging a heterogeneous application in a distributed environment is configured to enable location transparency and dynamic exposure of service state. The architecture describes or otherwise provides a mechanism to allow seamless debugging and troubleshooting of a distributed application regardless of where the physical application state is located. The location of the state is transparent to the debugger and the application being debugged. In addition, the architecture enables a single service to dynamically expose its state at runtime. The service has the potential to expose its state in a self-describing manner, and the service state can be exposed in the architecture regardless of the service environment. The architecture allows the debugger to function as if it were running in a non-distributed homogeneous environment in a distributed heterogeneous environment.
[0040] However, the technical solution has the following problems: (1) The debugging scheme reserves an interface for debugging in advance in the application, which requires intrusive modification and prior deployment in the application program, and the development adaptation workload and debugging information design workload are relatively large. (2) The technology focuses on debugging in a known running context scenario, which needs to first obtain a running context, coordinate a distributed application through a debugging context, and present a unified view of the distributed application to the debugger. The debugging context includes a centralized repository. For a distributed business scenario of a mobile device, the running context cannot be obtained in advance, so the application scenario is very limited. In order to solve the above technical problems, the embodiments of the present application provide the following solutions.
[0041] As Figure 3 shown, Figure 3 is a flowchart of a program code debugging method provided by an embodiment of the present application. The steps in the embodiment of the present application at least include:
[0042] S301, the second device configures a debugging tag for a service, and starts debugging.
[0043] The service can be a distributed service. For example, a debugging tag can be configured at a remote interface call for a distributed service. The debugging tag can include a debugging mode identifier and address information of a debugging server, wherein the debugging mode identifier can be used to indicate a debugging mode, and the debugging mode is to debug program code in a service execution process. The address information can include a wireless fidelity (WIFI) internet protocol (IP) address or a USB virtual device identification (ID).
[0044] Optionally, the debug tag can be used to indicate debug mode or to indicate whether debug mode is canceled. For example, 1 indicates debug mode, and 0 indicates that debug mode is canceled. 0 and 1 can also be reversed. The debug tag can include 56 bits, or other bits. Of these, 48 bits are used to represent the address information of the debug server, and 8 bits are used to represent the debug mode identifier. The address information of the debug server or the debug mode identifier contained in the debug tag can also be other bits.
[0045] Optionally, the debug tag can be included in the service flow identifier (TraceID). The service flow identifier is used to identify the service and can be transmitted along with the service, for example, via inter-thread transmission through Transport Layer Security (TLS), inter-process communication (IPC), or cross-device transmission through Remote Procedure Call (RPC). In this embodiment, the first message can carry the service flow identifier, and the debug tag included in the service flow identifier is also transmitted along with the cross-device service flow call chain.
[0046] As shown in Table 1, the service flow identifier includes device ID (flag) (16bit), globally unique identifier (id) (48bit), parent-child relationship identifier (spanid) (32bit), parent-child relationship type (parent_spanid) (32bit), and debug flag (debug flag) (56bit).
[0047] Table 1
[0048] Device ID Globally Unique Identification Parent-Child Relationship Identification Parent-Child Relationship Type Debugging Tag 16 48 32 32 56
[0049] For example, such as Figure 4 As shown, Figure 4 This is a schematic diagram of a distributed service call tree provided in an embodiment of this application. The mobile phone transmits services to a large screen, and then the large screen continues to transmit services to the cloud. The service flow identifier (123456) is transmitted along with the service, and the debugging tag is also transmitted along with the service. Alternatively, the mobile phone can also transmit services to an audio device; the service flow identifier (123456) is transmitted along with the service, and the debugging tag is also transmitted along with the service. For example... Figure 5 As shown, Figure 5 This is a timing diagram of a distributed service provided in an embodiment of this application. First, the mobile phone transmits the service to the large screen; then, the large screen continues to transmit the service to the cloud; finally, the cloud transmits feedback information to the large screen, and the large screen transmits feedback information to the mobile phone. Alternatively, the mobile phone transmits the service to the speaker, and the speaker transmits feedback information to the mobile phone.
[0050] Optionally, the second device can establish a session debugging connection with the debugging server, and set a debugging tag at a remote interface call of the program code of the service on the second device through the established session debugging connection. Then the debugging server sends a debugging command to the second device, and the second device starts debugging of the program code of the service according to the debugging command. Further, single-step debugging can be performed on the program code.
[0051] S302, the second device stops debugging when the interface code of the first device is called in the service execution process.
[0052] Specifically, when the program code is executed to call the interface code of the first device in the service execution process, that is, the second device transmits the service to the first device by calling the interface code of the first device, the service flow on the second device is stopped, and the debugging of the second device is also stopped.
[0053] S303, the second device sends a first message to the first device, and the first message includes the debugging tag, and the debugging tag includes address information of the debugging server.
[0054] Optionally, the second device can send the first message to the first device through a distributed communication protocol. The first message can be a request message, for example, a message for requesting screen projection. The distributed communication protocol can be a remote procedure call protocol (RPC).
[0055] S304, the first device adds a function breakpoint at the program code corresponding to the application framework communication interface according to the debugging tag.
[0056] Optionally, the first message can also include communication interface information. The first device can determine the program code corresponding to the application framework communication interface according to the communication interface information corresponding to the first message sent by the second device. For example, if the second device sends the first message to the first device through WIFI, the first device receives the first message from the second device through the WIFI communication interface accordingly, and therefore, the first device can add a function breakpoint at the program code corresponding to the WIFI communication interface. For another example, if the second device sends the first message to the first device through a USB interface, the first device receives the first message from the second device through the USB interface accordingly, and therefore, the first device can add a function breakpoint at the program code corresponding to the USB interface.
[0057] Optionally, after receiving the debugging tag, when it is determined that the debugging tag indicates a debugging mode, the first device determines to debug the program code in the service execution process.
[0058] S305, the first device establishes a debugging session connection with the debugging server according to the address information.
[0059] Optionally, after adding the function breakpoint, the first device can send the identification of the first device and the called interface information to the debugging server through the second device. The debugging server detects whether the first device is available according to the identification of the first device, or checks whether the called interface of the first device is available according to the called interface information. If it is determined that the first device is available or the called interface is available, the debugging session connection is established with the first device.
[0060] S306, the first device starts debugging at the function breakpoint through the established debugging session connection.
[0061] Optionally, the debugging server can enter the calling code line at the function breakpoint of the first device. If the entering of the calling code line is successful, the first device can return an acknowledgement message to the debugging server, the acknowledgement message being used to indicate that the entering of the calling code line of the first device is successful, and the debugging server can start debugging on the first device.
[0062] Optionally, after the debugging server enters the calling code line at the function breakpoint of the first device, the function breakpoint can be deleted.
[0063] Optionally, after the service execution on the first device is completed, the debugging on the first device is also stopped. If the first device needs to call the interface code of the second device to continue the service flow, a second message can be sent to the second device. After receiving the second message, the second device starts to continue the service flow and continues to debug at the next line of the interface code of the first device. The second message can be a feedback message, for example, a message allowing screen projection. If the service execution on the first device is completed, the entire service flow is ended, and the debugging program code is stopped.
[0064] For example, as shown in FIG. 6, the first device 601 can send a first message to the second device 602, and the second device 602 can send a second message to the first device 601. Figure 6 Figure 6 is a schematic diagram of program code debugging. 1, a debugging server (for example, an IDE debugging tool) connects a debugged device A, sets a debugging flag for a specified distributed service (for example, remotely starts an application on a debugged device B), wherein the debugging flag includes the IP address of the IDE debugging tool. 2, the debugged device A starts a debugged process a, and the debugging flag is also set to the debugged process a. 3, the debugged device A calls the interface code of the debugged device B, sends the call information to the debugged device B through the distributed protocol, and transmits the debugging information at the same time. The debugging information can include the debugging flag. 4, the debugged device B determines the program code at the application framework communication interface according to the communication interface information of the debugged device A. If it is determined that the debugging flag indicates the debugging mode, a function breakpoint is set at the program code corresponding to the application framework communication interface. 5, start the debugged process b in the debugging mode, and notify the debugging client B to connect the IDE debugging tool. 6, the debugged device B obtains the IP address of the IDE debugging tool and establishes a debugging session connection with the IDE debugging tool. 7, the IDE debugging tool performs debugging on the debugged process b through the established debugging session connection, and starts single-step debugging at the function breakpoint. After the program code debugging on the debugged device B is completed, the next line of the interface code calling the debugged device B on the debugged device A can continue to be debugged.
[0065] In the embodiments of the present application, the second device sets a debugging flag at the remote interface call, and transmits the debugging flag to the first device through the communication protocol, so that the first device adds a function breakpoint at the program code corresponding to the application framework communication interface according to the debugging flag, and jumps to the function breakpoint of the first device to start debugging, thereby avoiding frequent switching of program codes, starting and stopping of the debugging server and other operations in the remote call process, without any interface adaptation, automatically completing the distributed cross-device debugging function, applicable to various application scenarios, improving the accuracy of program code debugging, and improving the efficiency of program code debugging.
[0066] It can be understood that the methods and operations implemented by the first device in each of the above method embodiments can also be implemented by components (such as chips or circuits) that can be used for the first device, and the methods and operations implemented by the second device can also be implemented by components (such as chips or circuits) that can be used for the second device.
[0067] The above mainly introduces the scheme provided by the embodiments of the present application from the perspective of each interaction. It can be understood that each network element, such as a transmitting end device or a receiving end device, contains a hardware structure and / or a software module for executing each function in order to implement the above functions. Those skilled in the art should realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is implemented in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0068] The embodiments of the present application can divide the function modules of the transmitting end device or the receiving end device according to the above method examples. For example, each function module can be divided according to each function, or two or more functions can be integrated in one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software function module. It should be noted that the division of the modules in the embodiments of the present application is illustrative, and is only a logical function division. In actual implementation, there can be another division manner. The following takes the division of each function module according to each function as an example for description.
[0069] The above, in combination with Figure 3 The method provided by the embodiments of the present application is described in detail. The following, in combination with Figure 7 to Figure 8 The program code debugging device provided by the embodiments of the present application is described in detail. It should be understood that the description of the device embodiments corresponds to the description of the method embodiments, and therefore, the content not described in detail can be referred to the above method embodiments. In order to be brief, it will not be described here.
[0070] As Figure 7 shown, Figure 7 is a structural schematic diagram of a program code debugging device provided by the embodiments of the present application. The program code debugging device can include a receiving module 701 and a sending module 703, and optionally, can further include a processing module 702. The receiving module 701 and the sending module 703 can communicate with the outside, and the processing module 702 is used for processing, such as adding a function breakpoint. The receiving module 701 and the sending module 703 can also be called a communication interface, a transceiving unit or a transceiving module. The receiving module 701 and the sending module 703 can be used to execute the actions performed by the first device in the above method embodiments.
[0071] For example: the receiving module 701 and the sending module 703 can also be called a transceiving module or a transceiving unit (including a receiving unit and / or a sending unit), respectively used to execute the steps of sending and receiving by the first device in the above method embodiments.
[0072] In a possible design, the program code debugging apparatus can implement the steps or procedures performed by the first device in the above method embodiments, for example, can be the first device, or a chip or circuit configured in the first device. The receiving module 701 and the sending module 703 are configured to perform the transceiving related operations of the first device in the above method embodiments, and the processing module 702 is configured to perform the processing related operations of the first device in the above method embodiments.
[0073] The receiving module 701 is configured to receive a first message sent by a second device, where the first message includes a debugging tag, the debugging tag includes address information of a debugging server, and the first message is sent by the second device after the second device stops debugging when invoking an interface code of the first device in a service execution process;
[0074] The processing module is configured to add a function breakpoint at program code corresponding to an application framework communication interface according to the debugging tag, establish a debugging session connection with the debugging server according to the address information, and start debugging at the function breakpoint through the established debugging session connection.
[0075] Optionally, the debugging tag is configured to indicate a debugging mode, and the debugging mode is to debug the program code in the service execution process.
[0076] Optionally, the processing module 702 is further configured to determine the program code corresponding to the application framework communication interface according to communication interface information corresponding to the first message sent by the second device.
[0077] Optionally, the receiving module 701 is further configured to receive the first message sent by the second device through a distributed communication protocol.
[0078] Optionally, the sending module 703 is configured to send a second message to the second device, where the second message is configured to instruct the second device to continue debugging at a next line of invoking the interface code of the first device.
[0079] Optionally, the sending module is configured to send debugging information to the debugging server through the established debugging session connection, where the debugging information is configured to prompt a user about a running situation of the program code.
[0080] Optionally, the debugging tag is included in a service flow identifier, and the service flow identifier is configured to identify the service.
[0081] It should be noted that the implementation of each module can also be correspondingly described with reference to the description of the method embodiments Figure 3 shown in the method embodiments, and the method and function performed by the first device in the above embodiments are implemented.
[0082] Please refer to Figure 8 , Figure 8 is a structural schematic diagram of a program code debugging apparatus provided by an embodiment of the present application. The program code debugging apparatus can include a sending module 801 and a receiving module 803, and optionally, a processing module 802. The receiving module 801 and the sending module 803 can communicate with the outside, and the processing module 802 is configured to perform processing, such as adding a function breakpoint. The sending module 801 and the receiving module 803 can also be referred to as a communication interface, a transceiver module or a transceiver unit. The sending module 801 and the receiving module 803 can be configured to perform the actions performed by the second device in the method embodiments described above.
[0083] For example, the sending module 801 and the receiving module 803 can also be referred to as a transceiver module or a transceiver unit (including a sending unit and / or a receiving unit), and are respectively configured to perform the steps of sending and receiving by the second device in the method embodiments described above.
[0084] In a possible design, the program code debugging apparatus can implement the steps or processes performed by the second device in the method embodiments described above, for example, the program code debugging apparatus can be a second device, or a chip or circuit configured in the second device. The sending module 801 and the receiving module 803 are configured to perform the transceiver-related operations of the second device in the method embodiments described above, and the processing module 802 is configured to perform the processing-related operations of the second device in the method embodiments described above.
[0085] The processing module 802 is configured to configure a debugging tag for a service, and start debugging.
[0086] The sending module 801 is configured to stop debugging when an interface code of the first device is called in a service execution process, and send a first message to the first device, where the first message includes the debugging tag, the debugging tag includes address information of a debugging server, the address information is used to establish a debugging session connection with the debugging server, and the debugging tag is used to instruct to add a function breakpoint at program code corresponding to a communication interface of an application framework, and start debugging at the function breakpoint through the established debugging session connection.
[0087] Optionally, the sending module 801 is further configured to send the first message to the first device through a distributed communication protocol.
[0088] Optionally, the receiving module 803 is configured to receive a second message of the first device, and the processing module 802 is further configured to continue debugging at a next line where the interface code of the first device is called.
[0089] Optionally, the debugging tag is included in a service flow identifier, and the service flow identifier is used to identify the service.
[0090] It should be noted that the implementation of each module can also correspond to the respective description of the method embodiment shown in Figure 3 The method and function performed by the second device in the above embodiment are executed.
[0091] Figure 9 is a structural schematic diagram of a first device provided by an embodiment of the present application. The first device can be applied to a system as shown in Figure 1 The functions of the first device in the above method embodiment are executed, or the steps or processes performed by the first device in the above method embodiment are implemented.
[0092] As shown in Figure 9 The first device includes a processor 901 and a transceiver 902. Optionally, the first device further includes a memory 903. The processor 901, the transceiver 902 and the memory 903 can communicate with each other through internal connection paths to transfer control and / or data signals. The memory 903 is used to store a computer program, and the processor 901 is used to call and run the computer program from the memory 903 to control the transceiver 902 to transceive signals. Optionally, the first device can further include an antenna for transmitting uplink data or uplink control signaling output by the transceiver 902 through wireless signals.
[0093] The processor 901 and the memory 903 can be combined into one processing device, and the processor 901 is used to execute the program code stored in the memory 903 to implement the above functions. In specific implementation, the memory 903 can be integrated in the processor 901 or independent of the processor 901. The processor 901 can correspond to the processing module in Figure 7
[0094] The above transceiver 902 can correspond to the receiving module and the sending module in Figure 7 , and can also be called a transceiving unit or a transceiving module. The transceiver 902 can include a receiver (or receiver, receiving circuit) and a transmitter (or transmitter, transmitting circuit). The receiver is used to receive signals, and the transmitter is used to transmit signals.
[0095] It should be understood that Figure 9 The first device shown in Figure 3 The first device shown in the method embodiment can implement each process involving the first device. The operation and / or function of each module in the first device is respectively implemented to realize the corresponding process in the above method embodiment. For details, please refer to the description in the above method embodiment, and the detailed description is appropriately omitted here to avoid repetition.
[0096] The processor 901 can be configured to perform the actions described in the foregoing method embodiments as implemented internally by the first device, and the transceiver 902 can be configured to perform the actions described in the foregoing method embodiments as transmitted by the first device to the second device or received from the second device. For details, refer to the descriptions in the foregoing method embodiments, which will not be repeated here.
[0097] The processor 901 can be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array, or other programmable logic device, transistor logic, hardware components, or any combination thereof. It can implement or execute the various exemplary logical blocks, modules, and circuits described in connection with the disclosure. The processor 901 can also be a combination of computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. The communication bus 904 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 The communication bus 904 is used to realize the connection and communication between the components. In the embodiments of the present application, the transceiver 902 is used for signaling or data communication with other node devices. The memory 903 can include volatile memory, such as non-volatile random access memory (NVRAM), phase change RAM (PRAM), magnetoresistive RAM (MRAM), etc., and can also include non-volatile memory, such as at least one magnetic disk storage device, electrically erasable programmable read-only memory (EEPROM), flash memory device, such as NOR flash memory or NAND flash memory, semiconductor device, such as solid state disk (SSD), etc. The memory 903 can also be at least one storage device located away from the processor 901. The memory 903 can also optionally store a set of computer program codes or configuration information. Optionally, the processor 901 can also execute the programs stored in the memory 903. The processor can cooperate with the memory and the transceiver to perform any of the methods and functions of the first device described in the foregoing embodiments.
[0098] Figure 10is a structural schematic diagram of a second device provided by an embodiment of the present application. The second device can be applied to a system as shown in Figure 1 to perform the functions of the second device in the above method embodiments, or to implement the steps or processes performed by the second device in the above method embodiments.
[0099] As shown in Figure 10 , the second device includes a processor 1001 and a transceiver 1002. Optionally, the second device further includes a memory 1003. The processor 1001, the transceiver 1002 and the memory 1003 can communicate with each other through internal connection paths, transfer control and / or data signals, the memory 1003 is used to store a computer program, the processor 1001 is used to call and run the computer program from the memory 1003 to control the transceiver 1002 to transceive signals. Optionally, the second device can also include an antenna for transmitting uplink data or uplink control signaling output by the transceiver 1002 through wireless signals.
[0100] The above processor 1001 and memory 1003 can be combined into one processing device, and the processor 1001 is used to execute the program code stored in the memory 1003 to realize the above functions. In specific implementation, the memory 1003 can also be integrated in the processor 1001, or independent of the processor 1001. The processor 1001 can correspond to the processing module in Figure 8 .
[0101] The above transceiver 1002 can correspond to the receiving module and the sending module in Figure 8 , and can also be called a transceiving unit or a transceiving module. The transceiver 1002 can include a receiver (or receiver, receiving circuit) and a transmitter (or transmitter, transmitting circuit). Among them, the receiver is used to receive signals, and the transmitter is used to transmit signals.
[0102] It should be understood that Figure 10 the second device as shown in Figure 3 can implement each process involving the second device in the method embodiments as shown in . The operation and / or function of each module in the second device is respectively to realize the corresponding flow in the above method embodiments. For details, please refer to the description in the above method embodiments, and appropriate detailed description is omitted here.
[0103] The above processor 1001 can be used to execute the actions implemented by the second device described in the above method embodiments, and the transceiver 1002 can be used to execute the actions of sending or receiving by the second device to or from the first device described in the above method embodiments. For details, please refer to the description in the above method embodiments, which will not be repeated here.
[0104] The processor 1001 can be any of the processors mentioned in the foregoing description, or any processor that is known now or to be developed in the future. The communication bus 1004 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, or any bus that is known now or to be developed in the future. The bus can be divided into an address bus, a data bus, a control bus, or the like. For ease of representation, Figure 10 The communication bus 1004 is used to realize the connection communication between the components. The transceiver 1002 of the device in the embodiments of the present application is used to communicate signaling or data with other devices. The memory 1003 can be any of the memories mentioned in the foregoing description. The memory 1003 can alternatively be at least one storage device located away from the aforementioned processor 1001. The memory 1003 stores a set of computer program codes or configuration information, and the processor 1001 executes the program in the memory 1003. The processor can cooperate with the memory and the transceiver to execute any of the methods and functions of the second device in the embodiments of the present application.
[0105] The embodiments of the present application also provide a chip system, which includes a processor, and is used to support the first device or the second device to implement the functions involved in any of the embodiments described above, for example, generating or processing the first message involved in the methods described above. In a possible design, the chip system can further include a memory, and the memory is used to store the computer programs and data necessary for the first device or the second device. The chip system can be composed of a chip, or can include a chip and other discrete devices. The input and output of the chip system correspond to the receiving and sending operations of the first device or the second device in the method embodiments, respectively.
[0106] The embodiments of the present application also provide a processing apparatus, which includes a processor and an interface. The processor can be used to execute the methods in the method embodiments.
[0107] It should be understood that the processing device described above can be a chip. For example, the processing device can be a field programmable gate array (FPGA), can be an application specific integrated circuit (ASIC), can also be a system on chip (SoC), can also be a central processor unit (CPU), can also be a network processor (NP), can also be a digital signal processor (DSP), can also be a micro controller unit (MCU), can also be a programmable logic device (PLD) or other integrated chip.
[0108] In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor or the instructions in the form of software. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as hardware processor execution completion, or executed by hardware and software modules in the processor. The software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, register and the like. The storage medium is located in the memory, and the processor reads the information in the memory, and combines the hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.
[0109] It should be noted that the processor in the embodiments of the present application can be an integrated circuit chip with a processing capability of signals. In the implementation process, each step of the method embodiments can be completed by the integrated logic circuit of hardware or the instruction in the form of software in the processor. The processor mentioned above can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory, and the processor reads the information in the memory and combines the hardware to complete the steps of the above method.
[0110] According to the method provided in the embodiments of the present application, the present application further provides a computer program product, which comprises a computer program, when the computer program runs on a computer, makes the computer execute Figure 3 the method of any one of the embodiments shown.
[0111] According to the method provided in the embodiments of the present application, the present application further provides a computer readable medium, which stores a computer program, when the computer program runs on a computer, makes the computer execute Figure 3 the method of any one of the embodiments shown.
[0112] According to the method provided in the embodiments of the present application, the present application further provides a system, which comprises one or more first devices and one or more second devices.
[0113] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (such as floppy disk, hard disk, magnetic tape), optical media (such as high-density digital video disc (digital video disc, DVD)), or semiconductor media (such as solid state disc (solid state disc, SSD)) and the like.
[0114] The functions, if implemented in the form of software function units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a second device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and various media that can store program codes.
[0115] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for debugging program code, characterized in that, include: The first device receives a first message sent by the second device. The first message includes a debug tag, which includes the address information of the debug server. The first message is sent by the second device after stopping debugging when it calls the interface code of the first device during business execution. The debug tag is included in the business flow identifier, which is used to identify the business and is transmitted with the business. The first device adds a function breakpoint at the program code corresponding to the application framework communication interface based on the debug tag; The first device establishes a debugging session connection with the debugging server based on the address information; The first device begins debugging at the function breakpoint through the established debugging session connection.
2. The method as described in claim 1, characterized in that, The debug label is used to indicate the debug mode, which is to debug the program code during the execution of the service.
3. The method as described in claim 1 or 2, characterized in that, Before the first device adds a function breakpoint at the program code corresponding to the application framework communication interface based on the debug tag, it also includes: The first device determines the program code corresponding to the application framework communication interface based on the communication interface information corresponding to the first message sent by the second device.
4. The method as described in claim 1 or 2, characterized in that, The application messages received by the first device from the second device include: The first device receives the first message sent by the second device through a distributed communication protocol.
5. The method as described in claim 1 or 2, characterized in that, The method further includes: The first device sends a second message to the second device, which instructs the second device to continue debugging on the next line of the interface code that calls the first device.
6. The method as described in claim 1 or 2, characterized in that, The method further includes: The first device sends debugging information to the debugging server through the established debugging session connection. The debugging information is used to inform the user about the running status of the program code.
7. A method for debugging program code, characterized in that, include: The second device is configured with a debug tag for the service and debug is started. When the second device calls the interface code of the first device during the execution of the service, it stops debugging and sends a first message to the first device. The first message includes the debugging tag, which includes the address information of the debugging server. The address information is used to establish a debugging session connection with the debugging server. The debugging tag is used to indicate that a function breakpoint is added at the program code corresponding to the application framework communication interface and that debugging begins at the function breakpoint through the established debugging session connection. The debugging tag is included in the service flow identifier, which is used to identify the service and is transmitted with the service.
8. The method as described in claim 7, characterized in that, Sending the first message to the first device includes: The second device sends the first message to the first device via a distributed communication protocol.
9. The method as described in claim 7 or 8, characterized in that, The method further includes: The second device receives the second message from the first device; The second device continues debugging on the next line after calling the interface code of the first device.
10. A program code debugging device, characterized in that, include: The receiving module is used to receive a first message sent by the second device. The first message includes a debugging tag, which includes the address information of the debugging server. The first message is sent by the second device after stopping debugging when it calls the interface code of the first device during business execution. The debugging tag is included in the business flow identifier, which is used to identify the business and is transmitted along with the business. The processing module is used to add function breakpoints at the program code corresponding to the application framework communication interface based on the debug tag; Based on the address information, establish a debugging session connection with the debugging server; Debugging begins at the function breakpoint via the established debugging session connection.
11. The apparatus as claimed in claim 10, characterized in that, The debug label is used to indicate the debug mode, which is to debug the program code during the execution of the service.
12. The apparatus as claimed in claim 10 or 11, characterized in that, The processing module is further configured to determine the program code corresponding to the application framework communication interface based on the communication interface information corresponding to the first message sent by the second device.
13. The apparatus as claimed in claim 10 or 11, characterized in that, The receiving module is further configured to receive the first message sent by the second device through a distributed communication protocol.
14. The apparatus as claimed in claim 10 or 11, characterized in that, The device further includes: The sending module is used to send a second message to the second device, the second message being used to instruct the second device to continue debugging on the next line of the interface code that calls the first device.
15. The apparatus as claimed in claim 10 or 11, characterized in that, The device further includes: The sending module is used to send debugging information to the debugging server through the established debugging session connection. The debugging information is used to prompt the user about the running status of the program code.
16. A program code debugging device, characterized in that, include: The processing module is used to configure debug tags for business applications and initiate debugging. The sending module is used to stop debugging when the interface code of the first device is called during the execution of the service, and to send a first message to the first device. The first message includes the debugging tag, the debugging tag includes the address information of the debugging server, the address information is used to establish a debugging session connection with the debugging server, the debugging tag is used to indicate that a function breakpoint is added at the program code corresponding to the application framework communication interface, and debugging is started at the function breakpoint through the established debugging session connection. The debugging tag is included in the service flow identifier, the service flow identifier is used to identify the service, and the service flow identifier follows the service transmission.
17. The apparatus as claimed in claim 16, characterized in that, The sending module is further configured to send the first message to the first device via a distributed communication protocol.
18. The apparatus as claimed in claim 16 or 17, characterized in that, The device further includes: The receiving module is used to receive the second message from the first device; The processing module is also used to continue debugging on the next line after the interface code that calls the first device.
19. A program code debugging device, characterized in that, The device includes a processor and a memory for storing a computer program, the processor running the computer program to cause the device to perform the method of any one of claims 1-6 or any one of claims 7-9.
20. A chip, characterized in that, The chip is a chip within a first device or a second device. The chip includes a processor and an input interface and an output interface connected to the processor. The chip also includes a memory. When a computer program in the memory is executed, the method of any one of claims 1-6 or any one of claims 7-9 is executed.
21. A computer-readable storage medium, characterized in that, Used to store computer programs that, when run on a computer, cause the computer to perform the method of any one of claims 1-6 or any one of claims 7-9.
22. A computer program product, characterized in that, The computer program product includes a computer program that, when run on a computer, causes the computer to perform the method of any one of claims 1-6 or any one of claims 7-9.
23. A communication system, characterized in that, The system includes a first device and a second device, wherein the first device performs the method of any one of claims 1-6, and the second device performs the method of any one of claims 7-9.
Citation Information
Patent Citations
Method and device for debugging application programs
CN101546289A