CN112256570B - Remote debugging method, device, equipment and storage medium - Google Patents

Remote debugging method, device, equipment and storage medium Download PDF

Info

Publication number
CN112256570B
CN112256570B CN202011121825.0A CN202011121825A CN112256570B CN 112256570 B CN112256570 B CN 112256570B CN 202011121825 A CN202011121825 A CN 202011121825A CN 112256570 B CN112256570 B CN 112256570B
Authority
CN
China
Prior art keywords
debugging
breakpoint
identification
client
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011121825.0A
Other languages
Chinese (zh)
Other versions
CN112256570A (en
Inventor
梅立琴
戚明锋
袁定波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202011121825.0A priority Critical patent/CN112256570B/en
Publication of CN112256570A publication Critical patent/CN112256570A/en
Application granted granted Critical
Publication of CN112256570B publication Critical patent/CN112256570B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3632Software debugging of specific synchronisation aspects

Landscapes

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

Abstract

The application provides a remote debugging method, a device, equipment and a storage medium, which are applied to the technical field of computers, and the method comprises the following steps: the method comprises the steps that at least one breakpoint corresponding to a user problem of a target application program is set in source codes of the target application program by debugging equipment, the debugging equipment obtains a debugging instruction according to identification of the at least one breakpoint and sends the debugging instruction to a client, if the target application program runs to any one of the at least one breakpoint, the client obtains debugging information of the breakpoint, the debugging information is sent to the debugging equipment, and the debugging equipment debugs the target application program according to the debugging information so as to locate the user problem. According to the application, the corresponding breakpoint is set according to the user problem, and the target application program is debugged according to the debugging information at the breakpoint, so that the exact source and specific reason of the user problem can be positioned from the source code angle.

Description

Remote debugging method, device, equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a remote debugging method, apparatus, device, and storage medium.
Background
With the rapid development of computer technology, software applications are increasingly being installed on user terminals by users to meet application requirements of different fields and different problems, such as shopping, games, video, etc.
In the prior art, some problems often occur in the process of using a software application, such as flashing, blocking, page white screen, etc., in order to solve the user problem, a developer needs to reproduce and check the user problem to locate the cause of the problem, and usually adopts an APM SDK method to capture the report of the abnormal state of the running software application, thereby locating the problem of crashing and blocking.
However, the above method can only locate performance problems, but cannot locate some non-performance problems, such as a white screen page, loading failure, and wrong game image display, which can be fed back by the user.
Disclosure of Invention
The application aims to provide a remote debugging method, a device, equipment and a storage medium for realizing the positioning of user problems aiming at the defects in the prior art.
In order to achieve the above purpose, the technical scheme adopted by the embodiment of the application is as follows:
In a first aspect, an embodiment of the present application provides a remote debugging method, where the method includes:
receiving a debugging instruction sent by debugging equipment, wherein the debugging instruction is a debugging instruction aiming at a user problem of a target application program, and the debugging instruction comprises an identification of at least one breakpoint;
if the target application program runs to any breakpoint in the at least one breakpoint, obtaining debugging information of the breakpoint;
and sending the debugging information to the debugging equipment, wherein the debugging equipment is used for debugging the target application program according to the debugging information.
Optionally, if the target application program runs to any breakpoint of the at least one breakpoint, obtaining debug information of the breakpoint includes:
if the target application program runs to the breakpoint, acquiring execution information corresponding to the breakpoint, wherein the execution information is used for indicating the position of the breakpoint in the source code;
acquiring a call stack of the breakpoint according to the execution information;
acquiring a parameter value of a stack top variable in the call stack, wherein the stack top variable is a stack top variable in the call stack;
and determining the parameter value of the stack top variable as the debugging information.
Optionally, the obtaining the parameter value of the stack top variable in the call stack includes:
and if the data type of the stack top variable is the first data type, acquiring a parameter value of the stack top variable by adopting a parameter acquisition instruction.
Optionally, the obtaining the parameter value of the stack top variable in the call stack includes:
if the data type of the stack top variable is the second data type, acquiring the reference information of the stack top variable by adopting a reference information acquisition instruction;
acquiring a field corresponding to the stack top variable according to the reference information;
acquiring a parameter value of a field by adopting a field parameter acquisition instruction;
and determining the parameter value of the field as the parameter value of the stack top variable.
Optionally, before receiving the debug instruction sent by the debug device, the method further includes:
acquiring a class reference identifier according to a class reference identifier acquisition instruction sent by a received debugging device, and sending the class reference identifier to the debugging device, wherein the class reference identifier acquisition instruction comprises a class signature corresponding to the user problem in a source code;
acquiring at least one method identifier corresponding to the class reference identifier according to a received method identifier acquisition instruction sent by the debugging equipment, and sending the at least one method identifier to the debugging equipment, wherein the method identifier acquisition instruction comprises the class reference identifier;
Acquiring the identification of at least one breakpoint according to a breakpoint identification acquisition instruction sent by the received debugging equipment, and sending the identification of the at least one breakpoint to the debugging equipment, wherein the breakpoint identification acquisition instruction comprises the class reference identification, a target method identification in the at least one method identification and an identification of a preset code row corresponding to the target method identification.
Optionally, the execution information includes at least one of the following information:
the event type corresponding to the breakpoint, the identification number of the breakpoint in the at least one breakpoint, the thread number of the breakpoint, and the position information of the breakpoint in the corresponding call stack.
Optionally, the receiving the debug instruction sent by the debug device includes:
and receiving the debugging instruction through a debugger in the client, wherein the debugger is used for packaging the debugging instruction according to a preset interaction protocol, and sending the packaged debugging instruction to a virtual machine in the client.
Optionally, the receiving, by a debugger in the client, the debug instruction includes:
according to the received remote debugging starting operation, starting the remote debugging function of the client;
And when the client starts a remote debugging function and the debugger and the virtual machine handshake succeed, receiving the debugging instruction through the debugger in the client.
Optionally, the sending the debug information to the debug apparatus includes:
and sending the debugging information to the debugger through the virtual machine, wherein the debugger is used for unpacking the debugging information according to a preset interaction protocol and sending the unpacked debugging information to the debugging equipment.
In a second aspect, another embodiment of the present application provides a remote debugging method, applied to a debugging device, the method comprising:
setting at least one breakpoint corresponding to a user problem of the target application program in source code of the target application program;
acquiring a debugging instruction according to the identification of the at least one breakpoint, and sending the debugging instruction to a client;
receiving debugging information of any breakpoint in the at least one breakpoint sent by the client;
and debugging the target application program according to the debugging information so as to locate the user problem.
Optionally, the setting at least one breakpoint corresponding to the user problem of the target application program in the source code of the target application program includes:
Acquiring a class signature corresponding to the user problem in a source code, and sending a class reference identifier acquisition instruction to the client, wherein the class reference identifier acquisition instruction comprises the class signature;
receiving a class reference identifier sent by the client, and sending a method identifier acquisition instruction to the client, wherein the method identifier acquisition instruction comprises the class reference identifier;
receiving at least one method identifier corresponding to the class reference identifier sent by the client, and determining a target method identifier from the at least one method identifier;
sending a breakpoint identification acquisition instruction to the client, wherein the breakpoint identification acquisition instruction comprises the class reference identification, the target method identification and the identification of a preset code row corresponding to the target method identification;
and setting at least one breakpoint corresponding to the user problem in the source code according to the received identification of the at least one breakpoint.
In a third aspect, another embodiment of the present application provides a remote debugging device, the device comprising:
the receiving module is used for receiving a debugging instruction sent by the debugging equipment, wherein the debugging instruction is a debugging instruction aiming at the user problem of the target application program, and the debugging instruction comprises at least one breakpoint mark;
The processing module is used for setting at least one breakpoint corresponding to the user problem in the source code of the target application program according to the debugging instruction;
the acquisition module is used for acquiring debugging information of any breakpoint in the at least one breakpoint when the target application program runs to the breakpoint;
the transmitting module is used for transmitting the debugging information to the debugging equipment, and the debugging equipment is used for debugging the target application program according to the debugging information.
Optionally, the acquiring module is specifically configured to:
if the target application program runs to the breakpoint, acquiring execution information corresponding to the breakpoint, wherein the execution information is used for indicating the position of the breakpoint in the source code;
acquiring a call stack of the breakpoint according to the execution information;
acquiring a parameter value of a stack top variable in the call stack, wherein the stack top variable is a stack top variable in the call stack;
and determining the parameter value of the stack top variable as the debugging information.
Optionally, the acquiring module is specifically configured to:
and if the data type of the stack top variable is the first data type, acquiring a parameter value of the stack top variable by adopting a parameter acquisition instruction.
Optionally, the acquiring module is specifically configured to:
if the data type of the stack top variable is the second data type, acquiring the reference information of the stack top variable by adopting a reference information acquisition instruction;
acquiring a field corresponding to the stack top variable according to the reference information;
acquiring a parameter value of a field by adopting a field parameter acquisition instruction;
and determining the parameter value of the field as the parameter value of the stack top variable.
Optionally, the acquiring module is further configured to:
acquiring a class reference identifier according to a class reference identifier acquisition instruction sent by a received debugging device, and sending the class reference identifier to the debugging device, wherein the class reference identifier acquisition instruction comprises a class signature corresponding to the user problem in a source code;
acquiring at least one method identifier corresponding to the class reference identifier according to a received method identifier acquisition instruction sent by the debugging equipment, and sending the at least one method identifier to the debugging equipment, wherein the method identifier acquisition instruction comprises the class reference identifier;
acquiring the identification of at least one breakpoint according to a breakpoint identification acquisition instruction sent by the received debugging equipment, and sending the identification of the at least one breakpoint to the debugging equipment, wherein the breakpoint identification acquisition instruction comprises the class reference identification, a target method identification in the at least one method identification and an identification of a preset code row corresponding to the target method identification.
Optionally, the execution information includes at least one of the following information:
the event type corresponding to the breakpoint, the identification number of the breakpoint in the at least one breakpoint, the thread number of the breakpoint, and the position information of the breakpoint in the corresponding call stack.
Optionally, the receiving module is specifically configured to:
and receiving the debugging instruction through a debugger in the client, wherein the debugger is used for packaging the debugging instruction according to a preset interaction protocol, and sending the packaged debugging instruction to a virtual machine in the client.
Optionally, the receiving module is specifically configured to:
according to the received remote debugging starting operation, starting the remote debugging function of the client;
and when the client starts a remote debugging function and the debugger and the virtual machine handshake succeed, receiving the debugging instruction through the debugger in the client.
Optionally, the sending module is specifically configured to:
and sending the debugging information to the debugger through the virtual machine, wherein the debugger is used for unpacking the debugging information according to a preset interaction protocol and sending the unpacked debugging information to the debugging equipment.
In a fourth aspect, another embodiment of the present application provides a remote debugging device, the device comprising:
the processing module is used for setting at least one breakpoint corresponding to the user problem of the target application program in the source code of the target application program;
the sending module is used for acquiring a debugging instruction according to the identification of the at least one breakpoint and sending the debugging instruction to the client;
the receiving module is used for receiving the debugging information of any breakpoint in the at least one breakpoint sent by the client;
and the processing module is also used for debugging the target application program according to the debugging information so as to locate the user problem.
Optionally, the processing module is specifically configured to:
acquiring a class signature corresponding to the user problem in a source code, and sending a class reference identifier acquisition instruction to the client, wherein the class reference identifier acquisition instruction comprises the class signature;
receiving a class reference identifier sent by the client, and sending a method identifier acquisition instruction to the client, wherein the method identifier acquisition instruction comprises the class reference identifier;
receiving at least one method identifier corresponding to the class reference identifier sent by the client, and determining a target method identifier from the at least one method identifier;
Sending a breakpoint identification acquisition instruction to the client, wherein the breakpoint identification acquisition instruction comprises the class reference identification, the target method identification and the identification of a preset code row corresponding to the target method identification;
and setting at least one breakpoint corresponding to the user problem in the source code according to the received identification of the at least one breakpoint.
In a fifth aspect, another embodiment of the present application provides a client device, including: a processor, a memory, and a transceiver; the transceiver is used for receiving and transmitting data; the memory stores executable instructions of the processor; wherein the processor is configured to implement the method of any of the first aspects via execution of the executable instructions.
In a sixth aspect, another embodiment of the present application provides a debugging apparatus, including: a processor, a memory, and a transceiver; the transceiver is used for receiving and transmitting data; the memory stores executable instructions of the processor; wherein the processor is configured to implement the method of any of the second aspects via execution of the executable instructions.
In a seventh aspect, another embodiment of the present application provides a computer readable storage medium having stored therein computer instructions which, when executed, implement the method of any one of the first and second aspects.
The application provides a remote debugging method, a device, equipment and a storage medium, wherein the method comprises the following steps: the method comprises the steps that at least one breakpoint corresponding to a user problem of a target application program is set in source codes of the target application program by debugging equipment, the debugging equipment obtains a debugging instruction according to identification of the at least one breakpoint and sends the debugging instruction to a client, if the target application program runs to any one of the at least one breakpoint, the client obtains debugging information of the breakpoint, the debugging information is sent to the debugging equipment, and the debugging equipment debugs the target application program according to the debugging information so as to locate the user problem. According to the application, the corresponding breakpoint is set according to the user problem, and the target application program is debugged according to the debugging information at the breakpoint, so that the exact source and specific reason of the user problem can be positioned from the source code angle.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a schematic diagram of a JPDA debug architecture provided by an embodiment of the present application;
FIG. 2 shows a system architecture diagram for remote debugging provided by an embodiment of the present application;
fig. 3 shows a flowchart of a remote debugging method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a scenario in which a target application program provided by an embodiment of the present application runs to a breakpoint;
fig. 5 shows a second flowchart of a remote debugging method according to an embodiment of the present application;
fig. 6 shows a third flowchart of a remote debugging method according to an embodiment of the present application;
fig. 7 shows a flowchart of a remote debugging method according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a setup interface of a target application according to an embodiment of the present application;
fig. 9 shows a schematic structural diagram of a remote debugging device according to an embodiment of the present application;
fig. 10 shows a second schematic structural diagram of the remote debugging device according to the embodiment of the present application;
fig. 11 shows a schematic structural diagram of a client device according to an embodiment of the present application;
fig. 12 shows a schematic structural diagram of a debugging device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for the purpose of illustration and description only and are not intended to limit the scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this disclosure, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to or removed from the flow diagrams by those skilled in the art under the direction of the present disclosure.
In addition, the described embodiments are only some, but not all, embodiments of the application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that the term "comprising" will be used in embodiments of the application to indicate the presence of the features stated hereafter, but not to exclude the addition of other features.
In the prior art, some problems existing in the process of using software applications by users are often unable to be reproduced and are difficult to be examined, and even if the same machine type as the user equipment is used, the specific scene of the user during use is difficult to be simulated, so that the user problems cannot be solved. Based on the problems, a plurality of problem investigation methods are provided at present, one is an APM SDK method, and the purposes of investigating problems and improving performance are achieved by monitoring problems such as on-line breakdown, blocking, overtime and the like; the other is a method for reporting the buried point log; there is also a specific scenario where a problem is recurring in contact with a user.
However, the above solutions are all effective for capturing abnormal states of program operation and locating abnormal problems such as crashes and jams, but have the following drawbacks:
(1) Non-performance problems such as page whites, loading failures, displayed avatars, nicknames, incorrect information of levels, etc., and other user feedback problems cannot be located.
(2) The specific cause of the jamming cannot be accurately located.
(3) The problem of local reproduction is related to the use situation of the user and cannot be traced.
Based on the method, the breakpoint is set in the source code of the target application program, when the target application program runs to the breakpoint, the debugging information is obtained, and then the target application program is debugged according to the debugging information, so that the exact source and specific reasons of the user problem can be positioned from the perspective of the source code.
The technical terms related to the present application will be described first.
JPDA: full name Java Platform Debugger Architecture, chinese name Java platform debug system.
APM: full name Application Performance Management, chinese name application performance monitoring.
JVMTI: full name Java Virtual Machine Tool Interface, chinese name Java virtual tool interface.
JDWP: the full name Java Debug Wire Protocol is the Java debugging protocol, and a developer can conveniently and flexibly build a Java debugging application program through an API provided by the JPDA.
JDI: full name Java Debug Interface, chinese name Java debug interface.
And (3) packaging: converting the debug instruction into a data packet specified by JDWP protocol.
Unpacking: and analyzing the debugging information returned by the virtual machine into a data packet specified by the JDWP protocol.
Fig. 1 shows a schematic diagram of a JPDA debug architecture according to an embodiment of the present application, as shown in fig. 1, including: a client and a debugging platform.
The debugging platform provides JVMTI interface for debugger and client terminal, the debugger provides JDI interface, the debugger transmits command between the debugger and the debugger via JDWP protocol, all the commands are packed into JDWP data package.
JDWP supports two communication modes, adb and socket, adb depends on data line and lan, in this embodiment, in order to implement remote debugging of debugger, the communication mode between debugger and debuggee is set as socket.
The JPDA is running on a client, which may be an android device.
Based on the JPDA platform provided in fig. 1, fig. 2 shows a system architecture diagram for remote debugging provided in an embodiment of the present application, as shown in fig. 2, including: the system comprises a debugging platform and a client, wherein the debugging platform comprises a server and debugging equipment, and the client comprises a debugger and a virtual machine.
The communication mode between the debugging equipment and the server is remote socket, the communication mode between the server and the debugger is remote socket, and the communication mode between the debugger and the virtual machine is local socket.
It should be noted that, the debugger runs at an application layer in the client, and the virtual machine runs at a system layer in the client.
In an actual application, when a user feeds back a problem to a debugging device in the process of using a target application program, for example, a game level shows an error, the debugging device sets a breakpoint corresponding to the problem of the user in a source code of the target application program, acquires a debugging instruction, namely, a JDWP instruction according to an identifier of the breakpoint, and sends the debugging instruction to a server, the server pushes the debugging instruction to the debugger, the debugger performs a packing operation on the received debugging instruction and sends the packed debugging instruction to a virtual machine, the virtual machine performs a unpacking operation on the received debugging instruction, acquires an identifier of the breakpoint in the debugging instruction, acquires debugging information of the breakpoint if the target application program runs to the breakpoint, then returns the debugging information to the debugger, the debugger receives the debugging information and unpacks the debugging information, the unpacked debugging information is sent to the server, and the debugging device can debug the target application program according to the unpacked debugging information, so that the exact source code of the user problem and the specific source reason can be located.
The remote debugging method provided by the embodiment of the application is described in detail below with reference to the above system architecture for remote debugging.
Fig. 3 shows a first flowchart of a remote debugging method according to an embodiment of the present application, as shown in fig. 3, where the method includes:
s101, the debugging device sets at least one breakpoint corresponding to a user problem of the target application program in source code of the target application program.
The debugging equipment is equipment adopted by a developer for debugging, and the client is a client of a target application program running on the client equipment. The target application may be any application installed on the client device, such as a game-like application, a video-like application, and a reading-like application, to which the present embodiment is not limited.
In practical application, if the target application program is a game application, a user may find some user problems during the game playing process, for example, the head portrait shows an abnormality, a nickname error, a rank error, etc., the user may feed back the user problems to the debugging device, and the debugging device may set at least one breakpoint corresponding to the user problems of the target application program in the source code of the target application program according to the received user problems of the target application program, where the breakpoint refers to setting a breakpoint in the source code of the target application program, and stopping running when the source code runs to the breakpoint.
Illustratively, there is a correspondence between the user question and the breakpoint, for example, when the user question is a nickname error, the corresponding at least one breakpoint may be set at line 1, line 7 of the source code; when the user problem is that the head portrait displays abnormality, at least one corresponding breakpoint can be set in the 8 th line, the 9 th line and the 10 th line of the source code.
S102, the debugging equipment acquires a debugging instruction according to the identification of at least one breakpoint and sends the debugging instruction to the client.
The debugging equipment acquires a debugging instruction according to the identification of at least one breakpoint, and sends the debugging instruction to the client, wherein the debugging instruction comprises the identification of at least one breakpoint, the debugging instruction is a debugging instruction aiming at the user problem of the target application program, and correspondingly, the client receives the debugging instruction sent by the debugging equipment.
S103, if the target application program runs to any breakpoint in the at least one breakpoint, the client acquires the debugging information of the breakpoint.
S104, the client sends debugging information to the debugging equipment.
S105, the debugging equipment debugs the target application program according to the debugging information so as to locate the user problem.
The debug information may be a parameter value of a variable of the code line where the breakpoint is located. If the target application program runs to any breakpoint in the at least one breakpoint, the client acquires the debugging information of the breakpoint and sends the debugging information to the debugging equipment, the debugging equipment is used for debugging the target application program according to the debugging information, and correspondingly, when the target application program runs to any breakpoint in the at least one breakpoint, the debugging equipment receives the debugging information of any breakpoint in the at least one breakpoint sent by the client and debugs the target application program according to the debugging information so as to locate the problem of the user.
Fig. 4 is a schematic diagram of a scenario in which a target application program runs to a breakpoint according to an embodiment of the present application, where, as shown in fig. 4, if a user problem is a nickname error of one character in game characters owned by the user, for example, a nickname error is displayed as "my character name my corner …", the target application program is illustrated to run to the breakpoint when the user switches to the game character.
The debugging device locally stores initial codes of the target application program, the debugging device can determine whether the parameter values of the variables of the code line where the breakpoints are located are the same or not by comparing the initial codes with the debugging information, if so, the source of the user problem is indicated to be located in the code line where the breakpoints are located, and if not, the source of the user problem is indicated to be not located in the code line where the breakpoints are located, so that the user problem can be located. Wherein the initial code of the target application may be the actual source code of the target application.
It should be noted that, the data transmitted between the client and the debug apparatus may be forwarded through the server.
The remote debugging method provided by the embodiment comprises the following steps: the method comprises the steps that at least one breakpoint corresponding to a user problem of a target application program is set in source codes of the target application program by debugging equipment, the debugging equipment obtains a debugging instruction according to identification of the at least one breakpoint and sends the debugging instruction to a client, if the target application program runs to any one of the at least one breakpoint, the client obtains debugging information of the breakpoint, the debugging information is sent to the debugging equipment, and the debugging equipment debugs the target application program according to the debugging information so as to locate the user problem. In this embodiment, the corresponding breakpoint is set according to the user problem, and the target application program is debugged according to the debug information at the breakpoint, so that the exact source and specific cause of the user problem can be located from the source code angle, a real and effective application effect is obtained on the target application program, and a good solution is provided for solving the on-line problem which cannot be reproduced and is difficult to troubleshoot.
Optionally, the debug instruction includes a class reference identification acquisition instruction, a method identification acquisition instruction, and a breakpoint setting instruction. The manner in which the breakpoint is set is described in detail below in connection with the embodiment of fig. 5. Fig. 5 shows a second flowchart of a remote debugging method according to an embodiment of the present application, where, as shown in fig. 5, at least one breakpoint corresponding to a user problem of a target application program is set in a source code of the target application program, including:
s201, the debugging equipment acquires a class signature corresponding to the user problem in the source code, and sends a class reference identifier acquisition instruction to the client.
S202, the client acquires the class reference identifier according to the received class reference identifier acquisition instruction sent by the debugging equipment, and sends the class reference identifier to the debugging equipment.
The class signature is the name of the class of the user problem in the source code, the debugging device can determine the class signature corresponding to the user problem in the source code according to the user problem aiming at the target application program, and send a class reference identifier acquisition instruction to the client, the client acquires the class reference identifier according to the class reference identifier acquisition instruction sent by the received debugging device, and sends the class reference identifier to the debugging device, wherein the class reference identifier acquisition instruction comprises the class signature, the class reference identifier can be the identifier of the class signature in the source code of the target application program, for example, the class reference identifier 1 and the class reference identifier 2 can be determined according to actual conditions, and details are not repeated herein.
S203, the debugging equipment receives the class reference identifier sent by the client and sends a method identifier acquisition instruction to the client.
S204, the client acquires at least one method identifier corresponding to the class reference identifier according to a received method identifier acquisition instruction sent by the debugging equipment, and sends the at least one method identifier to the debugging equipment.
The debugging equipment receives a class reference identifier sent by the client and sends a method identifier acquisition instruction to the client, wherein the method identifier acquisition instruction comprises the class reference identifier, and the class reference identifier can be obtained according to the method of the steps S201-S201.
Correspondingly, the client acquires at least one method identifier corresponding to the class reference identifier according to the received method identifier acquisition instruction, and sends the at least one method identifier to the debugging equipment, wherein the method identifier acquisition instruction comprises the class reference identifier.
S205, the debugging equipment receives at least one method identifier corresponding to the class reference identifier sent by the client, and determines a target method identifier from the at least one method identifier.
When the debugging device receives at least one method identifier corresponding to the class reference identifier sent by the client, the target method identifier can be determined from the at least one method identifier, wherein the target method identifier can be one method identifier which is randomly determined from the at least one method identifier by the debugging device, one method identifier which is sequentially selected from the at least one method identifier, or one method identifier which is empirically determined from the at least one method identifier by a developer.
It should be noted that the target method identifier may be an estimated identifier of a method causing a problem of a user.
S206, the debugging equipment sends a breakpoint identification acquisition instruction to the client.
S207, the client acquires the identification of at least one breakpoint according to the received breakpoint identification acquisition instruction sent by the debugging equipment, and sends the identification of at least one breakpoint to the debugging equipment.
The breakpoint identification acquisition instruction comprises a class reference identification, a target method identification and an identification of a preset code row corresponding to the target method identification.
The preset code row corresponding to the target method identifier may be a code row which is empirically determined and causes a user problem, for example, may be a 1 st row code, an 8 th row code, a 10 th row code, and the like in the target method, which is not limited in this embodiment.
The method comprises the steps that the debugging equipment sends a breakpoint identification acquisition instruction to a client, the client receives the breakpoint identification acquisition instruction sent by the debugging equipment, acquires the identification of at least one breakpoint according to the breakpoint identification acquisition instruction, and sends the identification of at least one breakpoint to the debugging equipment.
S208, the debugging equipment sets at least one breakpoint corresponding to the user problem in the source code according to the received identification of the at least one breakpoint.
According to the received identification of at least one breakpoint, the debugging equipment finds a preset code line according to the identification of the preset code line corresponding to the class reference identification, the target method identification and the target method identification in the source code of the target application program, and then sets at least one breakpoint corresponding to the user problem in the preset code line in the source code.
As one example, the class reference identifier fetch instruction is "VirtualMachine: classesBySignature ", method identification acquisition instruction is" ReferenceType: method WithGeneric ", breakpoint set instruction" EventRequest: set ", the debugging device sends" virtual machine "to the client: classesBySignature ", the client returns a class reference identifier, and the debugging device sends a" ReferenType "to the client: method WithGeneric ", client returns method identification, and the debugging device sends" EventRequest "to the client: set ", the client sets the breakpoint and returns an event request identifier, that is, a response message that the breakpoint is Set successfully.
It can be seen that the calling order of the debug instructions is serial, i.e. the reply of the last instruction is resolved as the parameter of the next instruction.
The remote debugging method provided by the embodiment comprises the following steps: the method comprises the steps that a debugging device obtains class signatures corresponding to user problems in source codes, class reference identification obtaining instructions are sent to a client, the client obtains the class reference identifications according to the class reference identification obtaining instructions sent by the received debugging device, the class reference identifications are sent to the debugging device, the debugging device receives the class reference identifications sent by the client, the method identification obtaining instructions are sent to the client, the client obtains at least one method identification corresponding to the class reference identifications according to the method identification obtaining instructions sent by the received debugging device, the at least one method identification corresponding to the class reference identifications is sent to the debugging device, the debugging device receives the at least one method identification corresponding to the class reference identifications sent by the client, a target method identification is determined from the at least one method identification, the debugging device sends a breakpoint identification obtaining instruction to the client, the client obtains at least one breakpoint identification according to the breakpoint identification obtaining instructions sent by the received debugging device, and the at least one breakpoint identification corresponding to the user problems is set in the source codes according to the received at least one breakpoint identification. In this embodiment, by calling the debug instruction, it is determined that the breakpoint is set in the preset code line of the source code, so that the positioning efficiency of the user problem is improved.
Alternatively, the debug information for obtaining the breakpoint will be specifically described with reference to fig. 6. Fig. 6 shows a third flowchart of a remote debugging method according to an embodiment of the present application, where, as shown in fig. 6, if a target application program runs to any breakpoint of at least one breakpoint, obtaining debugging information of the breakpoint includes:
s301, if a target application program runs to a breakpoint, the debugging equipment acquires execution information corresponding to the breakpoint.
S302, the debugging equipment acquires a call stack of the breakpoint according to the execution information.
Wherein the execution information is used to indicate the location of the breakpoint in the source code. The call stack is a stack for storing the data and the address of the breakpoint in the memory, and the stack is used for caching the data and the address.
If the target application program runs to the breakpoint, the client acquires the execution information corresponding to the breakpoint, and then determines a call stack of the breakpoint according to the execution information, wherein the execution information and the call stack can have a corresponding relation, and when the execution information is obtained, the execution information and the call stack can be matched in the corresponding relation to obtain the call stack corresponding to the execution information.
Optionally, the execution information includes at least one of the following information:
the event type corresponding to the breakpoint, the identification number of the breakpoint in at least one breakpoint, the thread number of the breakpoint, and the position information of the breakpoint in the corresponding call stack.
The event type corresponding to the breakpoint may be a breakpoint event.
The client sets at least one breakpoint corresponding to the user problem in the source code of the target application program, each breakpoint is marked with an identification number, and the marking number of the breakpoint in the at least one breakpoint can be, for example, breakpoint 1, breakpoint 2, breakpoint 3, and the like.
The client may also obtain the thread number where the breakpoint is located, and location information of the breakpoint in the corresponding call stack, e.g., a first address, a second address, etc. in the corresponding call stack.
It should be noted that, when the target application program runs to a breakpoint, the execution information corresponding to the breakpoint may be cached in the message queue, where the message queue may run in an independent thread, that is, be divided into two independent threads, where one thread is used to cache the message queue, and the other thread is used to run the target application program, and if the execution information of the first breakpoint is cached in the message queue, the other thread may also normally run the target application program, where the execution information cached in the message queue may be a process of consuming while caching.
S303, the debugging equipment acquires parameter values of stack top variables in a call stack of the breakpoint.
S304, the debugging equipment determines the parameter value of the stack top variable as debugging information.
The top of the stack is the code line where the breakpoint is located, and the variable of the top of the stack is the variable of the top of the stack in the call stack, and may be, for example, head portrait, nickname, class, etc.
Specifically, the debugging device determines a call stack of a breakpoint, obtains a parameter value of a stack top variable in the call stack, and determines the parameter value of the stack top variable as debugging information, so that the debugging device can indicate that the source of the user problem is located in a code line where the breakpoint is located when the parameter value of the stack top variable is the same as a value in an initial code by comparing an initial code of a target application program with the parameter value of the stack top variable, and if the parameter value of the stack top variable is different from the value in the initial code, indicates that the source of the user problem is not located in the code line where the breakpoint is located, thereby realizing the positioning of the user problem.
Optionally, obtaining the parameter value of the stack top variable in the call stack includes:
and if the data type of the stack top variable is the first data type, acquiring a parameter value of the stack top variable by adopting a parameter acquisition instruction.
The first data type may be a basic data type, for example, int and long, and if the data type of the stack top variable is the first data type, a parameter obtaining instruction may be adopted to directly obtain the parameter value of the stack top variable.
Illustratively, the parameter acquisition instruction may be "StackFrame: getValues).
Optionally, obtaining the parameter value of the stack top variable in the call stack includes:
if the data type of the stack top variable is the second data type, acquiring a command by adopting the reference information, and acquiring the reference information of the stack top variable;
acquiring a field corresponding to the stack top variable according to the reference information;
acquiring a parameter value of a field by adopting a field parameter acquisition instruction;
and determining the parameter value of the field as the parameter value of the stack top variable.
The second data type may be a non-basic data type, for example, string, if the stack top variable is a non-basic data type, a reference information acquiring instruction may be used to acquire reference information of the stack top variable, the reference information is used to indicate parameter information referenced by the stack top variable, then a field corresponding to the stack top variable is acquired according to the reference information, and then a parameter value of the field is acquired by using the field parameter acquiring instruction, and the parameter value of the field is determined to be the parameter value of the stack top variable.
In Java, the data types are divided into a basic data type and a non-basic data type, wherein the non-basic data type is an object, the object has a field, and the call of the object is through the address of the reference object. Thus, the reference information herein refers to the address of the reference object.
The remote debugging method provided by the embodiment comprises the following steps: if the target application program runs to the breakpoint, acquiring execution information corresponding to the breakpoint, acquiring a call stack of the breakpoint according to the execution information, acquiring a parameter value of a stack top variable in the call stack of the breakpoint, and determining the parameter value of the stack top variable as debugging information. Therefore, the debugging information of the breakpoint can be accurately determined, and the accuracy of positioning problems can be improved.
Optionally, referring to fig. 2, the client includes a debugger and a virtual machine, where the debugger runs at an application layer and the virtual machine runs at a system layer. The client receives a debugging instruction sent by the debugging equipment, and the method comprises the following steps: and receiving a debugging instruction through a debugger in the client, wherein the debugger is used for packaging the debugging instruction according to a preset interaction protocol, and sending the packaged debugging instruction to a virtual machine in the client.
Correspondingly, the client sends the debugging information to the debugging equipment, which comprises the following steps: the client acquires the debugging information through the virtual machine, sends the debugging information to the debugger, and is used for unpacking the debugging information and sending the unpacked debugging information to the debugging equipment.
A remote debugging method provided in this embodiment is described below with reference to fig. 7, and fig. 7 shows a flowchart of a remote debugging method provided in an embodiment of the present application, as shown in fig. 7, where the method includes:
S401, receiving a debugging instruction through a debugger in the client.
The debugging equipment sets at least one breakpoint in a source code of the target application program according to the received user problem aiming at the target application program, acquires a debugging instruction according to the identification of the at least one breakpoint, and sends the debugging instruction to the client, namely, the client receives the debugging instruction through a debugger, and the debugger is used for packaging the debugging instruction according to a preset interaction protocol and sending the packaged debugging instruction to a virtual machine in the client.
The preset interaction protocol may be JDWP protocol shown in fig. 2, and the debugger in the client receives the debug instruction sent by the debug device, and packages the debug instruction according to the JDWP protocol, and sends the packaged debug instruction to the virtual machine.
For example, the packing and unpacking are implemented by using c++, when the debugger receives the debug instruction, the jni function is used to call the packing according to JDWP protocol, convert the debug instruction into a byte (english name: byte) stream command, that is, the packed debug instruction, and then send the packed debug instruction to the virtual machine.
Optionally, receiving, by a debugger in the client, a debug instruction includes:
According to the received remote debugging starting operation, starting a remote debugging function of the client;
and when the client starts the remote debugging function and the debugger and the virtual machine handshake succeed, receiving a debugging instruction through the debugger in the client.
Taking fig. 8 as an example, fig. 8 shows a schematic diagram of a setting interface of a target application program provided by the embodiment of the present application, as shown in fig. 8, a control allowing remote debugging is provided in a debugging interface of the target application program, and when a touch operation of a user on the control is received, that is, an opening operation of remote debugging is received, a remote debugging function of a client is opened.
It should be noted that, in general, the debug interface of the target application needs to be accessible according to the direction of the developer, and in general, the user will not enter the debug interface.
Handshake success refers to the debugger and virtual machine checking success, that is, meaning that the debugger and virtual machine establish a communication link that can be used for data transfer. For a description of handshaking, reference is made to the prior art, and will not be repeated here.
Specifically, only when the remote debug function of the client is turned on and the virtual machine and the debugger in the client handshake successfully, the debug instruction may be received by the debugger in the client.
S402, if the target application program runs to any breakpoint in the at least one breakpoint, obtaining debugging information of the breakpoint through the virtual machine.
Specifically, at least one breakpoint corresponding to a user problem is set in a source code through a virtual machine in a client according to a packed debugging instruction, and when a target application program runs to any breakpoint in the at least one breakpoint, the debugging information of the breakpoint is obtained through the virtual machine.
S403, sending the debug information to a debugger through the virtual machine, wherein the debugger is used for unpacking the debug information and sending the unpacked debug information to the debug equipment.
S404, the debugging equipment deblocks the target application program according to the unpacked debugging information so as to locate the user problem.
If the target application program runs to any breakpoint in at least one judgment, obtaining debugging information of the breakpoint through a virtual machine in the client, sending the debugging information to a debugger in the client through the virtual machine, and sending the unpacked debugging information to the debugging equipment.
The debugger receives the debug information sent by the virtual machine, can use the jni function to call and unpack the debug information sent by the virtual machine, namely byte stream information, is converted into JAVA entity class, namely unpacked debug information, and sends the unpacked debug information to the debug equipment, and the debug equipment debugs the target application program according to the unpacked debug information so as to locate the user problem.
It should be noted that, data transmitted between the debugger and the debugging device may be forwarded through the server.
As an example, the debugger is configured to package the debug instruction according to a preset interaction protocol, send the packaged debug instruction to the virtual machine, obtain the debug information of the breakpoint by the virtual machine, send the debug information to the debugger, and unpack the debug information by the debugger to obtain unpacked debug information.
The debugging instruction is used for requesting the client to set at least one breakpoint corresponding to the user problem in the source code of the target application program.
The remote debugging method provided by the embodiment comprises the following steps: receiving a debugging instruction through a debugger in the client, if the target application program runs to any breakpoint in at least one breakpoint, acquiring debugging information of the breakpoint through the virtual machine, sending the debugging information to the debugger through the virtual machine, unpacking the debugging information, sending the unpacked debugging information to a debugging device, and debugging the target application program by the debugging device according to the unpacked debugging information so as to locate a user problem. Through interaction between the virtual machine and the debugger, a breakpoint corresponding to the user problem is set in the source code, and the target application program is debugged according to the debugging information at the breakpoint, so that the exact source and specific reason of the user problem can be positioned from the source code angle.
The following describes a procedure of setting a communication manner between the virtual machine and the debugger as socket. The communication mode setting process between the virtual machine and the debugger specifically comprises the following steps:
for the android 5.0 system:
the first step, the debugger uses the dlopen method to load the dynamic link library source code (i.e. libart. So) and returns the handle in the memory.
Specifically, the virtual machine realizes that relevant codes of the JVM TI interface are compiled into libart. So above android 5.0 by default, a dynamic link library is loaded by adopting a dlopen method, and a handle of the JVM TI interface in a memory is returned.
And secondly, the debugger acquires the signed address of the startJdwp function in libart. So by adopting a dlsym method.
Wherein dlsym is used to obtain the address of a certain method (signed function name). Symbolizing is a name modification that a compiler would make on variable names or function names when compiling source code into a target file. Wherein the symbolic function names of functions startJdwp, stopJdwp and the like can be searched through nm commands.
And thirdly, in libart. So, configuring configuration parameters corresponding to the signed address of the startJdwp function according to actual requirements so as to set a communication mode between the virtual machine and the debugger as socket.
For android 7.0 above system:
since starting from android 7.0, the system would prevent the direct use of the dynamic link library libart. So, forcing the use of dlopen and dlsym methods described above would crash (english name: crash).
Based on this, the first and second steps described above are replaced with the following steps:
first, open the system file "/proc/self/maps", find the mapped address of libart. So in the memory, return its memory handle.
And secondly, searching a character string by using the function name symbolized by the startJdwp function through the handle returned in the first step, and finding the symbolized address of the startJdwp function in libart.
In this embodiment, by adopting the method for debugging configuration of the virtual machine, the published apk can be debugged without recompilation, the barrier of the data line and the local area network can be broken through, and the application program installed on any client device can be remotely debugged in real time.
The following describes the present technical solution in detail with reference to a specific embodiment, and the implementation process of the remote debugging method provided in this embodiment includes the following steps:
and the first step, starting the remote debugging function of the client.
And step two, setting a communication mode.
The communication mode between the server, the debugger and the debugging equipment is set as socket, and the communication mode between the debugger and the virtual machine is set as socket.
Thirdly, the debugging equipment finds a connected remote client on the display interface, a debugging instruction is sent to the debugger through the server, and the debugger sends the debugging instruction to the virtual machine.
The debugging instructions comprise a class reference identifier acquisition instruction, a method identifier acquisition instruction and a breakpoint setting instruction.
Specifically, when receiving a class reference identifier acquisition instruction, the debugger acquires a class reference identifier, wherein the class reference identifier acquisition instruction comprises a class signature corresponding to a user problem in source codes; when a method identifier acquisition instruction is received, at least one method identifier corresponding to the class reference identifier is acquired, the class reference identifier is included in the method identifier acquisition instruction, the class reference identifier and the at least one method identifier are sent to debugging equipment, and the debugging equipment acquires a target method identifier from the at least one method identifier.
Then, when receiving a breakpoint setting instruction sent by the debugging equipment, the debugger packs the breakpoint setting instruction, sends the packed breakpoint setting instruction to the virtual machine, and sets at least one breakpoint corresponding to the user problem in the source code according to the packed breakpoint setting instruction by the virtual machine, wherein the breakpoint setting instruction comprises a class reference identifier, a target method identifier in the at least one method identifier and an identifier of a preset code row corresponding to the target method identifier.
And thirdly, the virtual machine acquires debugging information of the breakpoint, and the debugger unpacks the debugging information.
And step four, the debugger sends the unpacked debugging information to the debugging equipment through the server.
The virtual machine acquires the debugging information of the breakpoint and sends the debugging information to the debugger, the debugger unpacks the debugging information to obtain unpacked debugging information, the debugger sends the unpacked debugging information to the debugging equipment through the server, and the debugging equipment debugs the target application program according to the unpacked debugging information.
It should be noted that, the virtual machine is an Android virtual machine built on the linux kernel and built in an Android system in order to adapt programs developed by java to different hardware devices for running. The debugger is an application program using the present debug scheme, which is packaged as a sdk for any application program. The debugger communicates with the remote server on the one hand and the virtual machine of the android system on the other hand.
Fig. 9 shows a schematic structural diagram of a remote debugging device provided in an embodiment of the present application, as shown in fig. 9, where the remote debugging device 20 is integrated in a client device, and the remote debugging device 20 includes:
A receiving module 21, configured to receive a debug instruction sent by a debug device, where the debug instruction is a debug instruction for a user problem of a target application program, and the debug instruction includes an identifier of at least one breakpoint;
a processing module 22, configured to set at least one breakpoint corresponding to the user problem in a source code of the target application program according to the debug instruction;
an obtaining module 23, configured to obtain debug information of the breakpoint when the target application program runs to any breakpoint of the at least one breakpoint;
and the sending module 24 is used for sending the debugging information to the debugging equipment, and the debugging equipment is used for debugging the target application program according to the debugging information.
Optionally, the obtaining module 23 is specifically configured to:
if the target application program runs to the breakpoint, acquiring execution information corresponding to the breakpoint, wherein the execution information is used for indicating the position of the breakpoint in the source code;
acquiring a call stack of the breakpoint according to the execution information;
acquiring a parameter value of a stack top variable in the call stack, wherein the stack top variable is a stack top variable in the call stack;
And determining the parameter value of the stack top variable as the debugging information.
Optionally, the obtaining module 23 is specifically configured to:
and if the data type of the stack top variable is the first data type, acquiring a parameter value of the stack top variable by adopting a parameter acquisition instruction.
Optionally, the obtaining module 23 is specifically configured to:
if the data type of the stack top variable is the second data type, acquiring the reference information of the stack top variable by adopting a reference information acquisition instruction;
acquiring a field corresponding to the stack top variable according to the reference information;
acquiring a parameter value of a field by adopting a field parameter acquisition instruction;
and determining the parameter value of the field as the parameter value of the stack top variable.
Optionally, the obtaining module 23 is further configured to:
acquiring a class reference identifier according to a class reference identifier acquisition instruction sent by a received debugging device, and sending the class reference identifier to the debugging device, wherein the class reference identifier acquisition instruction comprises a class signature corresponding to the user problem in a source code;
acquiring at least one method identifier corresponding to the class reference identifier according to a received method identifier acquisition instruction sent by the debugging equipment, and sending the at least one method identifier to the debugging equipment, wherein the method identifier acquisition instruction comprises the class reference identifier;
Acquiring the identification of at least one breakpoint according to a breakpoint identification acquisition instruction sent by the received debugging equipment, and sending the identification of the at least one breakpoint to the debugging equipment, wherein the breakpoint identification acquisition instruction comprises the class reference identification, a target method identification in the at least one method identification and an identification of a preset code row corresponding to the target method identification.
Optionally, the execution information includes at least one of the following information:
the event type corresponding to the breakpoint, the identification number of the breakpoint in the at least one breakpoint, the thread number of the breakpoint, and the position information of the breakpoint in the corresponding call stack.
Optionally, the receiving module 21 is specifically configured to:
and receiving the debugging instruction through a debugger in the client, wherein the debugger is used for packaging the debugging instruction according to a preset interaction protocol, and sending the packaged debugging instruction to a virtual machine in the client.
Optionally, the receiving module 21 is specifically configured to:
according to the received remote debugging starting operation, starting the remote debugging function of the client;
and when the client starts a remote debugging function and the debugger and the virtual machine handshake succeed, receiving the debugging instruction through the debugger in the client.
Optionally, the sending module 24 is specifically configured to:
and sending the debugging information to the debugger through the virtual machine, wherein the debugger is used for unpacking the debugging information according to a preset interaction protocol and sending the unpacked debugging information to the debugging equipment.
The description of the processing flow of each module in the apparatus and the interaction flow between the modules may refer to the relevant description in the method performed by the client, which is not described in detail herein.
Fig. 10 shows a second schematic structural diagram of a remote debugging device according to an embodiment of the present application, as shown in fig. 10, where the remote debugging device 30 is integrated in a debugging apparatus, and the remote debugging device 30 includes:
a processing module 31, configured to set at least one breakpoint corresponding to a user problem of the target application program in a source code of the target application program;
a sending module 32, configured to obtain a debug instruction according to the identifier of the at least one breakpoint, and send the debug instruction to a client;
a receiving module 33, configured to receive debug information of any breakpoint of the at least one breakpoint sent by the client;
the processing module 34 is further configured to debug the target application program according to the debug information, so as to locate the user problem.
Optionally, the processing module 34 is specifically configured to:
acquiring a class signature corresponding to the user problem in a source code, and sending a class reference identifier acquisition instruction to the client, wherein the class reference identifier acquisition instruction comprises the class signature;
receiving a class reference identifier sent by the client, and sending a method identifier acquisition instruction to the client, wherein the method identifier acquisition instruction comprises the class reference identifier;
receiving at least one method identifier corresponding to the class reference identifier sent by the client, and determining a target method identifier from the at least one method identifier;
sending a breakpoint identification acquisition instruction to the client, wherein the breakpoint identification acquisition instruction comprises the class reference identification, the target method identification and the identification of a preset code row corresponding to the target method identification;
and setting at least one breakpoint corresponding to the user problem in the source code according to the received identification of the at least one breakpoint.
The description of the processing flow of each module in the apparatus and the interaction flow between the modules may refer to the relevant description of the method executed by the above-mentioned debugging device, and will not be described in detail here.
Fig. 11 shows a schematic structural diagram of a client device according to an embodiment of the present application, and as shown in fig. 11, the client device 40 includes:
a processor 41, a memory 42 and a transceiver 43; the transceiver 43 is used for receiving and transmitting data; the memory 42 has stored therein executable instructions of the processor; wherein the processor 41 is configured to implement the method performed by the client described above via execution of the executable instructions.
Fig. 12 shows a schematic structural diagram of a debugging device provided by an embodiment of the present application, as shown in fig. 12, the debugging device 50 includes:
a processor 51, a memory 52 and a transceiver 53; the transceiver 53 is used for receiving and transmitting data; the memory 52 stores therein executable instructions of the processor 51; wherein the processor 51 is configured to implement the method performed by the above-described debugging device via execution of the executable instructions.
The embodiment of the application also provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program executes the method embodiment when being executed.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the method embodiments, and are not repeated in the present disclosure. In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, and the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, and for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication between the illustrated or discussed may be via some communication interface, indirect coupling or communication between devices or modules, electrical, mechanical, or other form.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily appreciate variations or alternatives within the scope of the present application.

Claims (14)

1. A remote debugging method, applied to a client, the method comprising:
receiving a debugging instruction sent by debugging equipment, wherein the debugging instruction is a debugging instruction aiming at a user problem of a target application program, and the debugging instruction comprises an identification of at least one breakpoint;
if the target application program runs to any breakpoint in the at least one breakpoint, obtaining debugging information of the breakpoint;
the debugging information is sent to the debugging equipment, and the debugging equipment is used for debugging the target application program according to the debugging information;
before receiving the debug instruction sent by the debug equipment, the method further comprises the following steps:
acquiring a class reference identifier according to a class reference identifier acquisition instruction sent by a received debugging device, and sending the class reference identifier to the debugging device, wherein the class reference identifier acquisition instruction comprises a class signature corresponding to the user problem in a source code;
acquiring at least one method identifier corresponding to the class reference identifier according to a received method identifier acquisition instruction sent by the debugging equipment, and sending the at least one method identifier to the debugging equipment, wherein the method identifier acquisition instruction comprises the class reference identifier;
Acquiring the identification of the at least one breakpoint according to a received breakpoint identification acquisition instruction sent by the debugging equipment, and sending the identification of the at least one breakpoint to the debugging equipment, wherein the breakpoint identification acquisition instruction comprises the class reference identification, a target method identification in the at least one method identification and an identification of a preset code row corresponding to the target method identification.
2. The method according to claim 1, wherein if the target application program runs to any breakpoint of the at least one breakpoint, obtaining debug information of the breakpoint comprises:
if the target application program runs to the breakpoint, acquiring execution information corresponding to the breakpoint, wherein the execution information is used for indicating the position of the breakpoint in a source code of the target application program;
acquiring a call stack of the breakpoint according to the execution information;
acquiring a parameter value of a stack top variable in the call stack, wherein the stack top variable is a stack top variable in the call stack;
and determining the parameter value of the stack top variable as the debugging information.
3. The method of claim 2, wherein the obtaining the parameter value of the top of stack variable in the call stack comprises:
And if the data type of the stack top variable is the first data type, acquiring a parameter value of the stack top variable by adopting a parameter acquisition instruction.
4. The method of claim 2, wherein the obtaining the parameter value of the top of stack variable in the call stack comprises:
if the data type of the stack top variable is the second data type, acquiring the reference information of the stack top variable by adopting a reference information acquisition instruction;
acquiring a field corresponding to the stack top variable according to the reference information;
acquiring a parameter value of a field by adopting a field parameter acquisition instruction;
and determining the parameter value of the field as the parameter value of the stack top variable.
5. The method of claim 2, wherein the execution information includes at least one of the following information:
the event type corresponding to the breakpoint, the identification number of the breakpoint in the at least one breakpoint, the thread number of the breakpoint, and the position information of the breakpoint in the corresponding call stack.
6. The method of claim 1, wherein receiving the debug instruction sent by the debug device comprises:
and receiving the debugging instruction through a debugger in the client, wherein the debugger is used for packaging the debugging instruction according to a preset interaction protocol, and sending the packaged debugging instruction to a virtual machine in the client.
7. The method of claim 6, wherein the receiving, by a debugger in the client, the debug instruction comprises:
according to the received remote debugging starting operation, starting the remote debugging function of the client;
and when the client starts a remote debugging function and the debugger and the virtual machine handshake succeed, receiving the debugging instruction through the debugger in the client.
8. The method of claim 6 or 7, wherein the sending the debug information to the debug apparatus comprises:
and sending the debugging information to the debugger through the virtual machine, wherein the debugger is used for unpacking the debugging information according to a preset interaction protocol and sending the unpacked debugging information to the debugging equipment.
9. A remote debugging method, applied to a debugging device, the method comprising:
setting at least one breakpoint corresponding to a user problem of a target application program in source code of the target application program;
acquiring a debugging instruction according to the identification of the at least one breakpoint, and sending the debugging instruction to a client;
Receiving debugging information of any breakpoint in the at least one breakpoint sent by the client;
debugging the target application program according to the debugging information so as to locate the user problem;
the setting at least one breakpoint corresponding to the user problem of the target application program in the source code of the target application program comprises the following steps:
acquiring a class signature corresponding to the user problem in a source code, and sending a class reference identifier acquisition instruction to the client, wherein the class reference identifier acquisition instruction comprises the class signature;
receiving a class reference identifier sent by the client, and sending a method identifier acquisition instruction to the client, wherein the method identifier acquisition instruction comprises the class reference identifier;
receiving at least one method identifier corresponding to the class reference identifier sent by the client, and determining a target method identifier from the at least one method identifier;
sending a breakpoint identification acquisition instruction to the client, wherein the breakpoint identification acquisition instruction comprises the class reference identification, the target method identification and the identification of a preset code row corresponding to the target method identification;
And setting at least one breakpoint corresponding to the user problem in the source code according to the received identification of the at least one breakpoint.
10. A remote debugging device, comprising:
the receiving module is used for receiving a debugging instruction sent by the debugging equipment, wherein the debugging instruction is a debugging instruction aiming at the user problem of the target application program, and the debugging instruction comprises at least one breakpoint mark;
the processing module is used for setting at least one breakpoint corresponding to the user problem in the source code of the target application program according to the debugging instruction;
the acquisition module is used for acquiring debugging information of any breakpoint in the at least one breakpoint when the target application program runs to the breakpoint;
the transmitting module is used for transmitting the debugging information to the debugging equipment, and the debugging equipment is used for debugging the target application program according to the debugging information;
the acquisition module is further configured to:
acquiring a class reference identifier according to a class reference identifier acquisition instruction sent by a received debugging device, and sending the class reference identifier to the debugging device, wherein the class reference identifier acquisition instruction comprises a class signature corresponding to the user problem in a source code;
Acquiring at least one method identifier corresponding to the class reference identifier according to a received method identifier acquisition instruction sent by the debugging equipment, and sending the at least one method identifier to the debugging equipment, wherein the method identifier acquisition instruction comprises the class reference identifier;
acquiring the identification of the at least one breakpoint according to a received breakpoint identification acquisition instruction sent by the debugging equipment, and sending the identification of the at least one breakpoint to the debugging equipment, wherein the breakpoint identification acquisition instruction comprises the class reference identification, a target method identification in the at least one method identification and an identification of a preset code row corresponding to the target method identification.
11. A remote debugging device, comprising:
the processing module is used for setting at least one breakpoint corresponding to the user problem of the target application program in the source code of the target application program;
the sending module is used for acquiring a debugging instruction according to the identification of the at least one breakpoint and sending the debugging instruction to the client;
the receiving module is used for receiving the debugging information of any breakpoint in the at least one breakpoint sent by the client;
The processing module is further used for debugging the target application program according to the debugging information so as to locate the user problem;
the processing module is specifically configured to:
acquiring a class signature corresponding to the user problem in a source code, and sending a class reference identifier acquisition instruction to the client, wherein the class reference identifier acquisition instruction comprises the class signature;
receiving a class reference identifier sent by the client, and sending a method identifier acquisition instruction to the client, wherein the method identifier acquisition instruction comprises the class reference identifier;
receiving at least one method identifier corresponding to the class reference identifier sent by the client, and determining a target method identifier from the at least one method identifier;
sending a breakpoint identification acquisition instruction to the client, wherein the breakpoint identification acquisition instruction comprises the class reference identification, the target method identification and the identification of a preset code row corresponding to the target method identification;
and setting at least one breakpoint corresponding to the user problem in the source code according to the received identification of the at least one breakpoint.
12. A client device, comprising: a processor, a memory, and a transceiver; the transceiver is used for receiving and transmitting data; the memory stores executable instructions of the processor; wherein the processor is configured to implement the method of any one of claims 1-8 via execution of the executable instructions.
13. A debugging device, comprising: a processor, a memory, and a transceiver; the transceiver is used for receiving and transmitting data; the memory stores executable instructions of the processor; wherein the processor is configured to implement the method of claim 9 via execution of the executable instructions.
14. A computer readable storage medium having stored therein computer instructions which, when executed, implement the method of any of claims 1-9.
CN202011121825.0A 2020-10-19 2020-10-19 Remote debugging method, device, equipment and storage medium Active CN112256570B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011121825.0A CN112256570B (en) 2020-10-19 2020-10-19 Remote debugging method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011121825.0A CN112256570B (en) 2020-10-19 2020-10-19 Remote debugging method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112256570A CN112256570A (en) 2021-01-22
CN112256570B true CN112256570B (en) 2023-08-11

Family

ID=74245492

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011121825.0A Active CN112256570B (en) 2020-10-19 2020-10-19 Remote debugging method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112256570B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968751A (en) * 2021-02-24 2022-08-30 中国联合网络通信集团有限公司 Program debugging method and program debugging device of code-free development platform
CN112860473B (en) * 2021-04-27 2021-07-30 武汉深之度科技有限公司 Method and device for positioning source code during program operation error and computing equipment
CN112988599B (en) * 2021-04-29 2021-07-23 腾讯科技(深圳)有限公司 Page debugging method and device, electronic equipment and storage medium
CN113626308A (en) * 2021-07-06 2021-11-09 深圳点猫科技有限公司 Code debugging method and device, electronic equipment and storage medium
CN114900736A (en) * 2022-03-28 2022-08-12 网易(杭州)网络有限公司 Video generation method and device and electronic equipment
CN115048145B (en) * 2022-06-14 2023-04-25 海光信息技术股份有限公司 Information acquisition method and device and related equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101446918A (en) * 2008-12-10 2009-06-03 中兴通讯股份有限公司 Method for realizing debugging of single function by user state debugger and system thereof
CN101515248A (en) * 2008-02-21 2009-08-26 国际商业机器公司 Tracking method and tracking system for object-oriented program
CN103019941A (en) * 2012-12-28 2013-04-03 大唐微电子技术有限公司 Program debugging method and device
CN106201893A (en) * 2016-07-21 2016-12-07 恒宝股份有限公司 A kind of Java bytecode debugger and adjustment method
WO2019091217A1 (en) * 2017-11-10 2019-05-16 华为技术有限公司 Script debugging method and device, and computer storage medium
CN110032426A (en) * 2019-04-10 2019-07-19 浙江讯盟科技有限公司 A kind of method that can be debugged in real time online, system and storage medium
CN111782525A (en) * 2020-06-30 2020-10-16 中国工商银行股份有限公司 Java method remote debugging method and device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7299456B2 (en) * 2003-09-18 2007-11-20 International Business Machines Corporation Run into function
US20070168997A1 (en) * 2005-12-20 2007-07-19 Duong-Han Tran Debugging of remote application software on a local computer
US8156473B2 (en) * 2007-06-01 2012-04-10 Sap Ag Model oriented debugging
US8732671B2 (en) * 2010-02-26 2014-05-20 Red Hat, Inc. Generating stack traces of call stacks that lack frame pointers
US8434057B2 (en) * 2010-08-17 2013-04-30 Oracle International Corporation Optimized implementation of breakpoint in java debugger agent
US8572579B2 (en) * 2010-08-19 2013-10-29 Oracle International Corporation Break on next called function or method in java debugger agent
US8671393B2 (en) * 2010-10-21 2014-03-11 International Business Machines Corporation Collaborative software debugging in a distributed system with client-specific dynamic breakpoints
US8566799B2 (en) * 2011-07-15 2013-10-22 International Business Machines Corporation Resuming a prior debug session
US8843900B2 (en) * 2012-06-12 2014-09-23 Microsoft Corporation Serial debugging experience for parallel programs

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101515248A (en) * 2008-02-21 2009-08-26 国际商业机器公司 Tracking method and tracking system for object-oriented program
CN101446918A (en) * 2008-12-10 2009-06-03 中兴通讯股份有限公司 Method for realizing debugging of single function by user state debugger and system thereof
CN103019941A (en) * 2012-12-28 2013-04-03 大唐微电子技术有限公司 Program debugging method and device
CN106201893A (en) * 2016-07-21 2016-12-07 恒宝股份有限公司 A kind of Java bytecode debugger and adjustment method
WO2019091217A1 (en) * 2017-11-10 2019-05-16 华为技术有限公司 Script debugging method and device, and computer storage medium
CN110032426A (en) * 2019-04-10 2019-07-19 浙江讯盟科技有限公司 A kind of method that can be debugged in real time online, system and storage medium
CN111782525A (en) * 2020-06-30 2020-10-16 中国工商银行股份有限公司 Java method remote debugging method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
赵文栋.《网络编程实验指导书》.东南大学出版社,2019,第99页. *

Also Published As

Publication number Publication date
CN112256570A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
CN112256570B (en) Remote debugging method, device, equipment and storage medium
Zheng et al. {FIRM-AFL}:{High-Throughput} greybox fuzzing of {IoT} firmware via augmented process emulation
US8671393B2 (en) Collaborative software debugging in a distributed system with client-specific dynamic breakpoints
CN107077412B (en) Automated root cause analysis for single or N-tier applications
US7818721B2 (en) Dynamic application tracing in virtual machine environments
TWI575397B (en) Point-wise protection of application using runtime agent and dynamic security analysis
US6363467B1 (en) Apparatus and method for allocating memory space for program use and management purposes
CN106126423B (en) The test method of game application, apparatus and system
CN112181833A (en) Intelligent fuzzy test method, device and system
CN105791261A (en) Detection method and detection device for cross-site scripting attack
Marsden et al. Dependability of CORBA systems: Service characterization by fault injection
US8533683B2 (en) Stack walking enhancements using sensorpoints
Shahriar et al. Mutation-based testing of buffer overflow vulnerabilities
Kollenda et al. Towards automated discovery of crash-resistant primitives in binary executables
Jeong et al. Fifa: A kernel-level fault injection framework for arm-based embedded linux system
CN110941534A (en) Method and system for detecting third-party code call of web application
CN110704315A (en) Fault injection device for embedded software test
Eisele et al. Fuzzing Embedded Systems Using Debug Interfaces
CN112765032A (en) Program debugging method, device, equipment and storage medium
CN108304230B (en) Implementation method and device for adjusting application attribute and readable storage medium
US9841960B2 (en) Dynamic provision of debuggable program code
David et al. From source code to crash test-cases through software testing automation
Marsden et al. Failure mode analysis of CORBA Service Implementations
Marhefka et al. Dfuzzer: A D-bus service fuzzing tool
CN113900908B (en) Log updating method and device, electronic equipment and storage medium

Legal Events

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