CN114338840A - Socket-based remote debugging method - Google Patents
Socket-based remote debugging method Download PDFInfo
- Publication number
- CN114338840A CN114338840A CN202111318650.7A CN202111318650A CN114338840A CN 114338840 A CN114338840 A CN 114338840A CN 202111318650 A CN202111318650 A CN 202111318650A CN 114338840 A CN114338840 A CN 114338840A
- Authority
- CN
- China
- Prior art keywords
- debugging
- client
- server
- software
- tested
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 21
- 238000004891 communication Methods 0.000 claims abstract description 22
- 238000012544 monitoring process Methods 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 9
- 230000003068 static effect Effects 0.000 claims description 6
- 230000002452 interceptive effect Effects 0.000 claims description 3
- 238000013507 mapping Methods 0.000 claims description 3
- 238000013461 design Methods 0.000 abstract description 2
- 238000012827 research and development Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a socket-based remote debugging method, which comprises the following steps: s1: embedding a client and a server together into a software code to be delivered, loading code information of the client and the server in a dynamic debugging library file, and configuring ports for socket communication at two ends through a parameter file; s2: and acquiring a debug Server monomorph handle, and keeping the debug Server unique in the global scope so as to ensure that the dynamic parameter setting returned by the client can be applied to the same server. The method and the system have reasonable design, and can realize the delivery together by embedding the client and the server together into the software code to be delivered and carrying out remote background debugging on the software which is continuously delivered, so that a user does not need to additionally deploy a debugging server environment, the operation of personnel is facilitated, the complexity of remote continuous deployment is simplified, the debugging cost is reduced, and the use requirement is met.
Description
Technical Field
The invention relates to the technical field of socket remote debugging, in particular to a socket-based remote debugging method.
Background
In the industry of the practitioners working in writing, there are delivery scenes that a construction period is short, a project A is in a different place, and research and development personnel cannot debug a small software system at a long-term place, the project A usually requires the delivery of a software prototype by the B in a very short time and assists the project A to capture the actual requirements of the project and then to update the project in a fast and iterative manner, meanwhile, the simulation test of the software is very difficult to realize by the research and development personnel, the test needs to be carried out in the actual production environment, the development environment of the research and development personnel is also difficult to erect in the project A, and the engineering deployment personnel and the project A cannot capture the detailed site of the relevant software in real time on site, so that remote debugging software is needed, the integrated development environment of the existing remote debugging software is expensive, corresponding debug server software needs to be installed on a target machine, and the delivered software needs to be recompiled, embedded and debugged again, the target machine needs to deploy the debugging server and then operate the software again, operation and debugging are tedious, the use requirements cannot be met, and improvement is made on the problems.
Disclosure of Invention
Based on the technical problems in the background art, the invention provides a socket-based remote debugging method.
The socket-based remote debugging method provided by the invention comprises the following steps of:
s1: embedding a client and a server together into a software code to be delivered, loading code information of the client and the server in a dynamic debugging library file, and configuring ports for socket communication at two ends through a parameter file;
s2: acquiring a debug Server single-state handle, and in order to keep the debug Server unique in the global scope, ensuring that the dynamic parameter setting returned by the client can be applied to the same server end, wherein the debug Server realizes a single-state mode;
s3, entering a software process module to be tested, finding out a program segment which is highly easy to be wrong, and setting a field printing statement by using the tool so as to achieve the aim of field or remote debugging;
s4, setting dynamic debugging switch options according to the site printing statement in S3, then debugging and calling a debug Server, sending auxiliary information such as environment variables of a code site through a debug Server single-state handle in S2, and according to the setting, the debugging and calling may suspend the program to be tested to enable the program to be tested to be in a state similar to pause, so as to wait for further indication of the client;
s5: the client side in the step S4 judges whether to continue debugging, if not, the debugging is ended, and if the debugging is continued, the client side circularly enters other parts of the software to be tested and sets a debugging statement in a suitable place to repeat the above process until the program to be tested exits;
s6: after being loaded by the software to be tested, receiving a caller to load an initialization library, creating a debug Server single-state handle and returning the debug Server single-state handle to the caller;
s7: the debug server first tries to load the configuration file from the dynamic library file directory in S1 and initializes each debug option;
s8: starting a Server thread, circularly monitoring client connection through the socket communication port in S1, allocating a handle representing a client for each connected client, and starting a communication thread for monitoring and processing messages;
s9: after the communication thread is started, entering a circular monitoring communication channel to monitor the message from the real debugging client, analyzing the obtained message and respectively calling the corresponding debugging function of the debug Server;
s10: judging whether the client is disconnected, if so, recovering the channel resource and removing the corresponding client handle and finishing the channel thread, and if not, returning to the step S9 again to continue monitoring the message from the real debugging client in the communication channel;
s11: next, debugging the client, loading the dynamic debugging library file, wherein the debugging client can be realized by using a command line or a graphical interface, and the loading of the dynamic debugging library in the S1 realizes a simple command line client, so that a user can use the simple command line in the command line by only using a few lines of codes;
s12: newly establishing a client class, loading a client parameter file, and connecting a server end of the software to be tested by using a server address and a port in a configuration file;
s13: starting a client channel thread, processing communication by using an independent thread for a channel connected to a server, and processing debugging information lost by a server in the channel;
s14: waiting for a client to input a debugging instruction, sending the debugging instruction to a server end, if the interruption to-be-tested software is configured in a configuration file or the interruption instruction is sent to the server end by using a debugging instruction mode, the server end enters an interruption waiting state, at the moment, the client needs to send other debugging instructions or set or print dynamic variables of the to-be-tested software, and finally, the to-be-tested software can continue to execute subsequent programs only by inputting an interruption finishing instruction;
s15: and judging whether to end the client.
Preferably, in S4, most of the debug switches will be present as parameter files accompanying the tool delivery dynamic library, and it is necessary to guide the configuration of the field engineer or the client engineer when performing remote debugging.
Preferably, in S12, the parameter file includes a static configuration file and a server-side configuration file, and the static configuration file and the server-side configuration file are the same file, and a debugging person is required to remotely assist or issue configuration to a field engineer during debugging.
Preferably, in S1, the client may connect to the server locally or remotely, view real-time debugging information or perform interactive debugging, where the server needs to configure the port mapping of the delivery software field network environment first.
Preferably, in S1, the information is broadcast to all clients connected to the server, and the debugging information may be written into a log file according to the configuration.
Compared with the prior art, the invention has the beneficial effects that:
the method and the system have reasonable design, and can realize the delivery together by embedding the client and the server together into the software code to be delivered and carrying out remote background debugging on the software which is continuously delivered, so that a user does not need to additionally deploy a debugging server environment, the operation of personnel is facilitated, the complexity of remote continuous deployment is simplified, the debugging cost is reduced, and the use requirement is met.
Drawings
Fig. 1 is a flowchart of a to-be-tested software end of a socket-based remote debugging method according to the present invention;
FIG. 2 is a flow chart of a dynamic library of the socket-based remote debugging method of the present invention;
fig. 3 is a client-side flowchart of the socket-based remote debugging method according to the present invention.
Detailed Description
The present invention will be further illustrated with reference to the following specific examples.
Examples
Referring to fig. 1 to 3, the present embodiment provides a socket-based remote debugging method, including the following steps:
s1: the method comprises the steps that a client and a server are embedded into a software code to be delivered together, code information of the client and the server in a dynamic debugging library file is loaded, ports for socket communication at two ends are configured through a parameter file, the client can be connected to the server locally or remotely, real-time debugging information is checked or interactive debugging is carried out, wherein the server needs to configure port mapping of a delivery software field network environment first, the information is sent to all clients connected to the server through broadcasting, and the debugging information can be written into a log file according to configuration;
s2: acquiring a debug Server single-state handle, and in order to keep the debug Server unique in the global scope, ensuring that the dynamic parameter setting returned by the client can be applied to the same server end, wherein the debug Server realizes a single-state mode;
s3, entering a software process module to be tested, finding out a program segment which is highly easy to be wrong, and setting a field printing statement by using the tool so as to achieve the aim of field or remote debugging;
s4, setting dynamic debugging switch options according to the site printing statement in S3, then debugging and calling a debug Server, sending auxiliary information such as environment variables of a code site out through a debug Server monomorph handle in S2, wherein the debugging and calling may suspend the program to be tested to enable the program to be tested to be in a state similar to pause according to the setting, so as to wait for further indication of a client, wherein part of the debugging switches exist as parameter files attached to the tool delivery dynamic library, and a site engineer or a client engineer needs to be guided to configure when in remote debugging;
s5: the client side in the step S4 judges whether to continue debugging, if not, the debugging is ended, and if the debugging is continued, the client side circularly enters other parts of the software to be tested and sets a debugging statement in a suitable place to repeat the above process until the program to be tested exits;
s6: after being loaded by the software to be tested, receiving a caller to load an initialization library, creating a debug Server single-state handle and returning the debug Server single-state handle to the caller;
s7: the debug server first tries to load the configuration file from the dynamic library file directory in S1 and initializes each debug option;
s8: starting a Server thread, circularly monitoring client connection through the socket communication port in S1, allocating a handle representing a client for each connected client, and starting a communication thread for monitoring and processing messages;
s9: after the communication thread is started, entering a circular monitoring communication channel to monitor the message from the real debugging client, analyzing the obtained message and respectively calling the corresponding debugging function of the debug Server;
s10: judging whether the client is disconnected, if so, recovering the channel resource and removing the corresponding client handle and finishing the channel thread, and if not, returning to the step S9 again to continue monitoring the message from the real debugging client in the communication channel;
s11: next, debugging the client, loading the dynamic debugging library file, wherein the debugging client can be realized by using a command line or a graphical interface, and the loading of the dynamic debugging library in the S1 realizes a simple command line client, so that a user can use the simple command line in the command line by only using a few lines of codes;
s12: newly creating a client class, loading a client parameter file, connecting a server end of the software to be tested by using a server address and a port in a configuration file, wherein the parameter file comprises a static configuration file and a server end configuration file, the static configuration file and the server end configuration file are the same file, and debugging personnel are required to remotely assist or release and configure the file to a field engineer during debugging;
s13: starting a client channel thread, processing communication by using an independent thread for a channel connected to a server, and processing debugging information lost by a server in the channel;
s14: waiting for a client to input a debugging instruction, sending the debugging instruction to a server end, if the interruption to-be-tested software is configured in a configuration file or the interruption instruction is sent to the server end by using a debugging instruction mode, the server end enters an interruption waiting state, at the moment, the client needs to send other debugging instructions or set or print dynamic variables of the to-be-tested software, and finally, the to-be-tested software can continue to execute subsequent programs only by inputting an interruption finishing instruction;
s15: and judging whether to end the client.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention should be equivalent or changed within the scope of the present invention.
Claims (5)
1. The socket-based remote debugging method is characterized by comprising the following steps of:
s1: embedding a client and a server together into a software code to be delivered, loading code information of the client and the server in a dynamic debugging library file, and configuring ports for socket communication at two ends through a parameter file;
s2: acquiring a debug Server single-state handle, and in order to keep the debug Server unique in the global scope, ensuring that the dynamic parameter setting returned by the client can be applied to the same server end, wherein the debug Server realizes a single-state mode;
s3, entering a software process module to be tested, finding out a program segment which is highly easy to be wrong, and setting a field printing statement by using the tool so as to achieve the aim of field or remote debugging;
s4, setting dynamic debugging switch options according to the site printing statement in S3, then debugging and calling a debug Server, sending auxiliary information such as environment variables of a code site through a debug Server single-state handle in S2, and according to the setting, the debugging and calling may suspend the program to be tested to enable the program to be tested to be in a state similar to pause, so as to wait for further indication of the client;
s5: the client side in the step S4 judges whether to continue debugging, if not, the debugging is ended, and if the debugging is continued, the client side circularly enters other parts of the software to be tested and sets a debugging statement in a suitable place to repeat the above process until the program to be tested exits;
s6: after being loaded by the software to be tested, receiving a caller to load an initialization library, creating a debug Server single-state handle and returning the debug Server single-state handle to the caller;
s7: the debug server first tries to load the configuration file from the dynamic library file directory in S1 and initializes each debug option;
s8: starting a Server thread, circularly monitoring client connection through the socket communication port in S1, allocating a handle representing a client for each connected client, and starting a communication thread for monitoring and processing messages;
s9: after the communication thread is started, entering a circular monitoring communication channel to monitor the message from the real debugging client, analyzing the obtained message and respectively calling the corresponding debugging function of the debug Server;
s10: judging whether the client is disconnected, if so, recovering the channel resource and removing the corresponding client handle and finishing the channel thread, and if not, returning to the step S9 again to continue monitoring the message from the real debugging client in the communication channel;
s11: next, debugging the client, loading the dynamic debugging library file, wherein the debugging client can be realized by using a command line or a graphical interface, and the loading of the dynamic debugging library in the S1 realizes a simple command line client, so that a user can use the simple command line in the command line by only using a few lines of codes;
s12: newly establishing a client class, loading a client parameter file, and connecting a server end of the software to be tested by using a server address and a port in a configuration file;
s13: starting a client channel thread, processing communication by using an independent thread for a channel connected to a server, and processing debugging information lost by a server in the channel;
s14: waiting for a client to input a debugging instruction, sending the debugging instruction to a server end, if the interruption to-be-tested software is configured in a configuration file or the interruption instruction is sent to the server end by using a debugging instruction mode, the server end enters an interruption waiting state, at the moment, the client needs to send other debugging instructions or set or print dynamic variables of the to-be-tested software, and finally, the to-be-tested software can continue to execute subsequent programs only by inputting an interruption finishing instruction;
s15: and judging whether to end the client.
2. The socket-based remote debugging method of claim 1, wherein in S4, most debugging switches will exist as parameter files accompanying the tool delivery dynamic library, and it is necessary to guide a field engineer or a customer engineer to configure the debugging switches when remotely debugging.
3. The socket-based remote debugging method of claim 1, wherein in S12, the parameter file includes a static configuration file and a server-side configuration file, and the static configuration file and the server-side configuration file are the same file, and debugging personnel is required to remotely assist or issue configuration to a field engineer.
4. The socket-based remote debugging method of claim 1, wherein in S1, the client may connect to the server locally or remotely to check real-time debugging information or perform interactive debugging, wherein the server needs to configure a port mapping of the delivery software field network environment.
5. The socket-based remote debugging method of claim 1, wherein in S1, the information is broadcast to all clients connected to the server, and the debugging information can be written into a log file according to configuration.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111318650.7A CN114338840B (en) | 2021-11-08 | 2021-11-08 | Socket-based remote debugging method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111318650.7A CN114338840B (en) | 2021-11-08 | 2021-11-08 | Socket-based remote debugging method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114338840A true CN114338840A (en) | 2022-04-12 |
CN114338840B CN114338840B (en) | 2024-03-22 |
Family
ID=81045672
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111318650.7A Active CN114338840B (en) | 2021-11-08 | 2021-11-08 | Socket-based remote debugging method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114338840B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114745418A (en) * | 2022-04-14 | 2022-07-12 | 北京字节跳动网络技术有限公司 | Task access method, device, equipment and storage medium |
CN114822055A (en) * | 2022-06-06 | 2022-07-29 | 深圳英博达智能科技有限公司 | Intelligent traffic road cooperation system based on machine vision detection |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108363661A (en) * | 2018-01-04 | 2018-08-03 | 郑州云海信息技术有限公司 | A kind of output implementation method by all kinds of means of application layer code Debugging message |
US20200322317A1 (en) * | 2019-04-03 | 2020-10-08 | Sling Media Pvt Ltd | Systems and methods for establishing secure remote connections to media devices |
CN112398897A (en) * | 2020-04-24 | 2021-02-23 | 江南大学 | Wireless remote-controlled robot system design scheme based on Socket communication |
CN112636966A (en) * | 2020-12-18 | 2021-04-09 | 中国人民解放军国防科技大学 | Application batch deployment method based on remote debugging protocol |
-
2021
- 2021-11-08 CN CN202111318650.7A patent/CN114338840B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108363661A (en) * | 2018-01-04 | 2018-08-03 | 郑州云海信息技术有限公司 | A kind of output implementation method by all kinds of means of application layer code Debugging message |
US20200322317A1 (en) * | 2019-04-03 | 2020-10-08 | Sling Media Pvt Ltd | Systems and methods for establishing secure remote connections to media devices |
CN112398897A (en) * | 2020-04-24 | 2021-02-23 | 江南大学 | Wireless remote-controlled robot system design scheme based on Socket communication |
CN112636966A (en) * | 2020-12-18 | 2021-04-09 | 中国人民解放军国防科技大学 | Application batch deployment method based on remote debugging protocol |
Non-Patent Citations (1)
Title |
---|
马如远: "基于C/S结构的远程维护调试系统", 《机电工程》, vol. 24, no. 4 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114745418A (en) * | 2022-04-14 | 2022-07-12 | 北京字节跳动网络技术有限公司 | Task access method, device, equipment and storage medium |
CN114822055A (en) * | 2022-06-06 | 2022-07-29 | 深圳英博达智能科技有限公司 | Intelligent traffic road cooperation system based on machine vision detection |
CN114822055B (en) * | 2022-06-06 | 2023-06-09 | 深圳英博达智能科技有限公司 | Intelligent traffic road cooperation system based on machine vision detection |
Also Published As
Publication number | Publication date |
---|---|
CN114338840B (en) | 2024-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114338840A (en) | Socket-based remote debugging method | |
US6662312B1 (en) | Software-testing automation system | |
CN111159049B (en) | Automatic interface testing method and system | |
CN107241315B (en) | Access method and device of bank gateway interface and computer readable storage medium | |
CN104461897A (en) | Application program test method and device | |
CN105512029A (en) | Method, server and system for testing intelligent terminal | |
CN109408310B (en) | Debugging method of server, server and readable storage medium | |
CN108170494B (en) | Application program starting method and starting system for intelligent terminal | |
CN112463144A (en) | Distributed storage command line service method, system, terminal and storage medium | |
CN111666217B (en) | Method and apparatus for testing code | |
CN113986270B (en) | Distributed application deployment method and device, storage medium and electronic equipment | |
KR100794130B1 (en) | Automatic Function Testing Equipment for Application Software and Additional Service of Mobile Communication Terminal | |
CN111193638A (en) | Linux platform based network card automatic testing method and device | |
CN106161409A (en) | A kind of agent framework service system including local component and method | |
CN115357258B (en) | Application deployment method and device, storage medium and electronic device | |
CN112988267A (en) | Loading method and device, storage medium and electronic equipment | |
US10216619B2 (en) | System and method for test automation using a decentralized self-contained test environment platform | |
CN114095343A (en) | Disaster recovery method, device, equipment and storage medium based on double-active system | |
CN113961504A (en) | Mobile terminal group control method, device, system, server and storage medium | |
CN110389886B (en) | Additional function testing method and device of main application program and storage medium | |
CN113424153A (en) | Automatic operation and maintenance method and device | |
CN107220149B (en) | Method and system for capturing debugging data of wireless communication module in Linux system under Windows | |
CN111488264A (en) | Deployment scheduling method for interface performance test cluster | |
CN112433938A (en) | Method and device for testing application of mobile terminal | |
CN112671814A (en) | Cross-platform equipment development method, device and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |