CN116820959A - Online debugging method and device - Google Patents
Online debugging method and device Download PDFInfo
- Publication number
- CN116820959A CN116820959A CN202310771634.6A CN202310771634A CN116820959A CN 116820959 A CN116820959 A CN 116820959A CN 202310771634 A CN202310771634 A CN 202310771634A CN 116820959 A CN116820959 A CN 116820959A
- Authority
- CN
- China
- Prior art keywords
- target
- code
- debugging
- injection
- service program
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 179
- 238000002347 injection Methods 0.000 claims abstract description 128
- 239000007924 injection Substances 0.000 claims abstract description 128
- 239000003795 chemical substances by application Substances 0.000 claims description 19
- 238000004891 communication Methods 0.000 claims description 4
- 238000005516 engineering process Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 238000002513 implantation Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000000243 solution Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3644—Software debugging by instrumenting at runtime
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45591—Monitoring or debugging support
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Debugging And Monitoring (AREA)
Abstract
The specification provides an online debugging method and device, which are applied to a server; the server is deployed with a target service program; the method comprises the following steps: acquiring a loading address and injection parameters of a target debugging code; the injection parameters are used for specifying target injection positions of the target debugging codes in the target service program; and acquiring the target debugging code according to the loading address, and injecting the target debugging code into a target injection position in the target service program based on the injection parameter so as to debug the target service program on line.
Description
Technical Field
The present application relates to the field of vehicle technologies, and in particular, to an online debugging method, an online debugging device, an electronic device, and a machine-readable storage medium.
Background
In the current technology, debugging a service program deployed in an operating environment generally requires interrupting the service program, adding a debugging code into the service program, and recompiling, loading and operating the service code after the debugging code is added to debug the service program.
In this case, since the interruption of the service program is required to break the continuity of the on-line service corresponding to the service program, and the above-described procedure is repeated to debug the service program, the time for debugging is increased, resulting in low efficiency of debugging.
Disclosure of Invention
The application provides an online debugging method which is applied to a server; the server is deployed with a target service program; the method comprises the following steps:
acquiring a loading address and injection parameters of a target debugging code; the injection parameters are used for specifying target injection positions of the target debugging codes in the target service program;
and acquiring the target debugging code according to the loading address, and injecting the target debugging code into a target injection position in the target service program based on the injection parameter so as to debug the target service program on line.
Optionally, the method further comprises:
and loading an agent program in a target running environment where the target service program is located so as to execute the agent program to complete the online debugging method.
Optionally, the target running environment is a target virtual machine where the target service program is located.
Optionally, before loading the agent program in the target running environment where the target service program is located, the method further includes:
determining each virtual machine running at the current moment in the server;
and determining the target virtual machine where the target service program is located from the virtual machines based on the obtained indication information for indicating the target service program.
Optionally, the indication information includes a name of the target service program.
Optionally, the injection parameters include a combination of one or more of the parameters shown below:
designating a target class name of the target debugging code in the target service program;
specifying a target method name of the target debugging code in the target service program;
and designating an object code row of the object debugging code in the object service program.
Optionally, if the injection parameter includes a target class name specifying the target debugging code in the target business program, before injecting the target debugging code into a target injection location in the target business program, the method further comprises:
determining each class loaded in the target running environment;
and determining a target class to be injected by the target debugging code in the target service program from the classes based on the target class name.
Optionally, if the injection parameter includes a target method name specifying the target debugging code in the target business program, before injecting the target debugging code into a target injection location in the target business program, the method further comprises:
determining respective methods in the target class;
and determining a target method to be injected by the target debugging code in the target service program from the methods based on the method names.
Optionally, if the injection parameter includes an object code line specifying the object debugging code in the object service program, injecting the object debugging code into an object injection location in the object service program includes:
and injecting the target debugging code into the target code row in the target method in the target business program based on the target code row.
Optionally, if the injection parameter does not include an object code line specifying the object debugging code in the object service program, injecting the object debugging code into an object injection location in the object service program includes:
injecting the target debugging code before the target method in the target business program according to a first injection method for injecting the target debugging code before the target method;
the target debugging code is injected after the target method in the target business program according to a second injection method for injecting the target debugging code after the target method.
The application also provides an online debugging device which is applied to the server; the server is deployed with a target service program; the device comprises:
the acquisition unit is used for acquiring the loading address and the injection parameter of the target debugging code; the injection parameters are used for specifying target injection positions of the target debugging codes in the target service program;
and the injection unit is used for acquiring the target debugging code according to the loading address, and injecting the target debugging code into a target injection position in the target service program based on the injection parameter so as to debug the target service program online.
The application also provides electronic equipment, which comprises a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are mutually connected through the bus;
the memory stores machine readable instructions, and the processor executes the online debugging method by invoking the machine readable instructions.
The present application also provides a machine-readable storage medium storing machine-readable instructions that, when invoked and executed by a processor, implement the online debugging method.
The technical scheme provided by the application at least can comprise the following beneficial effects:
through the above embodiment, the server may obtain the loading address and the injection parameter of the target debugging code, and because the injection parameter may be used to specify the target injection position of the target debugging code in the target service program, the server may obtain the target debugging code first according to the loading address, and then may inject the target debugging code into the target injection position in the target service program according to the injection parameter, so as to debug the deployed target service program online, so that it is not necessary to interrupt the target service program and debug the target service program again, and continuity of online service corresponding to the target service program is improved.
Drawings
FIG. 1 is a flow chart illustrating an online debugging method in accordance with an exemplary embodiment.
FIG. 2 is a flow chart illustrating another online debugging method in accordance with an exemplary embodiment.
FIG. 3 is a block diagram of the hardware of an electronic device in which the online debugging device is implemented, as shown in an exemplary embodiment.
FIG. 4 is a block diagram of an online debugging device, as shown in an exemplary embodiment.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than described in this specification. Furthermore, individual steps described in this specification, in other embodiments, may be described as being split into multiple steps; while various steps described in this specification may be combined into a single step in other embodiments.
In the process of service program development, the service program needs to be deployed in an operation environment for debugging, and problems in the service program are detected.
In this case, since the service program needs to be interrupted to join the debug code, continuity of the on-line service corresponding to the service program is broken; and because the process is required to be repeated, the service program is repeatedly debugged, the debugging time is increased, and the debugging efficiency is low.
In view of this, the present application aims to propose an online debugging method. The method debugs the business program by injecting debugging code into a target injection location in the deployed business program.
When implemented, the method is applied to a server in which a target business program is deployed; the server can acquire the loading address and injection parameters of the target debugging code; wherein the injection parameter may be used to specify a target injection location of the target debug code in the target business program;
further, the server may obtain the target debug code according to the loading address, and inject the target debug code into a target injection position in a target service program based on the injection parameter, so as to perform online debugging on the target service program.
Through the above embodiment, the server may obtain the loading address and the injection parameter of the target debugging code, and because the injection parameter may be used to specify the target injection position of the target debugging code in the target service program, the server may obtain the target debugging code first according to the loading address, and then may inject the target debugging code into the target injection position in the target service program according to the injection parameter, so as to debug the deployed target service program online, so that it is not necessary to interrupt the target service program and debug the target service program again, and continuity of online service corresponding to the target service program is improved.
The present application is described below by way of specific embodiments and in connection with specific application scenarios.
Referring to fig. 1, fig. 1 is a flowchart illustrating an online debugging method according to an exemplary embodiment.
The online debugging method in the present specification is an online debugging method for a target business program, and therefore, the server can be deployed with the target business program.
For how to deploy the target service program in the server, please refer to the deployment manner in the current technology, this description is not limited.
As shown in fig. 1, based on the server deployed with the target service program, the server may perform the following steps:
step 102, obtaining a loading address and injection parameters of a target debugging code; the injection parameters are used for specifying target injection positions of the target debugging codes in the target service program.
The loading address of the target debugging code can be used for acquiring the target debugging code which needs to be injected into the target service program. Injection parameters that may be used to specify a target injection location of the target debug code in the target business program.
Note that the target debugging code may include not only a monitoring code or a log output code for debugging the target service code, but also a service code to be injected into the target service program, which is not limited in this specification.
In one embodiment shown, the injection parameters may comprise a combination of one or more of the parameters shown below: designating a target class name of the target debugging code in the target service program; specifying a target method name of the target debugging code in the target service program; and designating an object code row of the object debugging code in the object service program.
By injecting the target class name in the parameter, the target debugging code can be appointed to be injected into the target service program in the target class corresponding to the target class name.
By injecting the target method name in the parameter, a target method corresponding to the target method name in the target class to which the target debug code is injected can be specified.
By injecting the target code line in the parameter, the position corresponding to the target code line in the above method to which the target debugging code is injected can be specified.
It should be noted that the above injection parameters may also include other parameters for specifying a target injection position of the debug code to be injected into the target service program, which is not limited in this specification.
Step 104, according to the loading address, the target debugging code is obtained, and based on the injection parameter, the target debugging code is injected into a target injection position in the target service program, so that the target service program is debugged on line.
The target debugging code can be acquired through the loading address of the target debugging code, and the target debugging code can be injected into the target injection position in the target service program based on the injection parameter for specifying the target injection position.
In this way, the debugging code can be injected into the target service program to debug the target service program, so that the target service program can be debugged without interrupting the target service program, the time required by debugging the service program is reduced, and the debugging efficiency of the service program is improved.
In one embodiment, the online debugging method may be further completed by an agent deployed in the server, and in particular, the server may load the agent in a target running environment where the target service program is located, and complete the online debugging method by executing the agent.
Because the online debugging method can be completed by the agent programs deployed on the server, and each agent program can be respectively used for injecting different target debugging codes into different target injection positions of the target service program so as to debug the target service program, the server can be used for injecting different target debugging codes into different target injection positions of the target service program through the deployed different agent programs so as to debug the target service program.
For example, agent_1 may be used to inject debug code_1 at location_1 of the target business program to debug the target business program; agent_2 may be used to inject debug code_2 at location_2 of the target business program to debug the target business program; the server may inject the debug code_1 into the location_1 of the target service program through the deployed agent_1 to debug the target service program.
In this way, the flexibility of debugging for the target business program can be improved.
It should be noted that the method of loading the agent may be performed by a preset loader, and the server may load the agent by executing the preset loader.
By the method, the server can execute the loading program to load any proxy program, so that the debugging efficiency of debugging the target service program is improved.
In one embodiment, the target operating environment is a target virtual machine where the target business program is located.
The target service program may be a service program corresponding to a Java programming language, in which case the operating environment of the target service program may be a virtual machine, and the target operating environment may be a target virtual machine in which the target service program is located.
In one embodiment, before loading an agent program in a target running environment where the target service program is located, the server may determine each virtual machine in the server that is running at the current time; and determining the target virtual machine where the target service program is located from the virtual machines based on the obtained indication information for indicating the target service program.
And loading the agent program in the target running environment where the target service program is located, namely loading the agent program in the target virtual machine where the target service program is located. In this case, before loading the agent, it is necessary to determine the target virtual machine in which the target service program is located.
The server may determine each virtual machine currently running at the present time first, query a service program running in each virtual machine based on the obtained indication information for indicating the target service program, determine whether the indication information points to a target service program running in any virtual machine in each virtual machine, and if the indication information points to the target service program running in any virtual machine, determine a virtual machine in which the target service program is located as a target virtual machine.
For example, the virtual machine currently running in the server may include a virtual machine_1, a virtual machine_2, and a virtual machine_3, the server may acquire indication information_2 for indicating a target service program, and by querying service programs running in the respective virtual machines, it may be determined that the indication information_2 points to the service program running in the virtual machine_2, and then the virtual machine_2 may be determined as the target virtual machine.
The specification does not limit the specific content of the indication information. For example, the indication information may be a name of the target service program, or the indication information may be a program ID of the target service program, and the indication information may also be any other information that may be used to indicate the target service program.
In one embodiment shown, the indication information includes a name of the target business program.
For example, the virtual machine currently running in the server may include a virtual machine_1, a virtual machine_2, and a virtual machine_3, the server may obtain a name indicating a target service program as a name_2, and by querying service programs running in the respective virtual machines, it may be determined that the service program with the name of the name_2 is running in the virtual machine_2, and then the virtual machine_2 may be determined as the target virtual machine.
In one embodiment shown, if the injection parameter contains a target class name specifying the target debugging code in the target business program, the server may determine the classes loaded in the target runtime environment before injecting the target debugging code at a target injection location in the target business program; and determining a target class to be injected by the target debugging code in the target service program from the classes based on the target class name.
The injection parameter may include a target class name, through which a target class corresponding to the target class name may be specified to be injected with the target debugging code in the target service program.
Specifically, if the injection parameter includes a target class name, the server may determine each class loaded in the target running environment, may query the class name of each class, and may determine a class whose class name is consistent with the target class name as the target class.
For example, the classes loaded in the target running environment may include class_1, class_2 and class_3, the class name of class_1 may be class_1, the class name of class_2 may be class_2, the class name of class_3 may be class_3, the target class name included in the injection parameter may be class_3, the server may query the class names of the respective classes, and may determine that the class with the class name consistent with the target class name is class_3, and then may determine class_3 as the target class.
In this way, the target class in which the target debug code is to be injected in the target business program can be determined.
In one embodiment shown, if the injection parameter contains a target method name specifying the target debugging code in the target business program, the server may determine each method in the target class prior to injecting the target debugging code at a target injection location in the target business program; and a target method to be injected by the target debugging code in the target service program can be determined from the methods based on the method names.
The injection parameter may include a target method name, by which a target method corresponding to the target method name in the above-mentioned target class may be specified to inject the target debugging code into the target service program.
Specifically, if the injection parameter includes a target method name, the server may determine each method included in the target class, and may determine, as the target method, a method in which the method name matches the target method name by querying the method names of each method.
For example, the object class may include a method_1, a method_2, and a method_3, the method name of the method_1 may be a method name_1, the method name of the method_2 may be a method name_2, the method name of the method_3 may be a method name_3, the object method name included in the injection parameter may be a method name_3, the server may query the method names of the respective methods, and may determine that the method name matches the object method name is a method_3, and then the method_3 may be determined as the object method.
In this way, the target method in which the target debug code is to be injected in the target business program can be determined.
In one embodiment shown, if the injection parameter contains a target code line specifying the target debug code in the target business program, the server may inject the target debug code into a target code line in the target method based on the target code line.
The injection parameters may include an object code line by which an object code line in the above-described object method of injecting the object debugging code in the object business program may be specified.
For example, the target method may be method_3, the target code line included in the injection parameter may be the fifth line, and the server may inject the target debug code into the fifth line in the above-described method_3.
In this way, target debug code may be injected into the target code line in the target method.
In one embodiment shown, if the injection parameter does not contain a target code line specifying the target debugging code in the target business program, the server may inject the target debugging code before the target method in the target business program according to a first injection method for injecting the target debugging code before the target method; the target debugging code is injected after the target method in the target business program according to a second injection method for injecting the target debugging code after the target method.
The server may include a first injection method for injecting the target debug code before the target method, and may further include a second injection method for injecting the target debug code after the target method.
For example, the injection parameter may not include an object code line, and when the injection parameter does not include an object code line, the server may inject the object debugging code into a line preceding the first line of the code corresponding to the object method according to the first injection method; the server may further inject the target debug code into a line subsequent to the last line of the code corresponding to the target method according to the second injection method.
In this way, the target debug code may be injected before the target method or after the target method.
In order to better understand the technical solution in the embodiments of the present specification, the embodiments of the present specification are described below with reference to a flowchart of an online debugging method as shown in fig. 2, taking debugging of a target service program as an example.
Referring to fig. 2, fig. 2 is a flow chart illustrating another online debugging method according to an exemplary embodiment. The virtual machine currently running in the server may include a virtual machine_1, a virtual machine_2 and a virtual machine_3, the server may obtain a name_2 for indicating a target service program, and determine that the service program with the name_2 runs in the virtual machine_2 by querying the service programs running in the respective virtual machines, and then determine that the virtual machine_2 is the target virtual machine.
After determining the target virtual machine, a preset loader may be executed, and an agent may be loaded in the target virtual machine to deploy the agent in the server, where the server may inject the target debug code into the target injection location in the target service program by executing the agent.
The agent may first obtain a loading address of the target debug code and an injection parameter, and may obtain the target debug code through the loading address, where the injection parameter may include a target class name "class name_3", a target method "method_3", and a target code line "fifth line", and the agent may inject the target debug code into a target injection location in the target service program based on the injection parameter.
Specifically, the classes loaded in the target running environment may include class_1, class_2 and class_3, the class name of class_1 may be class_1, the class name of class_2 may be class_2, the class name of class_3 may be class_3, the target class name included in the injection parameter may be class_3, the agent may query the class names of the respective classes, and may determine that the class with the class name consistent with the target class name is class_3, and then may determine class_3 as the target class.
The object class may include a method_1, a method_2, and a method_3, the method name of the method_1 may be a method name_1, the method name of the method_2 may be a method name_2, the method name of the method_3 may be a method name_3, the object method name included in the injection parameter may be a method name_3, the agent may query the method names of the respective methods, and may determine that the method name is consistent with the object method name is a method_3, and then the method_3 may be determined as the object method.
Since the injection parameter includes the fifth line of the object code behavior, the agent may inject the object debugging code into the fifth line in the above method_3.
It should be noted that, the injection parameter may not include an object code line, and when the injection parameter does not include an object code line, the agent may inject the object debugging code into a line preceding the first line of the code corresponding to the object method according to the first injection method; the agent may also inject the target debug code into a line subsequent to the last line of code corresponding to the target method according to the second injection method.
Corresponding to the embodiment of the online debugging method, the specification also provides an embodiment of an online debugging device.
Referring to fig. 3, fig. 3 is a hardware configuration diagram of an electronic device where an online debugging device is shown in an exemplary embodiment. At the hardware level, the device includes a processor 302, an internal bus 304, a network interface 306, memory 308, and non-volatile storage 310, although other hardware required for the service is possible. One or more embodiments of the present description may be implemented in a software-based manner, such as by the processor 302 reading a corresponding computer program from the non-volatile storage 310 into the memory 308 and then running. Of course, in addition to software implementation, one or more embodiments of the present disclosure do not exclude other implementation manners, such as a logic device or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but may also be hardware or a logic device.
Referring to fig. 4, fig. 4 is a block diagram illustrating an online debugging device according to an exemplary embodiment. The online debugging device can be applied to the electronic equipment shown in fig. 3 to realize the technical scheme of the specification. Wherein the apparatus is applicable to a server; wherein, the server can be deployed with a target service program; the apparatus may include:
an obtaining unit 402, configured to obtain a loading address and injection parameters of a target debug code; the injection parameters are used for specifying target injection positions of the target debugging codes in the target service program;
and the injection unit 404 is configured to obtain the target debugging code according to the loading address, and inject the target debugging code into a target injection position in the target service program based on the injection parameter, so as to perform online debugging on the target service program.
In this embodiment, the apparatus may further include a loading unit configured to:
and loading an agent program in a target running environment where the target service program is located so as to execute the agent program to complete the online debugging method.
In this embodiment, the target operating environment may be a target virtual machine where the target service program is located.
In this embodiment, the apparatus may further include a determining unit configured to:
before loading an agent program in a target running environment where the target service program is located, determining each virtual machine running at the current moment in the server;
and determining the target virtual machine where the target service program is located from the virtual machines based on the obtained indication information for indicating the target service program.
In this embodiment, the indication information may include a name of the target service program.
In this embodiment, the implantation parameters may include a combination of one or more of the parameters shown below:
designating a target class name of the target debugging code in the target service program;
specifying a target method name of the target debugging code in the target service program;
and designating an object code row of the object debugging code in the object service program.
In this embodiment, the determining unit may further be configured to:
if the injection parameters contain a target class name specifying the target debugging code in the target service program, determining each class loaded in the target running environment before the target debugging code is injected into a target injection position in the target service program;
and determining a target class to be injected by the target debugging code in the target service program from the classes based on the target class name.
In this embodiment, the determining unit may further be configured to:
if the injection parameters contain target method names specifying the target debugging codes in the target business program, determining each method in the target class before injecting the target debugging codes into target injection positions in the target business program;
and determining a target method to be injected by the target debugging code in the target service program from the methods based on the method names.
In this embodiment, the determining unit may further be configured to:
if the injection parameter includes an object code line specifying the object debugging code in the object business program, the object debugging code is injected into an object code line in the object method in the object business program based on the object code line.
In this embodiment, the determining unit may further be configured to:
if the injection parameter does not contain an object code row specifying the object code in the object business program, injecting the object code before the object method in the object business program according to a first injection method for injecting the object code before the object method;
the target debugging code is injected after the target method in the target business program according to a second injection method for injecting the target debugging code after the target method.
The implementation process of the functions and roles of each unit in the device is specifically detailed in the implementation process of the corresponding steps in the method, and will not be described herein.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are illustrative only, in that the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present description. Those of ordinary skill in the art will understand and implement the present application without undue burden.
The system, apparatus, module or unit illustrated in the embodiments may be implemented in particular by a computer chip or entity or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, read only compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by the computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
Specific embodiments of the present description have been described. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The terminology used in the one or more embodiments of the specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the specification. As used in this specification, one or more embodiments and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present description to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
The foregoing description of the preferred embodiment(s) is (are) merely intended to illustrate the embodiment(s) of the present application, and it is not intended to limit the embodiment(s) of the present application to the particular embodiment(s) described.
The user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of related data is required to comply with the relevant laws and regulations and standards of the relevant country and region, and is provided with corresponding operation entries for the user to select authorization or rejection.
Claims (13)
1. An online debugging method is applied to a server; the server is deployed with a target service program; the method comprises the following steps:
acquiring a loading address and injection parameters of a target debugging code; the injection parameters are used for specifying target injection positions of the target debugging codes in the target service program;
and acquiring the target debugging code according to the loading address, and injecting the target debugging code into a target injection position in the target service program based on the injection parameter so as to debug the target service program on line.
2. The method of claim 1, the method further comprising:
in a target running environment where the target service program is located, loading an agent program to execute the agent program to complete the online debugging method according to claim 1.
3. The method of claim 2, wherein the target operating environment is a target virtual machine in which the target business program is located.
4. The method of claim 3, further comprising, prior to loading an agent in a target execution environment in which the target business program is located:
determining each virtual machine running at the current moment in the server;
and determining the target virtual machine where the target service program is located from the virtual machines based on the obtained indication information for indicating the target service program.
5. The method of claim 4, the indication information comprising a name of the target business program.
6. The method of claim 1, the injection parameters comprising a combination of one or more of the parameters shown below:
designating a target class name of the target debugging code in the target service program;
specifying a target method name of the target debugging code in the target service program;
and designating an object code row of the object debugging code in the object service program.
7. The method of claim 6, if the injection parameter includes a target class name specifying the target debugging code in the target business program, the method further comprising, prior to injecting the target debugging code at a target injection location in the target business program:
determining each class loaded in the target running environment;
and determining a target class to be injected by the target debugging code in the target service program from the classes based on the target class name.
8. The method of claim 7, if the injection parameter includes a target method name specifying the target debugging code in the target business program, the method further comprising, prior to injecting the target debugging code at a target injection location in the target business program:
determining respective methods in the target class;
and determining a target method to be injected by the target debugging code in the target service program from the methods based on the method names.
9. The method of claim 8, injecting the target debug code at a target injection location in the target business program if the injection parameters contain a target code line specifying the target debug code in the target business program, comprising:
and injecting the target debugging code into the target code row in the target method in the target business program based on the target code row.
10. The method of claim 8, injecting the target debug code at a target injection location in the target business program if the injection parameters do not contain a target code line specifying the target debug code in the target business program, comprising:
injecting the target debugging code before the target method in the target business program according to a first injection method for injecting the target debugging code before the target method;
the target debugging code is injected after the target method in the target business program according to a second injection method for injecting the target debugging code after the target method.
11. An online debugging device is applied to a server; the server is deployed with a target service program; the device comprises:
the acquisition unit is used for acquiring the loading address and the injection parameter of the target debugging code; the injection parameters are used for specifying target injection positions of the target debugging codes in the target service program;
and the injection unit is used for acquiring the target debugging code according to the loading address, and injecting the target debugging code into a target injection position in the target service program based on the injection parameter so as to debug the target service program online.
12. An electronic device comprises a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are connected with each other through the bus;
the memory stores machine readable instructions, the processor executing the online debugging method of any of claims 1-10 by invoking the machine readable instructions.
13. A machine-readable storage medium storing machine-readable instructions which, when invoked and executed by a processor, implement the online debugging method of any one of claims 1-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310771634.6A CN116820959A (en) | 2023-06-27 | 2023-06-27 | Online debugging method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310771634.6A CN116820959A (en) | 2023-06-27 | 2023-06-27 | Online debugging method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116820959A true CN116820959A (en) | 2023-09-29 |
Family
ID=88112185
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310771634.6A Pending CN116820959A (en) | 2023-06-27 | 2023-06-27 | Online debugging method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116820959A (en) |
-
2023
- 2023-06-27 CN CN202310771634.6A patent/CN116820959A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20190324772A1 (en) | Method and device for processing smart contracts | |
CN106371940B (en) | Method and device for solving program crash | |
CN110879781B (en) | Program debugging method, device, electronic equipment and computer readable storage medium | |
CN107301097B (en) | Method and device for storing calling java object and reference address information of java object | |
CN111309402B (en) | Data monitoring and application program processing method, device and equipment | |
CN114691496A (en) | Unit testing method, unit testing device, computing equipment and medium | |
CN116820959A (en) | Online debugging method and device | |
CN115203050A (en) | Method and device for determining dependency relationship of services | |
CN110688430B (en) | Method and device for obtaining data bypass and electronic equipment | |
CN113849811A (en) | Shared virtual resource analysis method and device | |
CN111625225A (en) | Program specified data output method and device | |
CN111625463B (en) | Program state detection method and device | |
CN116088863B (en) | Fault positioning method and system | |
CN112860224B (en) | Function execution environment construction method and device, electronic equipment and storage medium | |
CN115220970B (en) | Method and device for positioning memory leakage, computer equipment and storage medium | |
CN117251234B (en) | Function calling method and device based on patches | |
CN118035042B (en) | Application program performance analysis method and device, electronic equipment and storage medium | |
CN112817663B (en) | SECCOMP rule acquisition method and device for application program | |
CN117093255A (en) | Version construction method of application program | |
CN116821143A (en) | Data updating method and device | |
CN106502755B (en) | Method and device for checking unknown symbols of Linux kernel module | |
CN117348901A (en) | Service program online updating method and device | |
CN117234936A (en) | Abnormal picture detection method, device, equipment and storage medium | |
CN117271346A (en) | Privacy compliance checking method, device, electronic equipment and readable storage medium | |
CN117608561A (en) | Method and device for determining newly added repetition code |
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 |