A program control method, device, computer equipment and storage medium
By using instrumentation functions in embedded systems to obtain and parse debugging information and dynamically control the program, the problem of low program modification efficiency in embedded systems is solved, program control without recompiling and restarting the device is realized, and control efficiency is improved .
Patent Information
- Application Number
- CN202010501224.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-04
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2040-06-04
AI Technical Summary
When existing embedded systems need to modify code to change program behavior during program operation, they need to recompile, release and restart the device, resulting in inefficiency.
By presetting instrumentation functions in the pending program to obtain debug information, parsing this information to dynamically control the program, avoiding recompilation and restart.
It realizes dynamic control of the program without recompiling the software version or restarting the device, and improves the control efficiency of the program.
Smart Images

Figure CN113760290B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a program control method, apparatus, computer equipment and storage medium. Background Art
[0002] Embedded technology is a device or system that performs dedicated functions and is controlled by an internal computer. With the development of embedded technology, embedded systems play an irreplaceable role in production, life, industry, agriculture, etc. Especially for the fields of industry, aviation, communications, etc., embedded devices play a decisive role and their application requires uninterrupted operation.
[0003] Most embedded systems are customized by users for specific tasks, and the software systems in embedded systems usually need to be implemented using dedicated programming languages, such as C language or assembly language. In the application process of embedded systems, failures, changes in requirements or hardware damage are inevitable. Therefore, during the program running in the embedded system, it is often necessary to monitor the program running process, or change the program behavior when necessary.
[0004] Currently, if you need to change the behavior of a program, the most common way is to modify the program code. After the program code is modified, you need to recompile the program, release and replace the software version, and restart the device or restart the program. For large projects, this takes a lot of time and is inefficient. Summary of the invention
[0005] The embodiments of the present application provide a program control method, apparatus, computer device and storage medium to dynamically control a program, thereby improving the control efficiency of the program.
[0006] In a first aspect, an embodiment of the present application provides a program control method, including:
[0007] Obtaining debugging information generated during the compilation of the program to be processed; the debugging information is obtained through an instrumentation function preset in the program to be processed;
[0008] Parsing the debugging information to obtain a debugging information parsing result;
[0009] The program to be processed is controlled according to the debugging information analysis result.
[0010] In a second aspect, an embodiment of the present application further provides a program control device, including:
[0011] A debugging information acquisition module, used to acquire debugging information generated by the program to be processed during compilation; the debugging information is acquired through an instrumentation function preset in the program to be processed;
[0012] A debugging information parsing module, used to parse the debugging information and obtain a debugging information parsing result;
[0013] A program control module is used to control the program to be processed according to the debugging information analysis result.
[0014] In a third aspect, an embodiment of the present application further provides a computer device, the computer device comprising:
[0015] one or more processors;
[0016] A storage device for storing one or more programs;
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement any program control method described in the first aspect.
[0018] In a fourth aspect, an embodiment of the present application further provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, any program control method described in the first aspect is implemented.
[0019] The embodiment of the present application obtains debugging information generated by the program to be processed during compilation by means of an instrumentation function preset in the program to be processed, and parses the obtained debugging information to obtain a debugging information parsing result, and then controls the program to be processed according to the debugging information parsing result, thereby solving the problem of low efficiency that exists when the program needs to be controlled through editing operations such as recompilation, release and replacement, and dynamically controlling the program without recompiling the software version, replacing the software, restarting the device or restarting the program, thereby improving the control efficiency of the program. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flowchart of a program control method provided in an embodiment of the present application;
[0021] Figure 2 A flowchart of a program control method provided in an embodiment of the present application;
[0022] Figure 3 It is a schematic diagram of a program control provided in an embodiment of the present application;
[0023] Figure 4 A schematic diagram of a program control device provided in an embodiment of the present application;
[0024] Figure 5 A schematic diagram of the structure of a computer device provided for this application; DETAILED DESCRIPTION
[0025] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0026] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no special meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0027] In order to make the purpose, technical solution and advantages of the present application more clear, the embodiments of the present application will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other arbitrarily without conflict.
[0028] In an exemplary embodiment, Figure 1 A flowchart of a program control method provided in an embodiment of the present application. The method is applicable to the case of dynamically controlling a program. The method can be executed by a program control device provided in the present application, and the program control device can be implemented by software and / or hardware and integrated in a computer device.
[0029] like Figure 1 As shown, the program control method provided in the embodiment of the present application includes:
[0030] S110, obtaining debugging information generated during the compilation of the program to be processed; the debugging information is obtained through an instrumentation function preset in the program to be processed.
[0031] Among them, the program to be processed can be a program that needs to be dynamically controlled, illustratively, a C language program or a C++ voice program, etc. The embodiment of the present application does not limit the type of the specific programming language used by the program to be processed. The debugging information can be the relevant information generated by the program to be processed when it is compiled, and has a certain data format, and the type of its data format depends on the type of programming language used. For example, if the programming language of the program to be processed adopts C language, the debugging information can be pointer information or input parameter information during function call, etc. The embodiment of the present application does not limit the specific type of debugging information.
[0032] In an embodiment of the present application, the program to be processed can be dynamically controlled by a computer device connected to the program to be processed. Before the program to be processed runs, a plug-in function can be preset in the program to be processed in advance. The number of the plug-in functions can be one or more, which can be specifically set according to actual needs, and the embodiment of the present application does not limit the number of the plug-in functions. Accordingly, when the program to be processed is compiled and run, the debugging information generated by the program to be processed can be obtained by the plug-in function built into the program to be processed, and the obtained debugging information is sent to the computer device connected to the program to be processed.
[0033] S120: parse the debugging information to obtain a debugging information parsing result.
[0034] The debugging information analysis result may be an analysis result obtained by analyzing the debugging information.
[0035] Correspondingly, after the computer device obtains the debugging information generated by the program to be processed, the debugging information can be parsed to obtain a matching debugging information parsing result. The debugging information parsing result can reflect the parameter information specifically involved in the compilation and operation of the program to be processed. For example, if the programming language of the program to be processed adopts C language, the debugging information parsing result can be, for example, the stack information of the function call or the input parameter value. That is, the debugging information can specifically be the behavior data of the program to be processed, and the debugging information parsing result can be a semantic analysis of the behavior data.
[0036] It should be noted that since the debugging information has a certain data format, the data format corresponding to the debugging information may be different when the type of programming language used by the program to be processed is different. Therefore, the debugging information needs to be parsed according to its specific data format to avoid parsing failure.
[0037] Exemplarily, assuming that the data format of the debugging information is: byte 1: Ab, byte 2: Ac, byte 3: D, the debugging information parsing result of the debugging information may be: the data of byte 1 plus the data of byte 3 to obtain parameter E, that is, E=AbD.
[0038] S130: Control the program to be processed according to the debugging information analysis result.
[0039] Accordingly, after the computer device obtains the debugging information analysis result corresponding to the debugging information, the program to be processed can be controlled according to the debugging information analysis result. The so-called control may be, for example, monitoring the internal running state of the program to be processed, changing the information output by the program to be processed, or changing the running behavior of the program to be processed, etc. The embodiment of the present application does not limit the type of control behavior of the program to be processed. It should be noted that controlling the program to be processed according to the debugging information analysis result may be dynamically controlling the program to be processed in the running state.
[0040] In the above scheme, the debugging information generated by the program to be processed during the compilation period is obtained by the plug-in function preset in the program to be processed, and the program to be processed in the running state is dynamically controlled according to the debugging information parsing result of the debugging information. That is, the program control method provided in the embodiment of the present application does not need to interrupt the running state of the program to be processed, so there is no need to recompile the software version of the program to be processed and replace the new program to be processed, and there is no need to restart the device or the program to be processed. The program to be processed can be dynamically controlled during its running process to solve the failure problem of the program to be processed, or change the behavior requirements of the program to be processed. It can be seen from this that dynamic control of the program during the program running process can greatly reduce the time consumed by program modification, recompilation, replacement of old versions and reoperation, thereby improving the control efficiency of the program.
[0041] The embodiment of the present application obtains debugging information generated by the program to be processed during compilation by means of an instrumentation function preset in the program to be processed, and parses the obtained debugging information to obtain a debugging information parsing result, and then controls the program to be processed according to the debugging information parsing result, thereby solving the problem of low efficiency that exists when the program needs to be controlled through editing operations such as recompilation, release and replacement, and dynamically controlling the program without recompiling the software version, replacing the software, restarting the device or restarting the program, thereby improving the control efficiency of the program.
[0042] In an exemplary embodiment, Figure 2 A flowchart of a program control method provided in an embodiment of the present application. This embodiment is specific based on the above embodiment. In this embodiment, multiple optional specific implementation methods for controlling the program to be processed according to the debugging information analysis result are provided. Figure 2 As shown, the method of this embodiment may include:
[0043] S210: When a connection is established with the program to be processed, the function calling behavior in the program to be processed is captured by the stub function to obtain debugging information generated by the program to be processed during compilation.
[0044] It should be noted that the computer device that dynamically controls the program to be processed needs to establish a connection with the program to be processed before it can control the program to be processed. Correspondingly, if the computer device does not establish a connection with the program to be processed, the stub function can do nothing at this time, that is, it does not perform the capture operation of the function call behavior. After the computer device establishes a connection with the program to be processed, the stub function starts to perform the capture operation and captures the function call behavior in the program to be processed to obtain the debugging information generated by the program to be processed during the compilation period.
[0045] In an optional embodiment of the present application, the debugging information may include at least one of a current pointer variable, a stack pointer, an input parameter type, an input parameter stack position, and an input parameter structure obtained when the instrumentation function captures function call behavior.
[0046] Optionally, the debugging information may include, but is not limited to, the current pointer variable stack pointer, input parameter type, input parameter stack position, and input parameter structure obtained when the instrumentation function captures the function call behavior. Among them, the current pointer variable can be used to determine the function type captured by the instrumentation function, and can be used to further determine the call chain of the calling function of the program to be processed. The stack pointer can be used to determine the stack information of the program to be processed. The input parameter type, input parameter stack position, and input parameter structure can be used to determine the input parameter information, such as the input parameter type or input parameter value.
[0047] S220: parse the debugging information to obtain a debugging information parsing result.
[0048] In an optional embodiment of the present application, the debugging information parsing result may include at least one of the call stack association information, input parameter type and input parameter value called by the function call behavior in the program to be processed; wherein, the call stack association information may include call chain and / or stack information.
[0049] Optionally, the debugging information parsing result may include, but is not limited to, call stack association information, input parameter type, and input parameter value called by the function call behavior in the program to be processed. The call stack association information may include call chain and / or stack information, which can be obtained by parsing the current pointer variable and the stack pointer, the input parameter type can be parsed and obtained according to the input parameter type in the debugging information, and the input parameter value can be parsed and obtained according to the input parameter stack position and the input parameter structure.
[0050] S230: Execute a dynamic instruction that has a mapping relationship with the plug-in function according to the debugging information analysis result to control the program to be processed.
[0051] The dynamic instructions include dynamic commands and / or dynamic scripts.
[0052] Among them, dynamic instructions can be used to dynamically control the program to be processed, such as modifying the behavior of the calling function. Dynamic instructions may include but are not limited to dynamic commands and / or dynamic scripts. Dynamic commands may be commands commonly used in programs, such as delay, print parameter, parameter save, return and other commands. Dynamic scripts may refer to scripts of interpreted nature written in high-level languages, which can be modified dynamically without the need for compilation, packaging and publishing operations.
[0053] Optionally, the computer device can execute dynamic instructions such as dynamic commands and / or dynamic scripts that have a mapping relationship with the plug-in function according to the obtained debugging information analysis result, and dynamically control the program to be processed. It should be noted that the plug-in function can be set to one or more dynamic commands and / or dynamic scripts, that is, the plug-in function can establish a mapping relationship with one or more dynamic commands and / or dynamic scripts, and the embodiment of the present application does not limit the number of dynamic commands and / or dynamic scripts set corresponding to the plug-in function.
[0054] Figure 3 is a schematic diagram of a program control provided by an embodiment of the present application. In an optional example, Figure 3 As shown, an embedded C language program is used as a program to be processed, and a behavior capture kit is used to dynamically control the runtime C program. The behavior capture kit can be run in a computer device connected to the program to be processed. Optionally, multiple plug-in functions ( Figure 3 3 stub functions are preset in the ). When the runtime C program is not connected to the behavior capture suite, the stub function does not do anything. When the behavior capture suite is connected to the runtime C program through a network cable or serial port, the stub function can start capturing the function call behavior in the C program to obtain the current IP pointer, stack pointer, input parameter type, input parameter stack position, and input parameter structure debugging information generated by the runtime C program during compilation, and send the obtained debugging information to the behavior capture suite.
[0055] The behavior capture suite includes a remote dynamic parser that can receive debugging information sent by the instrumented function. The remote dynamic parser can parse the debugging information and analyze the stack structure of the runtime C program, thereby obtaining the debugging information parsing results such as the call chain, stack information, input parameter type and input parameter value of the current calling function, that is, obtaining the analysis results of the stack results. Correspondingly, the remote dynamic parser can execute the dynamic commands and / or dynamic scripts corresponding to the instrumented function according to the analysis results of the stack results, so as to perform dynamic control operations such as monitoring the internal running status of the runtime C program, changing the output printing information of the program, or changing the running behavior of the program.
[0056] like Figure 3 As shown, the behavior capture suite can also include a behavior record database and a behavior display module. The behavior record database can be used to record the time, parameter information, call chain or stack information of the function call behavior, and the behavior record database can also provide mechanisms such as data query, analysis or filtering to process the stored data. The behavior display module can provide a visual display function to display the behavior information collected during the program control process, that is, the data stored in the behavior record database.
[0057] Accordingly, S230 may include:
[0058] S231a, traverse the debugging information analysis results to find the input parameters to be controlled.
[0059] S232a. Modify the current parameter value of the input parameter to be controlled to the target parameter value according to the pre-configured dynamic script.
[0060] The input parameter to be controlled may be an input parameter that needs to be dynamically controlled in the program to be processed. The current parameter value may be the parameter value currently used by the input parameter to be controlled, and the target parameter value may be a parameter value set for the control requirement of the program to be processed.
[0061] Optionally, when a computer device dynamically controls a program to be processed, if it is necessary to handle program failures or hardware failures (such as hardware damage, etc.), the debugging information parsing results can be traversed to find the input parameter to be controlled, and the dynamic script pre-configured by the plug-in function that captures the debugging information can be used to modify the current parameter value of the input parameter to be controlled to the target parameter value.
[0062] In an alternative example, combining Figure 3 Take an example. Assuming that the C program is used as the program to be processed, one or more stub functions are preset before the C program runs. If the target input parameter value of the target function in the C program is 100, it will cause a program failure. When the target input parameter value is detected to be 100, the parameter value of the target input parameter needs to be modified to 200. To this end, a dynamic script can be configured in the behavior capture suite. The function of the dynamic script is: when it is detected that the parameter value of the target input parameter of the target function is 100, the parameter value of the target input parameter is modified to 200. Correspondingly, if the target function call of the C program at runtime is captured by the stub function, the behavior capture suite can traverse the debugging information parsing results, find the target input parameter, and modify the current parameter value of the target input parameter from 100 to 200, thereby effectively avoiding program failure problems.
[0063] S231b, traverse the debugging information analysis results to find the input parameters to be controlled.
[0064] S232b. Perform a data output operation on the input parameter to be controlled according to a pre-configured dynamic command.
[0065] The data output operation includes printing the current parameter value of the input parameter to be controlled, and / or storing the current parameter value of the input parameter to be controlled.
[0066] Optionally, when a computer device dynamically controls a program to be processed, if it is necessary to analyze the function input parameters in the program, the debugging information parsing results can be traversed to find the input parameter parameters to be controlled, and the dynamic commands pre-configured by the plug-in function that captures the debugging information can be used to perform data output operations such as printing parameter values or storing parameter values on the input parameter parameters to be controlled.
[0067] In an alternative example, combining Figure 3 Take an example. Assuming that the C program is used as the program to be processed, one or more stub functions are preset before the C program runs. If there is a need to print and analyze the target input parameters of the target function in the C program, a dynamic command can be configured in the behavior capture suite. The function of the dynamic command is to print and store the current parameter value of the target input parameter of the target function. Correspondingly, if the target function of the C program is captured by the stub function when it is called at runtime, the behavior capture suite can traverse the debugging information parsing results, find the target input parameters, and obtain the current parameter values of the target input parameters. The current parameter values can be stored in the behavior recording database, so as to analyze and display the current parameter values of the target input parameters through the behavior recording database.
[0068] S231c. Store the debugging information analysis result and the behavior information associated with the debugging information analysis result in a behavior record database.
[0069] The associated behavior information includes the time of function calling.
[0070] The associated behavior information may include relevant information of calling functions in the debugging information, such as the time of function calling.
[0071] Optionally, when a computer device dynamically controls a program to be processed, if it is necessary to monitor the running process of the program, the debugging information analysis results and the associated behavior information of the debugging information analysis results can be stored in a behavior record database for visual display or analysis based on the data obtained from the behavior database.
[0072] By adopting the above technical solution, the debugging information generated by the program to be processed during the compilation period is obtained by presetting the plug-in function in the program to be processed, so as to parse the obtained debugging information to obtain the debugging information parsing result, and then control the program to be processed according to the debugging information parsing result, such as monitoring the internal running state of the program to be processed, changing the output printing information of the program to be processed, changing the running behavior of the program to be processed, etc. When there is a fault in the program to be processed or the demand changes, the behavior of the function can be changed dynamically. When the hardware is damaged, the fault can also be downgraded, etc. It can avoid modifying the code, recompiling the program, releasing and replacing the software version, thereby improving the control efficiency of the program.
[0073] In an exemplary embodiment, Figure 4 A schematic diagram of a program control device provided in an embodiment of the present application, which can be implemented by software and / or hardware and integrated in a computer device.
[0074] like Figure 4 The program control device shown includes: a debugging information acquisition module 310, a debugging information parsing module 320 and a program control module 330, wherein:
[0075] The debugging information acquisition module 310 is used to acquire the debugging information generated by the program to be processed during the compilation period; the debugging information is acquired through the plug-in function preset in the program to be processed;
[0076] The debugging information parsing module 320 is used to parse the debugging information and obtain the debugging information parsing result;
[0077] The program control module 330 is used to control the program to be processed according to the debugging information analysis result.
[0078] The embodiment of the present application obtains debugging information generated by the program to be processed during compilation by means of an instrumentation function preset in the program to be processed, and parses the obtained debugging information to obtain a debugging information parsing result, and then controls the program to be processed according to the debugging information parsing result, thereby solving the problem of low efficiency that exists when the program needs to be controlled through editing operations such as recompilation, release and replacement, and dynamically controlling the program without recompiling the software version, replacing the software, restarting the device or restarting the program, thereby improving the control efficiency of the program.
[0079] Optionally, the debugging information acquisition module 310 is specifically used to: when establishing a connection with the program to be processed, capture the function call behavior in the program to be processed through the instrumentation function to obtain the debugging information generated by the program to be processed during compilation.
[0080] Optionally, the program control module 330 is specifically used to: execute a dynamic instruction that has a mapping relationship with the plug-in function according to the debugging information analysis result to control the program to be processed; wherein the dynamic instruction includes a dynamic command and / or a dynamic script.
[0081] Optionally, the program control module 330 is specifically used to: traverse the debugging information analysis results to find the input parameter to be controlled; and modify the current parameter value of the input parameter to be controlled to the target parameter value according to a pre-configured dynamic script.
[0082] Optionally, the program control module 330 is specifically used to: traverse the debugging information parsing results to find the input parameter to be controlled; perform a data output operation on the input parameter to be controlled according to a pre-configured dynamic command; wherein the data output operation includes printing the current parameter value of the input parameter to be controlled, and / or storing the current parameter value of the input parameter to be controlled.
[0083] Optionally, the program control module 330 is specifically used to: store the debugging information analysis result and the associated behavior information of the debugging information analysis result into a behavior record database; wherein the associated behavior information includes the time of the function call.
[0084] Optionally, the debugging information includes at least one of a current pointer variable, a stack pointer, an input parameter type, an input parameter stack position, and an input parameter structure obtained when the instrumentation function captures function call behavior.
[0085] Optionally, the debugging information parsing result includes at least one of call stack association information, input parameter type and input parameter value called by the function call behavior in the program to be processed; wherein the call stack association information includes call chain and / or stack information.
[0086] The above program control device can execute the program control method provided in the embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the program control method provided in the embodiment of the present application.
[0087] In an exemplary embodiment, the present application also provides a computer device, Figure 5 A schematic diagram of the structure of a computer device provided for this application, such as Figure 5 As shown, the computer device provided by the present application includes: one or more processors 410 and a storage device 420; the processor 410 of the computer device can be one or more, Figure 5 A processor 410 is taken as an example; the storage device 420 is used to store one or more programs; the one or more programs are executed by the one or more processors 410, so that the one or more processors 410 implement the program control method as described in the embodiment of the present application.
[0088] The processor 410 and the storage device 420 in the computer device may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0089] The storage device 420, as a computer-readable storage medium, can be configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the program control method described in the embodiment of the present application (for example, the debugging information acquisition module 310, the debugging information parsing module 320 and the program control module 330 in the program control device). The storage device 420 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may store data created according to the use of the device, etc. In addition, the storage device 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the storage device 420 may further include a memory remotely arranged relative to the processor 410, and these remote memories may be connected to the communication node via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0090] An embodiment of the present application also provides a storage medium, which stores a computer program. When the computer program is executed by a processor, the program control method in the embodiment of the present application is implemented: obtaining debugging information generated by a program to be processed during compilation; obtaining the debugging information through an instrumentation function preset in the program to be processed; parsing the debugging information to obtain a debugging information parsing result; and controlling the program to be processed according to the debugging information parsing result.
[0091] Through the above description of the implementation method, the technicians in the relevant field can clearly understand that the present application can be implemented with the help of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a communication device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0092] It is worth noting that in the embodiment of the above-mentioned program control device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application.
[0093] The above description is merely an exemplary embodiment of the present application and is not intended to limit the protection scope of the present application.
[0094] In general, various embodiments of the present application can be implemented in hardware or dedicated circuits, software, logic or any combination thereof. For example, some aspects can be implemented in hardware, while other aspects can be implemented in firmware or software that can be executed by a controller, microprocessor or other computing device, although the present application is not limited thereto.
[0095] Embodiments of the present application may be implemented by executing computer program instructions by a data processor of a mobile device, for example in a processor entity, or by hardware, or by a combination of software and hardware. The computer program instructions may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages.
[0096] The block diagram of any logic flow in the accompanying drawings of the present application can represent program steps, or can represent interconnected logic circuits, modules and functions, or can represent a combination of program steps and logic circuits, modules and functions. The computer program can be stored in a memory. The memory can have any type suitable for the local technical environment and can be implemented using any suitable data storage technology, such as but not limited to read-only memory (ROM), random access memory (RAM), optical memory device and system (digital versatile disc DVD or CD disc), etc. Computer-readable media may include non-transient storage media. The data processor can be any type suitable for the local technical environment, such as but not limited to a general-purpose computer, a special-purpose computer, a microprocessor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a programmable logic device (FGPA) and a processor based on a multi-core processor architecture.
[0097] By way of exemplary and non-limiting examples, a detailed description of exemplary embodiments of the present application has been provided above. However, various modifications and adjustments to the above embodiments will be apparent to those skilled in the art when considered in conjunction with the accompanying drawings and claims, but will not depart from the scope of the present application. Therefore, the proper scope of the present application will be determined according to the claims.
Claims
1. A program control method, characterized in that: include: When a connection is established with the program to be processed, a function call behavior in the program to be processed is captured by a plug-in function preset in the program to be processed, so as to obtain debugging information generated by the program to be processed during compilation; Parsing the debugging information to obtain a debugging information parsing result; The debugging information parsing result is a semantic analysis of the behavior data; Executing a dynamic instruction that has a mapping relationship with the plug-in function according to the debugging information analysis result to control the program to be processed; The dynamic instructions include dynamic commands and / or dynamic scripts; the program to be processed is a program that needs to be dynamically controlled.
2. The method according to claim 1, characterized in that The executing, according to the debugging information parsing result, a dynamic instruction having a mapping relationship with the instrumentation function comprises: Traverse the debugging information parsing results to find the input parameters to be controlled; The current parameter value of the input parameter to be controlled is modified to the target parameter value according to the pre-configured dynamic script.
3. The method according to claim 1, characterized in that The executing, according to the debugging information parsing result, a dynamic instruction having a mapping relationship with the plugged function includes: Traverse the debugging information parsing results to find the input parameters to be controlled; Performing a data output operation on the input parameter to be controlled according to a pre-configured dynamic command; The data output operation includes printing the current parameter value of the input parameter to be controlled, and / or storing the current parameter value of the input parameter to be controlled.
4. The method according to claim 1, characterized in that The executing, according to the debugging information parsing result, a dynamic instruction having a mapping relationship with the instrumentation function comprises: storing the debugging information analysis result and the behavior information associated with the debugging information analysis result in a behavior record database; The associated behavior information includes the time of function calling.
5. The method according to any one of claims 1 to 4, characterized in that: The debugging information includes at least one of a current pointer variable, a stack pointer, an input parameter type, an input parameter stack position, and an input parameter structure obtained when the stub function captures function call behavior.
6. The method according to any one of claims 1 to 4, characterized in that: The debugging information parsing result includes at least one of call stack association information, input parameter type and input parameter value called by the function call behavior in the program to be processed; The call stack association information includes call chain and / or stack information.
7. A program control device, characterized in that: include: A debugging information acquisition module, used to capture function call behavior in the program to be processed by using a plug-in function preset in the program to be processed when a connection is established with the program to be processed, so as to obtain debugging information generated by the program to be processed during compilation; A debugging information parsing module, used to parse the debugging information and obtain a debugging information parsing result; The debugging information parsing result is a semantic analysis of the behavior data; A program control module is used to execute dynamic instructions that are mapped to the plug-in function according to the debugging information analysis result to control the program to be processed; wherein the dynamic instructions include dynamic commands and / or dynamic scripts; and the program to be processed is a program that needs to be dynamically controlled.
8. A computer device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the program control method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the program control method according to any one of claims 1 to 6 is implemented.
