Variable monitoring method, system, device, computer equipment and storage medium

By obtaining the program header table and symbol table from the ELF file to determine the address and size of variables, and combining this with the JTAG protocol for data communication, the problem of single variable monitoring type is solved, and efficient monitoring of multiple variables is achieved, especially the accurate location and data transmission of structure variables.

CN120256254BActive Publication Date: 2025-11-11CONTEMPORARY AMPEREX RUNZHI SOFTWARE TECH LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510752116.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-11-11
Estimated Expiration
2045-06-06

AI Technical Summary

Technical Problem

Existing technologies use a single variable monitoring type, which makes it impossible to comprehensively monitor diverse variables, especially structure variables and pointer variables, increasing the difficulty of monitoring.

Method used

By obtaining the executable linker format (ELF) file of the embedded device, determining the variable addresses and sizes using the program header table and symbol table, and combining data communication with the high-speed joint test protocol (JTAG), monitoring of different types of variables can be achieved.

Benefits of technology

It enables comprehensive monitoring of various variable types, improves the diversity of variable types and the convenience of monitoring, supports the determination of the address offset of structure variables without the need for additional configuration programs, and ensures the efficiency and reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256254B_ABST
    Figure CN120256254B_ABST
Patent Text Reader

Abstract

The application relates to a variable monitoring method, system, device, computer equipment and storage medium. The method comprises the following steps: obtaining an executable link format file of an application program in an embedded device, determining variable addresses and variable sizes of variables in the application program according to basic information of the variables in different types in the executable link format file, and sending the variable addresses and the variable sizes of the variables to an instruction processing device, instructing the instruction processing device to obtain data information of the variables from the embedded device, and determining a variable monitoring result of the application program according to the data information of the variables obtained by the instruction processing device; the executable link format file comprises basic information of the variables in different types generated during application program running; in the method, additional configuration acquisition is not needed for different types of variables, and different types of variables are monitored at one time, so that the diversity of the monitored variable types is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of variable monitoring technology, and in particular to a variable monitoring method, system, device, computer equipment, and storage medium. Background Technology

[0002] Variable monitoring refers to the process of real-time monitoring and analysis of variables obtained from running applications on a system or device.

[0003] Taking running a battery management application in an embedded device as an example, variables such as the battery current, voltage, or remaining charge can be obtained by monitoring variables.

[0004] However, the types of variables are diverse, and the types of variables monitored in related technologies are limited to a single type, which reduces the diversity of the types of variables that can be monitored. Summary of the Invention

[0005] Therefore, it is necessary to provide a variable monitoring method, system, device, computer equipment, and storage medium to address the aforementioned technical problems.

[0006] In a first aspect, embodiments of this application provide a variable monitoring method applied to a computer device, the method comprising:

[0007] Obtain the executable linker file of the application in the embedded device; the executable linker file includes basic information about the variables of different types generated by the application during runtime;

[0008] Based on the basic information of variables of different types in the executable linker file, determine the variable address and variable size of each variable in the application;

[0009] The address and size of each variable are sent to the instruction processing device, instructing the instruction processing device to obtain the data information of each variable from the embedded device;

[0010] Based on the data information of each variable obtained from the instruction processing device, the variable monitoring results of the application are determined.

[0011] In this embodiment, since the application's ELF file includes basic information of all types of variables generated by the application's operation, the basic information of variables of different types can be obtained more comprehensively and completely. Then, based on the basic information of each variable, the variable address and variable size of each variable are determined to determine the variable monitoring results for the application. There is no need to perform additional configuration for different types of variables. Different types of variables can be monitored at once, thereby improving the diversity of the monitored variable types.

[0012] In one embodiment, based on the basic information of variables of different types in the executable linker file, the variable address and variable size of each variable in the application are determined, including:

[0013] Retrieve the program header table and symbol table from the executable linker file;

[0014] The base address of the application is determined based on the program header table;

[0015] Based on the basic information of each variable under different types in the symbol table and the base address of the application, determine the variable address and variable size of each variable in the application.

[0016] In this embodiment of the application, the program header table and symbol table accurately record the base address of the application and the basic information of each variable. By using the program header table and symbol table in the ELF file to determine the variable address and variable size of each variable, the reliability of the obtained variable address and variable size can be improved accordingly.

[0017] In one embodiment, the basic information of the variables includes the address offset and size of the variables; based on the basic information of each variable of different types in the symbol table and the base address of the application, the variable address and size of each variable in the application are determined, including:

[0018] Obtain the address offset and size of each variable from the symbol table;

[0019] The variable address is determined based on the application's base address and the address offset of each variable.

[0020] In this embodiment, the basic information includes address offset and variable size, which can be used to directly determine the variable size. The variable address is determined by utilizing the relationship between the application's base address, the variable's address offset, and the variable address, thereby improving the convenience and efficiency of determining the variable address and variable size.

[0021] In one embodiment, when the variables of different types include structure variables, the address offset of each variable is obtained according to the symbol table, including:

[0022] Determine the global address offset corresponding to the structure variable and the member address offset of each variable member in the structure variable in the symbol table;

[0023] The address offset of the structure variable is determined based on the overall address offset and the address offset of each member.

[0024] In this embodiment, the address offset of the structure variable is determined, which helps to determine the variable address of the structure variable in order to obtain the data information of the structure variable. There is no need to configure additional programs for monitoring structure variables, thereby improving the convenience of monitoring various types of variables.

[0025] In one embodiment, the process by which the instruction processing device obtains data information of various variables from the embedded device includes:

[0026] The instruction processing device sends a data access request to the embedded device, carrying the variable address and variable size of each variable, and obtains the data information of each variable from the embedded device according to the variable address and variable size of each variable.

[0027] In one embodiment, the embedded device communicates with the instruction processing device and the computer device via a high-speed joint test protocol; the instruction processing device sends data access requests to the embedded device through the communication interface of the high-speed joint test protocol and receives data information of various variables; and,

[0028] The instruction processing device transmits data information of various variables to the computer device through the communication interface of the high-speed joint test protocol.

[0029] In one embodiment, the variable monitoring results of the application are determined based on the data information of each variable obtained by the instruction processing device, including:

[0030] The data reading process is invoked to read the data information of each variable obtained by the instruction processing device;

[0031] Store the data information of each variable in the cache area;

[0032] The data writing process reads the data information of each variable from the cache area and generates a variable change log for each variable based on the data information of each variable, which serves as the result of variable monitoring.

[0033] In this embodiment, data information is read and written based on the computer device's own cache area to generate variable change logs for each variable, thereby enabling continuous monitoring of variable changes, making it easier for users to understand the trend of variable changes, and thus improving the variable monitoring effect.

[0034] Secondly, embodiments of this application also provide a variable monitoring system, which includes an embedded device, a computer device, and an instruction processing device, wherein the instruction processing device is communicatively connected to the computer device and the embedded device respectively.

[0035] Embedded devices are used to run applications;

[0036] The computer device is used to obtain the executable link format file of the application in the embedded device, determine the variable address and variable size of each variable in the application based on the basic information of each variable under different types in the executable link format file, and send the variable address and variable size of each variable to the instruction processing device. Based on the data information of each variable obtained by the instruction processing device, the variable monitoring results of the application are determined. The executable link format file includes the basic information of each variable under different types generated by the application running.

[0037] The instruction processing device is used to obtain data information of each variable from the embedded device according to the variable address and variable size; and to transmit the obtained data information of each variable to the computer device.

[0038] In one embodiment, the instruction processing device is configured to send a data access request to the embedded device based on the variable address and variable size of each variable sent by the computer device; the data access request includes the variable address and variable size of each variable, and is used to instruct that data information of each variable be obtained from the embedded device based on the variable address and variable size of each variable.

[0039] Thirdly, embodiments of this application also provide a variable monitoring device, which includes:

[0040] The file acquisition module is used to acquire the executable link format file of the application in the embedded device; the executable link format file includes basic information of various variables of different types generated by the application during operation;

[0041] The variable determination module is used to determine the variable address and variable size of each variable in the application based on the basic information of each variable of different types in the executable linker file;

[0042] The data transmission module is used to send the variable address and variable size of each variable to the instruction processing device, instructing the instruction processing device to obtain the data information of each variable from the embedded device;

[0043] The monitoring results module is used to determine the variable monitoring results of the application based on the data information of each variable obtained by the instruction processing device.

[0044] Fourthly, embodiments of this application also provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the variable monitoring method provided in any of the above embodiments.

[0045] Fifthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps in the variable monitoring method provided in any of the above embodiments.

[0046] Sixthly, embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the steps in the variable monitoring method provided in any of the above embodiments.

[0047] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0048] Figure 1 This is a schematic diagram of the structure of a variable monitoring system in one embodiment;

[0049] Figure 2 This is a flowchart illustrating a variable monitoring method in one embodiment;

[0050] Figure 3 This is a flowchart illustrating the process of determining the address and size of a variable in one embodiment;

[0051] Figure 4 This is a flowchart illustrating the process of determining a variable address in one embodiment;

[0052] Figure 5 This is a flowchart illustrating the process of determining the address offset in one embodiment;

[0053] Figure 6 This is a flowchart illustrating the process of determining the monitoring results of variables in another embodiment;

[0054] Figure 7 This is a flowchart illustrating the variable monitoring method in another embodiment;

[0055] Figure 8 This is a structural block diagram of a variable monitoring device in one embodiment;

[0056] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the term "comprising" and any variations thereof in the specification, claims and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0059] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0060] In the description of the embodiments of this application, the term "and / or" is merely a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), unless otherwise explicitly specified.

[0061] Variable monitoring refers to the process of real-time monitoring and analysis of variables obtained from the running applications of a system or device. Its core purpose is to provide data support for system status assessment, fault warning, and performance optimization by tracking the dynamic changes of variables.

[0062] Taking running a battery management application in an embedded device as an example, variables such as the battery current, voltage, or remaining charge can be obtained by monitoring variables.

[0063] However, variable types are diverse, including not only basic numeric variables but also other types such as structure variables with multiple member variables and pointer variables indicating memory addresses. Related technologies often monitor only a single variable type, focusing primarily on basic numeric variables and neglecting other types. Furthermore, monitoring other types of variables requires additional program configuration to obtain their data, increasing the difficulty of variable monitoring.

[0064] In summary, the types of variables monitored in the relevant technologies are limited, thus reducing the diversity of the types of variables that can be monitored.

[0065] In one embodiment, a variable monitoring method is provided, which is applied to Figure 1The load monitoring system 100 includes an embedded device 102, a computer device 104, and an instruction processing device 106, which is communicatively connected to the computer device 104 and the embedded device 102.

[0066] Embedded device 102 is used to run applications;

[0067] Computer device 104 is used to obtain the executable link format file of the application in embedded device 102, determine the variable address and variable size of each variable in the application according to the basic information of each variable under different types in the application in the executable link format file, and send the variable address and variable size of each variable to instruction processing device 106, and determine the variable monitoring result of the application according to the data information of each variable obtained by instruction processing device 106; the executable link format file includes the basic information of each variable under different types generated by the application running;

[0068] The instruction processing device 106 is used to obtain data information of each variable from the embedded device 102 according to the variable address and variable size of each variable; and to transmit the obtained data information of each variable to the computer device 104.

[0069] Embedded device 102 refers to an electronic device that carries an application program to implement corresponding business functions. Computer device 104 is independent of embedded device 102 and can be used to acquire data information of various variables of different types generated by the application program running on embedded device 102. Instruction processing device 106 is an intermediate device for data transmission and analysis between embedded device 102 and computer device 104.

[0070] For example, the embedded device 102 may be a new energy vehicle equipped with a battery management application. The battery management application can be used to manage the vehicle battery, such as battery data acquisition, thermal runaway management, or power balancing management, etc. The variables generated under different types may be battery current, voltage, temperature, or remaining power, etc. The computer device 104 may be the host computer of the embedded device 102. The instruction processing device 106 may be a parser, which may also include a debugger.

[0071] In one embodiment, this application provides a variable monitoring method, such as... Figure 2 As shown, this method is applied to Figure 1 Taking a computer device, specifically an embedded device's host computer, as an example, this embodiment includes the following steps:

[0072] S210. Obtain the executable linker file of the application in the embedded device; the executable linker file includes basic information about the variables of different types generated by the application during operation.

[0073] The Executable and Linkable Format (ELF) file is a file format used for executable files, object files, shared libraries, and core dumps, typically compiled from the application's source code. Variables are physical quantities that change over time as the application runs. For example, in a battery management application, variables generated during its operation could be the battery's current, voltage, or temperature.

[0074] The variables generated during application execution can be of different types. For example, different types of variables can include basic variables, structure variables, and pointer variables. Basic variables are variables that represent concrete data, such as current and voltage. Structure variables are variables with complex data structures that include multiple variable members, such as battery status information, which may include multiple variable members such as battery current, voltage, remaining charge, and temperature. Pointer variables are variables that represent memory addresses.

[0075] The basic information of a variable is its attribute information. For example, the basic information of a variable may include at least one of the following: the variable's name, type, symbol, size, and address offset.

[0076] Optionally, the host computer can directly read the ELF file of the application stored in the embedded device, or it can obtain the source code of the application from the embedded device, compile it, and then obtain the ELF file of the application.

[0077] S220. Based on the basic information of each variable under different types in the executable linker file, determine the variable address and variable size of each variable in the application.

[0078] Among them, the variable address is used to represent the actual memory address of the variable in the embedded device, and the variable size is used to represent the memory space occupied by the variable in the embedded device, such as the number of bytes.

[0079] Optionally, the host computer can parse the application's ELF file and identify the basic information of all types of variables generated by the application's operation, thereby determining the variable address and variable size of each variable under different types.

[0080] S230. Send the variable address and variable size of each variable to the instruction processing device, instructing the instruction processing device to obtain the data information of each variable from the embedded device.

[0081] Optionally, the host computer sends the variable addresses and variable sizes of each variable obtained based on the ELF file to the instruction processing device that is connected to the host computer, so as to instruct the instruction processing device to access the embedded device and obtain the data information of each variable from the embedded device.

[0082] The instruction processing device enables data communication between the embedded device and the host computer, decoupling the two parties, improving compatibility, and enhancing the reliability of data transmission.

[0083] S240. Based on the data information of each variable obtained by the instruction processing device, determine the variable monitoring results of the application.

[0084] Optionally, after the instruction processing device obtains the data information of each variable, it synchronizes the data information of each variable to the host computer, so that the host computer can determine the variable monitoring results of the application based on the data information of each variable sent by the instruction processing device.

[0085] For example, the host computer can directly use the data information of all variables obtained as the variable monitoring result of the application, or it can further process the data information of all variables obtained to obtain the variable monitoring result of the application, such as judging whether the data information of each variable is abnormal, and using the judgment result of each variable as the variable monitoring result of the application.

[0086] It should be noted that the data information of each variable obtained by the host computer from the instruction processing device is raw data. This raw data can be converted into a data type that the host computer can recognize, such as converting the raw data into a C language type.

[0087] In this embodiment, by obtaining the executable linker file of the application in the embedded device, the address and size of each variable in the application are determined based on the basic information of each variable under different types in the executable linker file. The address and size of each variable are then sent to the instruction processing device, instructing the instruction processing device to obtain the data information of each variable from the embedded device. Based on the data information of each variable obtained by the instruction processing device, the variable monitoring result of the application is determined. The executable linker file includes the basic information of each variable under different types generated by the application. In the above method, since the application's ELF file includes the basic information of all types of variables generated by the application, the basic information of variables under different types can be obtained more comprehensively and completely. Then, based on the basic information of each variable, the address and size of each variable are determined to determine the variable monitoring result of the application. There is no need to perform additional configuration for different types of variables. Different types of variables are monitored at once, thereby improving the diversity of the monitored variable types.

[0088] To obtain the address and size of each variable, in one embodiment, such as Figure 3 As shown, S220 above determines the variable address and variable size of each variable in the application based on the basic information of each variable under different types in the executable linker file, including:

[0089] S310. Obtain the program header table and symbol table from the executable linker file.

[0090] The program header table describes how files are mapped to content. The symbol table records functions and variables in the application, including basic information about the variables.

[0091] Optionally, the host computer can perform structural parsing on the ELF file, read the file header of the ELF file, locate the positions of the program header table and the section header table, obtain the program header table based on the position of the program header table, and obtain and traverse the section header table based on the position of the section header table to obtain the symbol table.

[0092] S320. Determine the base address of the application program based on the program header table.

[0093] The application's base address is the starting address where the application loads content.

[0094] Optionally, the host computer can determine the entry for the corresponding load segment by traversing each entry in the program header table, and use the field value of that entry as the base address of the application. The load segment identifies the segment to which content can be loaded.

[0095] S330. Based on the basic information of each variable under different types in the symbol table and the base address of the application, determine the variable address and variable size of each variable in the application.

[0096] The variable address is used to represent the absolute address of the variable, and can be obtained by combining the application's base address with the variable's address offset.

[0097] Optionally, after obtaining the base address of the application, the host computer can determine the variable size and address offset of each variable in the application by combining the basic information of each variable under different types in the symbol table, and then obtain the variable address of each variable based on the address offset of each variable and the base address of the application.

[0098] In this embodiment, the program header table and symbol table in the executable linker file are obtained, and the base address of the application is determined based on the program header table. Furthermore, based on the basic information of each variable under different types in the symbol table and the base address of the application, the variable address and size of each variable in the application are determined. In the above method, the program header table and symbol table accurately record the base address of the application and the basic information of each variable. Using the program header table and symbol table in the ELF file to determine the variable address and size of each variable can correspondingly improve the reliability of the obtained variable address and size.

[0099] The basic information of a variable includes its address offset and size. Based on this, in one embodiment, such as... Figure 4 As shown, S330 above determines the variable address and variable size of each variable in the application based on the basic information of each variable under different types in the symbol table and the base address of the application, including:

[0100] S410. Obtain the address offset and variable size of each variable from the symbol table.

[0101] The symbol table includes various symbols and their corresponding basic information. These symbols include those representing functions and those representing variables. For example, `int` and `char` correspond to basic variables. The address offset of a variable represents the offset of its actual memory address from its base address. The core function of the address offset is to allocate logical addresses to symbols during the compilation phase, enabling the application to quickly locate the actual memory address of the symbol at runtime through address calculation.

[0102] Optionally, after obtaining the symbol table, the host computer can traverse the symbol table, identify the variable symbols in the symbol table, and extract the address offset and variable size from the basic information of each variable symbol, which are used as the address offset and variable size of the corresponding variable.

[0103] For example, the host computer can match the preset variable symbols with the symbols in the symbol table, and use the successfully matched symbols as the identified variable symbols.

[0104] S420. Determine the variable address of each variable based on the base address of the application and the address offset of each variable.

[0105] Optionally, after obtaining the address offset of each variable, the host computer can add the base address of the application to the address offset of the variable to obtain the actual memory address of the variable, which is recorded as the variable address.

[0106] In this embodiment, the basic information of the variables includes the address offset and size of the variables. The address offset and size of each variable are obtained according to the symbol table, and the variable address of each variable is determined according to the base address of the application and the address offset of each variable. In the above method, the basic information includes the address offset and the size of the variables, which can be used to directly determine the size of the variables. The variable address is determined by using the relationship between the base address of the application, the address offset of the variables, and the variable address, thereby improving the convenience and efficiency of determining the variable address and the variable size.

[0107] In one embodiment, where structure variables are included among variables of different types, such as Figure 5 As shown, S410 above, obtaining the address offset and size of each variable according to the symbol table, includes:

[0108] S510. Determine the overall address offset of the structure variable and the member address offset of each variable member in the structure variable in the symbol table.

[0109] A structure variable contains multiple variable members. The global address offset represents the address offset of the structure variable, while the member address offset represents the address offset of the variable members within the structure variable.

[0110] Optionally, if the host computer recognizes the symbol of the structure variable in the symbol table, it can determine that the variables of different types generated by the application include structure variables. The address offset of the structure variable can be extracted from the symbol table and recorded as the overall address offset. At the same time, the address offsets of each variable member in the structure variable can be obtained and recorded as the member address offsets.

[0111] S520. Determine the address offset of the structure variable based on the overall address offset and the address offset of each member.

[0112] Optionally, after obtaining the overall address offset of the structure variable and the member address offset of each variable member, the host computer can superimpose the overall address offset with the member address offset of that variable member to obtain the address offset of that variable member. The address offsets of all variable members in the structure variable constitute the address offset of the structure variable.

[0113] In this embodiment of the application, when structure variables are included among the variables of different types, the overall address offset corresponding to the structure variable and the member address offset of each variable member in the structure variable are determined in the symbol table, so as to determine the address offset of the structure variable based on the overall address offset and the address offset of each member. In the above method, the address offset of the structure variable is determined, which helps to determine the variable address of the structure variable in the subsequent process to obtain the data information of the structure variable. No additional program needs to be configured for monitoring the structure variable, thereby improving the convenience of monitoring multiple types of variables.

[0114] In one embodiment, the process by which the instruction processing device obtains data information of various variables from the embedded device includes:

[0115] The instruction processing device sends a data access request to the embedded device, carrying the variable address and variable size of each variable, and obtains the data information of each variable from the embedded device according to the variable address and variable size of each variable.

[0116] Optionally, after receiving the variable addresses and sizes of each variable from the host computer, the instruction processing device can generate a data access request carrying the variable addresses and sizes of each variable, and send the data access request to the embedded device through the DataRead / Write Register to access the addresses of each variable in the embedded device, and obtain the data information of the corresponding variable size at each variable address as the data information of the corresponding variable.

[0117] In an optional embodiment, the embedded device communicates with the instruction processing device and the computer device via a high-speed joint test protocol; the instruction processing device sends data access requests to the embedded device through the communication interface of the high-speed joint test protocol and receives data information of each variable; and the instruction processing device transmits data information of each variable to the computer device through the communication interface of the high-speed joint test protocol.

[0118] The high-speed joint test protocol, also known as the Joint Test Action Group (JTAG) protocol, has a sampling rate of tens of megahertz, far exceeding that of ordinary data transmission protocols (such as CAN), thus improving the communication efficiency between computer devices and embedded devices.

[0119] Optionally, the instruction processing device and the embedded device are connected via a high-speed JTAG protocol communication interface. The instruction processing device sends data access requests to the embedded device and receives data information of various variables through the high-speed JTAG protocol communication interface. The instruction processing device and the computer device are also connected via a high-speed JTAG protocol communication interface, and the instruction processing device transmits the acquired data information of various variables to the computer device accordingly through the high-speed JTAG protocol communication interface.

[0120] It should be noted that, in addition to the high-speed JTAG protocol communication interface, in some embodiments, the embedded device and the instruction processing device can also use other high-speed communication protocol communication interfaces, such as the Debug Access Port (DAP) or the Serial Wire Debug (SWD) interface.

[0121] The high-speed TAG protocol improves the data transmission efficiency between embedded devices and computer devices, enabling the data information of variables generated by the application running in the embedded device to be synchronized to the computer device in real time. This allows the computer device to monitor the variables generated by the application in the embedded device in real time, obtain the real-time variable monitoring results of the application, and is suitable for variables with strong real-time variability.

[0122] The application's variable monitoring results can include a log of variable changes over time. Therefore, in one embodiment, such as... Figure 6 As shown, in step S240 above, based on the data information of each variable obtained by the instruction processing device, the variable monitoring results of the application are determined, including:

[0123] S610: Call the data reading process to read the data information of each variable obtained by the instruction processing device.

[0124] Optionally, after the instruction processing device obtains the data information of each variable from the embedded device, the host computer can read the data information of each variable from the instruction processing device by calling the data reading process.

[0125] S620. Store the data information of each variable in the cache area.

[0126] The buffer area is a temporary storage area in the host computer used for reading and writing data.

[0127] Optionally, after the host computer reads the data information of each variable from the instruction processing device, it can store the data information of each variable in its own cache area.

[0128] S630: Call the data writing process to read the data information of each variable from the cache area, and generate the variable change log of each variable based on the data information of each variable, as the result of variable monitoring.

[0129] Among them, the variable change log is a log that records the data information of how the variable changes over time.

[0130] Optionally, after storing the data information of each variable in its own buffer area, the host computer can call the data writing process to read the data information of each variable from the buffer area, and sort the data information in chronological order for each variable to generate a log of the data information of the variable changing over time, which is recorded as the variable change log. The host computer can summarize the variable change logs of each variable to obtain the variable monitoring results of the application and store them, or send them to the display terminal for display.

[0131] For example, the variable change log can be in text form or in chart form, such as plotting the variable's data information into a line chart or bar chart according to time sequence, as the variable change log.

[0132] In this embodiment, a data reading process is invoked to read the data information of each variable obtained by the instruction processing device, and the data information of each variable is stored in a cache area. A data writing process is invoked to read the data information of each variable from the cache area, and a variable change log of each variable is generated based on the data information of each variable as the variable monitoring result. In the above method, the reading and writing of data information is realized based on the cache area of ​​the computer device itself, so as to generate the variable change log of each variable, realizing continuous monitoring of variable changes, making it easier for users to understand the trend of variable changes, thereby improving the variable monitoring effect.

[0133] To facilitate understanding by those skilled in the art, the variable monitoring method provided in this application is described in detail below, such as... Figure 7 As shown, the method may include:

[0134] S701. Obtain the executable linker file of the application in the embedded device; the executable linker file includes basic information about the variables of different types generated by the application during operation;

[0135] S702. Obtain the program header table and symbol table from the executable linker file;

[0136] S703. Determine the base address of the application program based on the program header table;

[0137] S704. Determine the address offset and size of the variable based on the basic information of each variable in the symbol table;

[0138] S705. Determine the variable address of each variable based on the base address of the application and the address offset of each variable;

[0139] S706. Send the variable address and variable size of each variable to the instruction processing device; The instruction processing device is used to send a data access request carrying the variable address and variable size of each variable to the embedded device through the communication interface of the high-speed joint test protocol, and to obtain the data information of each variable from the embedded device according to the variable address and variable size of each variable, and to transmit the data information of each variable to the computer device through the communication interface of the high-speed joint test protocol.

[0140] S707: Call the data reading process to read the data information of each variable obtained by the instruction processing device;

[0141] S708. Store the data information of each variable in the cache area;

[0142] S709: Call the data writing process to read the data information of each variable from the cache area, and generate a variable change log for each variable based on the data information of each variable, as the result of variable monitoring.

[0143] It should be noted that the descriptions in S701-S709 above can be found in the relevant descriptions in the above embodiments, and their effects are similar, so they will not be repeated here.

[0144] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0145] In one embodiment, this application provides a variable monitoring system, such as... Figure 1 As shown, the load monitoring system 100 includes an embedded device 102, a computer device 104, and an instruction processing device 106. The instruction processing device 106 is communicatively connected to the computer device 104 and the embedded device 102, respectively.

[0146] Embedded device 102 is used to run applications;

[0147] Computer device 104 is used to obtain the executable link format file of the application in embedded device 102, determine the variable address and variable size of each variable in the application according to the basic information of each variable under different types in the application in the executable link format file, and send the variable address and variable size of each variable to instruction processing device 106, and determine the variable monitoring result of the application according to the data information of each variable obtained by instruction processing device 106; the executable link format file includes the basic information of each variable under different types generated by the application running;

[0148] The instruction processing device 106 is used to obtain data information of each variable from the embedded device 102 according to the variable address and variable size of each variable; and to transmit the obtained data information of each variable to the computer device 104.

[0149] Embedded device 102 refers to an electronic device that carries an application program to implement corresponding business functions. Computer device 104 is independent of embedded device 102 and can be used to acquire data information of various variables of different types generated by the application program running on embedded device 102. Instruction processing device 106 is an intermediate device for data transmission and analysis between embedded device 102 and computer device 104.

[0150] For example, the embedded device 102 may be a new energy vehicle equipped with a battery management application. The battery management application can be used to manage the vehicle battery, such as battery data acquisition, thermal runaway management, or power balancing management, etc. The variables generated under different types may be battery current, voltage, temperature, or remaining power, etc. The computer device 104 may be the host computer of the embedded device 102. The instruction processing device 106 may be a parser, which may also include a debugger.

[0151] An application runs on the embedded device 102, generating data information for various variables of different types. The host computer can directly read the pre-stored ELF file of the application in the embedded device 102, or it can obtain the application's source code from the embedded device 102, compile it, and then parse the application's ELF file to identify the basic information of all types of variables generated by the application's operation. From this, it determines the variable address and size of each variable under different types. For each variable, the host computer instructs the instruction processing device 106 to retrieve the corresponding variable size data information from the corresponding memory location of the embedded device 102 according to the variable address. This yields the variable's data information, such as its specific value. Based on the retrieved data information of all variables, the host computer then determines the application's variable monitoring results.

[0152] In one embodiment, the instruction processing device 106 is configured to send a data access request to the embedded device 102 based on the variable address and variable size of each variable sent by the computer device 104; the data access request includes the variable address and variable size of each variable, and is used to instruct that data information of each variable be obtained from the embedded device 102 based on the variable address and variable size of each variable.

[0153] The host computer sends the variable addresses and sizes of each variable obtained from the ELF file to the instruction processing device 106, which is connected to the host computer. After receiving the variable addresses and sizes of each variable sent by the host computer, the instruction processing device 106 can generate a data access request carrying the variable addresses and sizes of each variable, and send the data access request to the embedded device 102 through the data read / write register to access the variable addresses in the embedded device 102, and obtain the data information of the corresponding variable size at each variable address as the data information of the corresponding variable.

[0154] Optionally, the instruction processing device 106 is connected to the embedded device 102 via a high-speed JTAG protocol communication interface. The instruction processing device 106 sends data access requests to the embedded device 102 and receives data information of various variables read through the high-speed JTAG protocol communication interface. The instruction processing device 106 is also connected to the computer device 104 via a high-speed JTAG protocol communication interface, and the instruction processing device 106 transmits the acquired data information of various variables to the computer device 104 accordingly through the high-speed JTAG protocol communication interface.

[0155] It should be noted that the computer equipment in the above variable monitoring system is used to implement the variable monitoring method in any of the foregoing embodiments. For details of the process, please refer to the foregoing embodiments, which will not be repeated here.

[0156] In one embodiment, such as Figure 8 As shown, a variable monitoring device is provided, including: a file acquisition module 801, a variable determination module 802, a data transmission module 803, and a monitoring result module 804; wherein:

[0157] The file acquisition module 801 is used to acquire the executable link format file of the application in the embedded device; the executable link format file includes basic information of various variables of different types generated by the application during operation;

[0158] The variable determination module 802 is used to determine the variable address and variable size of each variable in the application based on the basic information of each variable of different types in the executable link format file;

[0159] The data sending module 803 is used to send the variable address and variable size of each variable to the instruction processing device, instructing the instruction processing device to obtain the data information of each variable from the embedded device;

[0160] The monitoring results module 804 is used to determine the variable monitoring results of the application based on the data information of each variable obtained by the instruction processing device.

[0161] Each module in the aforementioned variable monitoring device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0162] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a variable monitoring method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0163] Those skilled in the art will understand that Figure 9The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0164] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above-described variable monitoring methods.

[0165] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above variable monitoring methods.

[0166] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of any of the above variable monitoring methods.

[0167] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0168] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0169] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A variable monitoring method, characterized in that, Applied to a computer device, wherein the computer device is a host computer of an embedded device, the method includes: The source code of the application is obtained from the embedded device, compiled, and then the executable linker file of the application is obtained. The executable linker file includes basic information of various variables of different types generated by the application during operation. The embedded device is a new energy vehicle, and the application is a battery management application. Different types of variables include basic variables, structure variables, and pointer variables. The basic variables include current and voltage. The structure variables include battery status information. Obtain the program header table and symbol table from the executable linker file; The base address of the application is determined based on the program header table; Based on the basic information of each variable under different types in the symbol table and the base address of the application, the variable address and variable size of each variable in the application are determined; the basic information of the variable includes the variable size; The variable addresses and sizes of each variable are sent to the instruction processing device, instructing the instruction processing device to obtain the data information of each variable from the embedded device; Based on the data information of each variable obtained by the instruction processing device, the variable monitoring result of the application is determined; The step of determining the variable monitoring result of the application based on the data information of each variable obtained by the instruction processing device includes: The data information of each variable is judged to determine whether it is abnormal, and the result of the state judgment of each variable is used as the variable monitoring result of the application.

2. The method according to claim 1, characterized in that, The basic information of the variables includes the variable's address offset and variable size; determining the variable address and variable size of each variable in the application based on the basic information of each variable of different types in the symbol table and the base address of the application includes: The address offset and size of each variable are obtained from the symbol table. The variable address of each variable is determined based on the base address of the application and the address offset of each variable.

3. The method according to claim 2, characterized in that, When the variables of different types include structure variables, the address offsets of each variable are obtained according to the symbol table, including: The overall address offset corresponding to the structure variable and the member address offset of each variable member in the structure variable are determined in the symbol table. The address offset of the structure variable is determined based on the overall address offset and the address offset of each member.

4. The method according to any one of claims 1-3, characterized in that, The process by which the instruction processing device obtains the data information of each variable from the embedded device includes: The instruction processing device sends a data access request carrying the variable address and variable size of each variable to the embedded device, and obtains the data information of each variable from the embedded device according to the variable address and variable size of each variable.

5. The method according to claim 4, characterized in that, The embedded device communicates with the instruction processing device and the computer device via a high-speed joint test protocol; the instruction processing device sends the data access request to the embedded device through the communication interface of the high-speed joint test protocol, and receives the data information of each variable; and, The instruction processing device transmits the data information of each variable to the computer device through the communication interface of the high-speed joint test protocol.

6. The method according to any one of claims 1-3, characterized in that, The step of determining the variable monitoring result of the application based on the data information of each variable obtained by the instruction processing device includes: The data reading process is invoked to read the data information of each variable obtained by the instruction processing device; Store the data information of each variable in the cache area; The data writing process reads the data information of each variable from the cache area and generates a variable change log for each variable based on the data information of each variable, which serves as the monitoring result of the variable.

7. A variable monitoring system, characterized in that, The variable monitoring system includes an embedded device, a computer device, and an instruction processing device, wherein the instruction processing device is communicatively connected to the computer device and the embedded device, respectively. The embedded device is used to run the application; The computer device is used to obtain the source code of the application from the embedded device, compile it to obtain the executable linker file of the application, obtain the program header table and symbol table in the executable linker file, determine the base address of the application based on the program header table, determine the variable address and variable size of each variable in the application based on the basic information of each variable of different types in the symbol table and the base address of the application, and send the variable address and variable size of each variable to the instruction processing device, and determine the variable monitoring result of the application based on the data information of each variable obtained by the instruction processing device; the executable linker file includes the basic information of each variable of different types generated by the application running; the basic information of the variables includes the variable size; the embedded device is a new energy vehicle, and the application is a battery management application; different types of variables include basic variables, structure variables, and pointer variables; the basic variables include current and voltage; the structure variables include battery status information; The instruction processing device is used to obtain data information of each variable from the embedded device according to the variable address and variable size of each variable; and to transmit the obtained data information of each variable to the computer device; The step of determining the variable monitoring result of the application based on the data information of each variable obtained by the instruction processing device includes: The data information of each variable is judged to determine whether it is abnormal, and the result of the state judgment of each variable is used as the variable monitoring result of the application.

8. The variable monitoring system according to claim 7, characterized in that, The instruction processing device is used to send a data access request to the embedded device according to the variable address and variable size of each variable sent by the computer device; the data access request includes the variable address and variable size of each variable, and is used to instruct that the data information of each variable be obtained from the embedded device according to the variable address and variable size of each variable.

9. A variable monitoring device, characterized in that, The device includes: The file acquisition module is used to acquire the source code of the application from the embedded device, compile it to obtain the executable linker file of the application; the executable linker file includes basic information of various variables of different types generated by the application during operation; the embedded device is a new energy vehicle, and the application is a battery management application; the different types of variables include basic variables, structure variables, and pointer variables, the basic variables include current and voltage; the structure variables include battery status information; The variable determination module is used to obtain the program header table and symbol table in the executable linker file, determine the base address of the application based on the program header table, and determine the variable address and variable size of each variable in the application based on the basic information of each variable of different types in the symbol table and the base address of the application; the basic information of the variable includes the variable size; The data sending module is used to send the variable address and variable size of each variable to the instruction processing device, instructing the instruction processing device to obtain the data information of each variable from the embedded device; The monitoring result module is used to determine the variable monitoring result of the application based on the data information of each variable obtained by the instruction processing device. The monitoring result module is specifically used to determine whether the data information of each variable is abnormal, and to use the state determination results of each variable as the variable monitoring results of the application.

10. A computer device, characterized in that, The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method according to any one of claims 1 to 6.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and system for tracking target variable in executable program

    CN113672499A

  • File processing method and device and computer equipment

    CN119645534A