Variable tracking method, system, terminal and storage medium in program

By replacing the target variable with a data dictionary variable class in the program and setting a callback function, the problem of cumbersome and limited variable value tracking operations in the existing technology is solved, and the ability to efficiently track variable changes and analyze software problems in the generation environment is realized.

CN119782144APending Publication Date: 2025-04-08SHANGHAI KELIANG INFORMATION ENG
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411642032.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The prior art is cumbersome when tracking variable values ​​in programs, and is limited to an integrated development environment, making it difficult to efficiently analyze software problems in the generation environment.

Method used

By using the data dictionary variable class to build a dictionary variable, replace the target variable, and set a callback function for the dictionary variable, compile and run the target code. If the dictionary variable changes, call the callback function to output log information to determine the variable transfer relationship.

Benefits of technology

It realizes efficiently tracking variable value changes without relying on the integrated development environment, simplifying the process of developers in the production environment to troubleshoot software problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782144A_ABST
    Figure CN119782144A_ABST
Patent Text Reader

Abstract

The embodiments of the present application relate to the field of program automation testing, and disclose a variable tracking method, system, terminal and storage medium in a program. The method provided by the present application includes: determining at least one target variable of the target code; constructing a dictionary variable based on a data dictionary variable class, and replacing the target variable with the dictionary variable, and setting a callback function for the dictionary variable; compiling and running the target code, and if the dictionary variable changes, calling the callback function and outputting log information. The present application also describes a corresponding system for executing the method provided by the present application. The method of the present application improves the convenience of tracking variable changes, and can be used in a production environment without relying on an integrated development environment or debugging tools, thereby improving the efficiency of analyzing software problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of program automation testing, and in particular to a method, system, terminal and storage medium for tracking variables in a program. Background Art

[0002] Taking the integrated development environment Visual Studio as an example, the operation process of debugging and tracking the change of the value of a variable is as follows: first add a breakpoint at the initialization position of the variable that needs to be concerned about, then start debugging, get the memory address of the variable after hitting the breakpoint at the code position of the variable, create a new data breakpoint in the breakpoint interface and fill in the memory address. If the memory value of the variable is modified during operation, the Visual Studio debugger will block at the modification location, thereby tracking where the value of the variable is modified.

[0003] However, when the amount of code is large, this method requires running the code in an integrated development environment for tracking. At the same time, each time you execute a tracking variable, you need to manually find the memory address of the variable to add a breakpoint. The operation is cumbersome and has limitations. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method, system, terminal and storage medium for tracking variables in a program, so as to improve the convenience of tracking variable changes, and at the same time can be used in a generation environment without relying on an integrated development environment or debugging tools, thereby improving the efficiency of analyzing software problems.

[0005] To solve the above technical problems, an embodiment of the present application provides a variable tracking method in a program, the method comprising:

[0006] determining at least one target variable of the target code;

[0007] Construct a dictionary variable based on the data dictionary variable class, and replace the target variable with the dictionary variable, and set a callback function for the dictionary variable;

[0008] Compile and run the target code. If the dictionary variable changes, call the callback function and output log information to determine the target variable transfer relationship.

[0009] The embodiment of the present application also provides a variable tracking system in a program, including:

[0010] A program compilation unit determines at least one target variable of the target code;

[0011] A replacement unit, used for constructing a dictionary variable based on a data dictionary variable class, replacing the target variable with the dictionary variable, and setting a callback function for the dictionary variable;

[0012] The processing unit is used to compile and run the target code, and if the dictionary variable changes, call the callback function and output log information to determine the target variable transfer relationship.

[0013] An embodiment of the present application also provides a terminal, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the variable tracking method in the above-mentioned program.

[0014] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program implements the variable tracking method in the above-mentioned program when executed by a processor.

[0015] Compared with the prior art, the embodiments of the present application use a data dictionary to track the value changes of a variable. It is only necessary to set a callback function for the dictionary variable. When the variable value or memory is modified during the code running process, the monitoring function will be triggered. The log is directly output in the monitoring function. The variable assignment operation can be monitored through the log information, and the problem can be analyzed by observing whether the value state of the dictionary variable recorded in the log is consistent with the expected value and whether the function call stack is consistent with the expected value. Dictionary variables only need to modify the variable type to replace traditional C++ language variables, which is easy to use. Whether in the debugging state or in the running state of the production environment, the value changes can be tracked, which greatly facilitates developers to troubleshoot software problems.

[0016] In addition, a dictionary variable is constructed based on the data dictionary variable class, and the dictionary variable replaces the target variable, including: obtaining the type of the target variable through the Type method of the data dictionary variable class, and obtaining the value of the target variable using the Value method of the data dictionary variable class; generating an object of the digital dictionary of the corresponding type, and replacing the target variable with the dictionary variable.

[0017] In addition, after constructing a dictionary variable based on the data dictionary and replacing the target variable with the dictionary variable, the method also includes: simulating the calculation operation of the target code based on the data dictionary variable class; calling the SetListener method of the data dictionary variable class, obtaining the pointer of the callback function, and setting the callback function for the dictionary variable.

[0018] In addition, if the dictionary variable changes, the callback function is called and log information is output, including: if the dictionary variable is assigned a value, the callback function is triggered, the variable status information is recorded and saved to the log; the status information of the data dictionary variable is determined based on the log information; and the variable transfer relationship of the target variable corresponding to the dictionary variable is determined according to the status information.

[0019] In addition, determining the status information of the data dictionary variable based on the log information includes: determining at least one of the value status, CPU status, and timestamp of the dictionary variable according to the log information; and determining the call stack of the callback function according to the log information. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0021] Figure 1 is a flow chart of a variable tracking method in a program provided according to an embodiment of the present application;

[0022] Figure 2 is an operation flow chart of using data dictionary variables in a C++ program provided according to an embodiment of the present application;

[0023] Figure 3 is a schematic block diagram of a variable tracking system in a program provided according to an embodiment of the present application;

[0024] Figure 4 It is a schematic block diagram of a terminal provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not be construed as any limitation, and the various embodiments can be combined and referenced with each other under the premise of no contradiction.

[0026] One embodiment of the present application relates to a variable tracking method in a program, the method comprising: determining at least one target variable of the target code; constructing a dictionary variable based on a data dictionary variable class, and replacing the target variable with the dictionary variable; compiling and running the target code, if the dictionary variable changes, calling a callback function, and outputting log information. The present application method uses a data dictionary to track the value change of a variable. It only needs to set a callback function for the dictionary variable. When the variable value or memory is modified during the code running process, the monitoring function will be triggered. The log is directly output in the monitoring function. The variable assignment operation can be monitored through the log information, and the problem can be analyzed by observing whether the value state of the dictionary variable recorded in the log is consistent with the expected value and whether the function call stack is consistent with the expected value. Through the above process, it is possible to track the change caused by who modified the variable value. Dictionary variables only need to modify the variable type to replace traditional C++ language variables, which is easy to use. Whether in the debugging state or in the running state of the production environment, the value change can be tracked, which greatly facilitates developers to troubleshoot software problems.

[0027] The variable tracking method in the program of this embodiment is as follows Figure 1 As shown, the specific steps include:

[0028] S1: Determine at least one target variable of the target code.

[0029] Among them, the target code can be the program code entered by the developer when developing the program, or it can be the program code that already exists and can be operated by the developer. The developer can select or specify the program code that needs to track variables as the target code as needed, and the system obtains the program code that needs to track variables that the developer has selected or specified as the target code. Therefore, the target code in this application can be a separate program statement, or a reusable statement with a specific function, or a code composed of multiple functions (that is, there are function calls in the code).

[0030] S2: Construct a dictionary variable based on the data dictionary, replace the target variable with the dictionary variable, and set a callback function for the dictionary variable.

[0031] The structure of the data dictionary variable is essentially a class, in which the base class is ElementBase. The base class ElementBase obtains the specific variable value type through the method Type. Use the data dictionary variable class to build a data dictionary variable to replace the global variables or static variables of the common programming language numeric type, and generate the corresponding data types, such as Boolean, integer, long integer, floating point, etc. Directly use the dictionary variable object to replace the ordinary variable. For example, use the ElementInt class to replace the int integer variable, and use the ElementFloat class to replace the float floating point variable. After using the dictionary variable to replace the target variable, set the change "monitoring function" pointer to the variable. When the variable value or memory is modified during the code running, the monitoring function will be triggered.

[0032] S3: Compile and run the target code. If the dictionary variable changes, call the callback function and output log information.

[0033] Among them, after the code is written correctly, compile and run. In the program framework, if the memory of the monitored variable is modified, the notification callback function will be called. The data dictionary variable class simulates the common calculation operations of the commonly used numerical data types in the C++ language. All assignment operations on numerical data types will trigger the set value method of the data dictionary variable class, and then the data dictionary variable class can capture the modification changes of the numerical variables. Each assignment operation of numerical data will trigger the callback function. By calling the log output by the callback function, you can track who modified the variable value and caused the change. Whether in the debugging state or in the running state of the production environment, you can track the change of the value, which greatly facilitates developers to troubleshoot software problems.

[0034] Further, in the present embodiment, in the program code (i.e., the target code), there may be multiple different types of variables, such as input parameters, member variables, local variables, static variables, return values, etc. Among them, local variables represent variables that can only be used inside the corresponding function body defined. When the function execution ends, the memory space of the local variables defined inside the function body will be released. The target variables of the present application include at least one of input parameters, member variables, static variables and return values. That is, the variable tracking method of the present application can track variables of input parameters, member variables, static variables or return values.

[0035] After obtaining the target code, the target variable specified by the developer can also be used for variable tracking. For example, the developer can specify a variable in the target code as the target variable. After the terminal obtains the target variable, it will track the target variable and further determine other variables related to the target variable in the target code.

[0036] Furthermore, in this embodiment, in step S2, the specific steps of constructing a dictionary variable based on the data dictionary variable class and replacing the target variable with the dictionary variable include:

[0037] S21: Obtain the type of the target variable through the Type method of the data dictionary variable class, and obtain the value of the target variable using the Value method of the data dictionary variable class.

[0038] S22: Generate an object of the digital dictionary of the corresponding type, and replace the target variable with the dictionary variable.

[0039] S23: calling the SetListener method of the data dictionary variable class, and passing the pointer of the callback function to the dictionary variable, so as to set the callback function for the dictionary variable.

[0040] Specifically, a data dictionary variable class is constructed, and the target variable type in the target code is obtained according to the ElementBase::Type method of the data dictionary variable class, and the dictionary variable is replaced with the corresponding data dictionary variable type. For example, if the data type of the target variable here is Int type, the dictionary variable is converted to ElementInt. Further, the ElementInt::Value method of the data dictionary variable class is used to obtain the value of the target variable, and the value is assigned to the corresponding dictionary variable. Here, a callback function is written, and the SetListener method of the data dictionary variable class is called, and the pointer of the callback function is passed to the dictionary variable, so as to set the callback function for the dictionary variable.

[0041] Furthermore, in some embodiments, after constructing a dictionary variable based on the data dictionary and replacing the target variable with the dictionary variable, the following steps are also included: simulating the calculation operation of the target code based on the data dictionary variable class; if an assignment operation is performed on a numerical data type, triggering the Value method of the data dictionary variable class to obtain the value of the target variable, and assigning the value of the target variable to the dictionary variable.

[0042] Specifically, the base class of the data dictionary class is ElementBase. This data dictionary variable class simulates the common operations (assignment operations, numerical operations, bit operations, address acquisition, etc.) of the common numerical data types in the C++ language. Since the data dictionary variable class simulates the common operations of the common numerical data types in the programming language, all assignment operations on the numerical data types will trigger the value setting method of the data dictionary variable class, and then the data dictionary variable class can capture the modification of the numerical variable. When the value of the dictionary variable is modified, the set callback function will be triggered immediately.

[0043] Furthermore, in some embodiments, step S3 further includes the following steps:

[0044] S31: If the dictionary variable is assigned a value, the callback function is triggered, and the variable status information is recorded and saved to the log.

[0045] Specifically, the data dictionary variable class simulates the common calculation operations of the common numeric data types in the C++ language. All assignment operations on numeric data types will trigger the set value method of the data dictionary variable class. When the callback function is triggered, the callback function will count or record the change reasons that caused the variable change and save them to the log.

[0046] S32: Determine status information of data dictionary variables based on log information.

[0047] In some embodiments, determining the state information of the data dictionary variable based on the log information includes: determining at least one of the value state, CPU state, and timestamp of the dictionary variable according to the log information; and determining the call stack of the callback function according to the log information. The problem is analyzed by observing whether the value state of the dictionary variable recorded in the log is consistent with the expected value and whether the function call stack is consistent with the expected value.

[0048] Specifically, determine the value state of the dictionary variable to monitor the variable assignment operation, thereby determining the assignment operation of each variable in the code. At the same time, determine the target variable and the associated variables related to the target variable, and determine the transfer relationship between variables based on the timestamp. In addition, the callback function call process is implemented using a stack. The compiler uses the stack to pass function parameters, save the return address, temporarily save the original value of the register (that is, the context of the function call) for recovery, and store local variables. Through the above steps, the modification of global variables or static variables can be tracked.

[0049] S33: Determine the variable transfer relationship of the target variable corresponding to the dictionary variable according to the state information.

[0050] Specifically, the data dictionary variable class sets the callback function for the dictionary variable by calling the SetListener method of the data dictionary variable class and passing in the pointer of the callback function. When the value of the dictionary variable is modified, the callback function will be triggered immediately. The callback function will count or record the change reasons that caused the variable change and save them to the log. The variable assignment operation can be monitored through the log information, so as to determine the assignment or other operations of each variable in the code, and determine the associated variables related to the target variable, so as to monitor the modification process of the variable.

[0051] Furthermore, in an embodiment of the present application, after the callback function is called and the log information is output, at least one of terminating the program and dumping the dump file is then performed.

[0052] Figure 2A flowchart of using data dictionary variables in a C++ program according to some embodiments of the present application is given. Figure 2 The method shown is Figure 1 A concrete implementation of the corresponding method.

[0053] S310: Modify the C++ program code.

[0054] The C++ program code can be a program code input by a developer when developing a program at a terminal, or a program code that already exists in a client and can be operated by the developer. The developer can select or specify the program code that needs to be tracked according to the needs.

[0055] Further, step S310 may include:

[0056] S3101: Construct global numeric variables or static numeric variables.

[0057] Developers write C++ program code, and there may be multiple different types of variables in the program code, such as input parameters, member variables, local variables, static variables, return values, etc. Among them, local variables refer to variables that can only be used inside the corresponding function body defined. When the function is executed, the memory space of the local variables defined inside the function body will be released. The target variable of this application includes at least one of input parameters, member variables, static variables and return values.

[0058] S3102: Replace the original code variables with dictionary variables.

[0059] After writing C++ program code and determining multiple different types of variables, a data dictionary class is constructed. The target variable type in the target code is obtained according to the ElementBase::Type method of the data dictionary variable class, and the dictionary variable is replaced with the corresponding data dictionary variable type. For example, if the data type of the target variable here is Int type, the dictionary variable is converted to ElementInt. Further, the ElementInt::Value method of the data dictionary variable class is used to obtain the value of the target variable, and the value is assigned to the corresponding dictionary variable.

[0060] S3103: Implement variable change triggering callback function.

[0061] The base class of the data dictionary class is ElementBase. This data dictionary variable class simulates the common operations (assignment operations, numerical operations, bit operations, address acquisition, etc.) of the common numerical data types in the C++ language. Since the data dictionary variable class simulates the common operations of the common numerical data types in the programming language, all assignment operations on the numerical data types will trigger the value setting method of the data dictionary variable class, and then the data dictionary variable class can capture the modification of the numerical variable. Here, a callback function is written to call the SetListener method of the data dictionary variable class, pass in the pointer of the callback function, and set the callback function for the dictionary variable. When the value of the dictionary variable is modified, the set callback function will be triggered immediately.

[0062] S320: Compile and run C++ program code.

[0063] S330: Monitor program execution.

[0064] Further, step S330 may include:

[0065] S3301: Modify variable memory.

[0066] S3302: Variable memory modification triggers callback function.

[0067] S3303: Print call stack and output log.

[0068] After running the program, when all variable memories occur, that is, when a variable is assigned a value of a numerical data type, the set value method of the data dictionary variable class will be triggered. When the callback function is triggered, the callback function will count or record the change reason that caused the variable change and save it to the log. Among them, the log should include at least one of the value status, CPU status, and timestamp of the dictionary variable; and the call stack of the callback function. The variable assignment operation can be monitored through the log information: observe whether the value status of the dictionary variable recorded in the log is consistent with the expected value, and whether the function call stack is consistent with the expected value to analyze the problem. Further determine the assignment or other operations of each variable in the code, and determine the associated variables related to the target variable, so as to monitor the modification process of the variable.

[0069] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.

[0070] Another embodiment of the present application relates to a variable tracking system in a program, such as Figure 3As shown, including:

[0071] A program compilation unit determines at least one target variable of the target code;

[0072] The replacement unit is used to construct a dictionary variable based on the data dictionary variable class, and replace the target variable with the dictionary variable, and set a callback function for the dictionary variable;

[0073] The processing unit is used to compile and run the target code. If the dictionary variable changes, the callback function is called and log information is output to determine the target variable transfer relationship.

[0074] In some embodiments, the program compilation unit accepts the program code that needs to be tracked as the target code selected or specified by the developer, and the system obtains the program code that needs to be tracked as the target code. The target code can be a single program statement, a reusable statement with a specific function, or a code composed of multiple functions (i.e., there are function calls in the code).

[0075] In some embodiments, the replacement unit is used to use a data dictionary variable class to construct a data dictionary variable to replace a global variable or static variable of a common programming language numeric type. The replacement unit is also used to construct a data dictionary variable class, obtain the target variable type in the target code according to the ElementBase::Type method of the data dictionary variable class, and replace the dictionary variable with the corresponding data dictionary variable type. For example, if the data type of the target variable here is Int type, the dictionary variable is converted to ElementInt. The ElementInt::Value method of the data dictionary variable class is further used to obtain the value of the target variable, and the value is assigned to the corresponding dictionary variable.

[0076] In some embodiments, the processing unit is used to compile and run the target code. If the dictionary variable changes, the callback function is called and log information is output; wherein the log information includes at least one of the value state of the dictionary variable, the CPU state, and the timestamp, and the call stack of the callback function. In some embodiments, the processing unit is also used to trigger the set callback function, count or record the reasons for the change that caused the variable change and save it to the log. The variable assignment operation can be monitored through the log information: observe whether the value state of the dictionary variable recorded in the log is consistent with the expected value, and whether the function call stack is consistent with the expected value to analyze the problem. Further determine the assignment or other operations of each variable in the code, and determine the associated variables related to the target variable, so as to monitor the modification process of the variable.

[0077] It is not difficult to find that this embodiment is a system embodiment corresponding to the method embodiment, and this embodiment can be implemented in conjunction with the method embodiment. The relevant technical details mentioned in the method embodiment are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.

[0078] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by this application, but this does not mean that there are no other units in this embodiment.

[0079] Another embodiment of the present application relates to a terminal, such as Figure 4 As shown, comprising at least one processor; and

[0080] a memory communicatively connected to the at least one processor; wherein,

[0081] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the relevant embodiments of the variable tracking method in the above-mentioned program.

[0082] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor.

[0083] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.

[0084] Another embodiment of the present application relates to a computer-readable storage medium storing a computer program, which implements the above method embodiment when executed by a processor.

[0085] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0086] Those skilled in the art will appreciate that the above-mentioned embodiments are specific examples for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.

Claims

1. A variable tracking method in a program, characterized in that: The method comprises: determining at least one target variable of the target code; Construct a dictionary variable based on the data dictionary variable class, and replace the target variable with the dictionary variable, and set a callback function for the dictionary variable; Compile and run the target code. If the dictionary variable changes, call the callback function and output log information to determine the target variable transfer relationship.

2. The variable tracking method in a program according to claim 1, characterized in that: The target variable includes at least one of an input parameter, a member variable, a static variable and a return value.

3. The variable tracking method in a program according to claim 1, characterized in that: The step of constructing a dictionary variable based on a data dictionary variable class, replacing the target variable with the dictionary variable, and setting a callback function for the dictionary variable includes: The type of the target variable is obtained by using the Type method of the data dictionary variable class, and the value of the target variable is obtained by using the Value method of the data dictionary variable class; Generate an object of the digital dictionary of a type corresponding to the target variable, and replace the target variable with the dictionary variable; The SetListener method of the data dictionary variable class is called to pass the pointer of the callback function to the dictionary variable to set the callback function for the dictionary variable.

4. The variable tracking method in a program according to claim 1, characterized in that: After constructing a dictionary variable based on the data dictionary and replacing the target variable with the dictionary variable, the method further includes: Simulating the operation of the target code based on the data dictionary variable class; If the assignment operation is for a numeric data type, the Value method of the data dictionary variable class is triggered to obtain the value of the target variable, and the value of the target variable is assigned to the dictionary variable.

5. The variable tracking method in a program according to claim 1, characterized in that: If the dictionary variable changes, calling the callback function and outputting log information to determine the target variable transfer relationship include: If the dictionary variable is assigned a value, the callback function is triggered, the status information of the data dictionary variable is recorded, and saved in the log; Determine status information of the data dictionary variable based on the log information; A variable transfer relationship of the target variable corresponding to the dictionary variable is determined according to the state information.

6. The variable tracking method in a program according to claim 5, characterized in that: The determining the state information of the data dictionary variable based on the log information includes: Determine at least one of the value state, CPU state, and timestamp of the dictionary variable according to the log information; and Determine a call stack of the callback function according to the log information.

7. The variable tracking method in a program according to claim 1, characterized in that: After calling the callback function and outputting the log information, the method further includes: The callback function is called to perform at least one of terminating the program and dumping the dump file.

8. A variable tracking system in a program, characterized in that: The system comprises: A program compilation unit determines at least one target variable of the target code; A replacement unit, used for constructing a dictionary variable based on a data dictionary variable class, replacing the target variable with the dictionary variable, and setting a callback function for the dictionary variable; The processing unit is used to compile and run the target code, and if the dictionary variable changes, the callback function is called to output log information to determine the target variable transfer relationship.

9. A terminal, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the variable tracking method in the program according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the variable tracking method in the program of any one of claims 1 to 7 is implemented.