Variable monitoring method, system and device, computer equipment and storage medium
By obtaining the executable link format file of the embedded device and determining the variable address and size using the program header table and symbol table, and obtaining data information in combination with the high-speed joint test protocol, the problem of single variable types is solved, and comprehensive monitoring of multiple types of variables in the embedded device is achieved.
Patent Information
- Application Number
- CN202510752116.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-06-06
AI Technical Summary
In the prior art, the single variable type monitoring results in a reduced variety of variable types, making it difficult to fully monitor different types of variables in embedded devices.
By obtaining the executable link format file of the embedded device, using the program header table and symbol table to determine the variable address and size, and combining the high-speed joint test protocol to obtain variable data information, so as to realize monitoring of different types of variables.
It realizes comprehensive monitoring of various types of variables in embedded devices, improves the diversity and monitoring efficiency of variable types, and supports convenient monitoring of structural variables.
Smart Images

Figure CN120256254A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of variable monitoring, and particularly to a variable monitoring method, system, device, computer device, and storage medium. Background Art
[0002] Variable monitoring refers to the process of real-time monitoring and analysis of variables obtained by a system or device running an application program.
[0003] Taking the operation of a battery management application program in an embedded device as an example, variables such as the current, voltage, or remaining power of the battery obtained by the embedded device running the battery management application program can be obtained through variable monitoring.
[0004] However, there are various types of variables, and the types of variables monitored in the related art are single, reducing the diversity of the types of variables that can be monitored. Summary of the Invention
[0005] Based on this, in view of the above technical problems, it is necessary to provide a variable monitoring method, system, device, computer device, and storage medium.
[0006] In a first aspect, an embodiment of the present application provides a variable monitoring method, which is applied to a computer device. The method includes:
[0007] Obtain an executable and linkable format file of an application program in an embedded device; the executable and linkable format file includes basic information of each variable under different types generated by the running of the application program;
[0008] Determine the variable address and variable size of each variable in the application program according to the basic information of each variable under different types in the executable and linkable format file;
[0009] Send the variable address and variable size of each variable to an instruction processing device, instructing the instruction processing device to obtain the data information of each variable from the embedded device;
[0010] Determine the variable monitoring result of the application program according to the data information of each variable obtained by the instruction processing device.
[0011] In an embodiment of the present application, since the ELF file of the application program includes the basic information of each variable under all types generated by the running of the application program, 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 variable address and variable size of each variable are determined to determine the variable monitoring result of the application program, without the need for additional configuration acquisition for different types of variables, and different types of variables can be monitored at one time, thereby improving the diversity of the types of variables monitored.
[0012] In one embodiment, according to the basic information of each variable under different types in the executable link format file, determining the variable address and variable size of each variable in the application program includes:
[0013] Obtaining the program header table and symbol table in the executable link format file;
[0014] Determining the base address of the application program according to the program header table;
[0015] According to the basic information of each variable under different types in the symbol table and the base address of the application program, determining the variable address and variable size of each variable in the application program.
[0016] In the embodiments of the present application, the program header table and symbol table accurately record the base address of the application program 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 variable size of each variable can correspondingly improve the reliability of the obtained variable address and variable size.
[0017] In one embodiment, the basic information of the variable includes the address offset and variable size of the variable; according to the basic information of each variable under different types in the symbol table and the base address of the application program, determining the variable address and variable size of each variable in the application program includes:
[0018] Obtaining the address offset and variable size of each variable according to the symbol table;
[0019] Determining the variable address of each variable according to the base address of the application program and the address offset of each variable.
[0020] In the embodiments of the present application, the basic information includes the address offset and variable size, which can be used to directly determine the variable size, and use the correlation relationship among the base address of the application program, the address offset of the variable, and the variable address to determine the variable address, thereby improving the convenience and efficiency of determining the variable address and variable size.
[0021] In one embodiment, when the structure variable is included in each variable under different types, obtaining the address offset of each variable according to the symbol table includes:
[0022] Determining the overall 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] Determining the address offset of the structure variable according to the overall address offset and each member address offset.
[0024] In the embodiments of the present application, the determination of the address offset of the structure variable is realized, which helps to subsequently determine the variable address of the structure variable to obtain the data information of the structure variable, and there is no need to configure an additional program for monitoring the structure variable, thereby improving the convenience of monitoring various types of variables.
[0025] In one embodiment, the process by which the instruction processing device obtains the data information of each variable from the embedded device includes:
[0026] 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.
[0027] In one embodiment, the embedded device communicates with the instruction processing device and the computer device through the Joint Test Action Group (JTAG) protocol; the instruction processing device sends a data access request to the embedded device through the communication interface of the JTAG protocol and receives the data information of each variable; and,
[0028] The instruction processing device transmits the data information of each variable to the computer device through the communication interface of the JTAG protocol.
[0029] In one embodiment, according to the data information of each variable obtained by the instruction processing device, determining the variable monitoring result of the application program includes:
[0030] Call the data reading process 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] 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 according to the data information of each variable as the variable monitoring result.
[0033] In the embodiments of the present application, the reading and writing of data information are realized based on the cache area of the computer device itself for generating the variable change log of each variable, realizing continuous monitoring of variable changes, facilitating the user to understand the change trend of variables, and thus improving the variable monitoring effect.
[0034] In a second aspect, the embodiments of the present application further provide a variable monitoring system, which includes an embedded device, a computer device, and an instruction processing device. The instruction processing device is communicatively connected to the computer device and the embedded device respectively;
[0035] The embedded device is used to run the application program;
[0036] The computer device is used to obtain the executable link format file of the application program in the embedded device, determine the variable address and variable size of each variable in the application program according to 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, and determine the variable monitoring result of the application program according to the data information of each variable obtained by the instruction processing device; the executable link format file includes the basic information of each variable under different types generated by the operation of the application program;
[0037] The instruction processing device is used to obtain the data information of each variable from the embedded device according to the variable address and variable size of each variable; and, transmit the obtained data information of each variable to the computer device.
[0038] In one embodiment, 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 indicate to obtain the data information of each variable from the embedded device according to the variable address and variable size of each variable.
[0039] In a third aspect, an embodiment of the present application further provides a variable monitoring device, and the device includes:
[0040] A file acquisition module, configured to acquire the executable link format file of the application program in the embedded device; the executable link format file includes the basic information of each variable under different types generated by the operation of the application program;
[0041] A variable determination module, configured to determine the variable address and variable size of each variable in the application program according to the basic information of each variable under different types in the executable link format file;
[0042] A data sending module, configured to send the variable address and variable size of each variable to the instruction processing device, and instruct the instruction processing device to obtain the data information of each variable from the embedded device;
[0043] A monitoring result module, configured to determine the variable monitoring result of the application program according to the data information of each variable obtained by the instruction processing device.
[0044] In a fourth aspect, an embodiment of the present application further provides a computer device, including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps in the variable monitoring method provided in any one of the above embodiments are implemented.
[0045] Fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the variable monitoring method provided in any one of the above embodiments are implemented.
[0046] Sixth aspect, an embodiment of the present application further provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps in the variable monitoring method provided in any one of the above embodiments are implemented.
[0047] The above description is only an overview of the technical solution of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the following specifically illustrates the specific implementation manners of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a schematic structural diagram of a variable monitoring system in an embodiment;
[0049] Figure 2 It is a schematic flowchart of a variable monitoring method in an embodiment;
[0050] Figure 3 It is a schematic flowchart of determining a variable address and a variable size in an embodiment;
[0051] Figure 4 It is a schematic flowchart of determining a variable address in an embodiment;
[0052] Figure 5 It is a schematic flowchart of determining an address offset in an embodiment;
[0053] Figure 6 It is a schematic flowchart of determining a variable monitoring result in another embodiment;
[0054] Figure 7 It is a schematic flowchart of a variable monitoring method in another embodiment;
[0055] Figure 8 It is a schematic block diagram of a variable monitoring device in an embodiment;
[0056] Figure 9 It is an internal structural diagram of a computer device in an embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0057] In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not used to limit the present 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 belongs; the terms used herein are for the purpose of describing specific embodiments only and are not intended to limit this application; the term "comprising" and any variation thereof in the specification and claims of this application and the above drawings are intended to cover non-exclusive inclusion.
[0059] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in connection with the embodiments can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand 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 of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In the description of the embodiments of this application, the term "plurality" means two or more (including two), unless otherwise specifically defined.
[0061] Variable monitoring refers to the process of real-time monitoring and analysis of variables obtained by a system or device running an application program. Its core purpose is to provide data support for system status evaluation, fault warning, and performance optimization by tracking the dynamic changes of variables.
[0062] Taking the example of running a battery management application program on an embedded device, variables such as the current, voltage, or remaining power of the battery obtained by the embedded device running the battery management application program can be obtained through variable monitoring.
[0063] However, variable types are diverse, including not only basic numerical variables but also some other types of variables, such as structure variables including multiple variable members and pointer variables indicating memory addresses. In related technologies, the monitored variable types are often relatively single, focusing mostly on basic numerical variables and ignoring other types of variables. In order to monitor other types of variables, additional programs need to be configured to obtain data information of other types of variables, increasing the difficulty of variable monitoring.
[0064] In summary, the variable types monitored in related technologies are single, thus reducing the diversity of variable types that can be monitored.
[0065] In one embodiment, a variable monitoring method is provided. This method is applied to Figure 1The load monitoring system therein. The load monitoring system 100 includes an embedded device 102, a computer device 104, and an instruction processing device 106. The instruction processing device is communicatively connected to the computer device 104 and the embedded device 102 respectively.
[0066] The embedded device 102 is used to run application programs;
[0067] The computer device 104 is used to obtain the executable link format file of the application program in the embedded device 102, determine the variable addresses and variable sizes of the variables in the application program according to the basic information of the variables of different types in the application program in the executable link format file, and send the variable addresses and variable sizes of the variables to the instruction processing device 106, and determine the variable monitoring result of the application program according to the data information of the variables obtained by the instruction processing device 106; the executable link format file includes the basic information of the variables of different types generated during the operation of the application program;
[0068] The instruction processing device 106 is used to obtain the data information of the variables from the embedded device 102 according to the variable addresses and variable sizes of the variables; and transmit the obtained data information of the variables to the computer device 104.
[0069] Among them, the embedded device 102 refers to an electronic device that runs an application program to implement corresponding business functions. The computer device 104 is independent of the embedded device 102 and can be used to obtain the data information of the variables of different types generated by the application program running on the embedded device 102. The instruction processing device 106 is an intermediate device for realizing data transmission and analysis between the embedded device 102 and the computer device 104.
[0070] Exemplarily, the embedded device 102 can be a new energy vehicle equipped with a battery management application program. The battery management application program can be used to manage the vehicle battery, such as battery data collection, thermal runaway management, or power balance management, etc. The variables of different types generated can be the current, voltage, temperature, or remaining power of the battery, etc. The computer device 104 can be the upper computer of the embedded device 102. The instruction processing device 106 can be a parser, and the parser can also include a debugger.
[0071] In one embodiment, the embodiment of the present application provides a variable monitoring method, as Figure 2 shown, taking this method as applied to Figure 1 the computer device in and the computer device being the upper computer of the embedded device as an example, this embodiment includes the following steps:
[0072] S210. Obtain the Executable and Linkable Format (ELF) file of the application in the embedded device; the ELF file includes the basic information of each variable generated during the operation of the application under different types.
[0073] Among them, the Executable and Linkable Format (ELF) file of the application is a file format for executable files, object files, shared libraries, and core dumps, usually compiled based on the source code of the application. A variable is a physical quantity that changes over time generated during the operation of the application. Exemplarily, taking a battery management application as an example, the variables generated during the operation of the battery management application can be the current, voltage, or temperature of the battery.
[0074] Each variable generated during the operation of the application can be of different types. Exemplarily, different types of variables can include basic variables, structure variables, and pointer variables. A basic variable refers to a variable presented as specific data, such as current and voltage. A structure variable refers to a variable of a complex data structure that includes multiple variable members, such as battery status information, which can include multiple variable members such as the current, voltage, remaining power, and temperature of the battery. A pointer variable refers to a variable presented as a memory address.
[0075] The basic information of the variable is the attribute information of the variable. Exemplarily, the basic information of the variable can include at least one of the name, type, symbol, size, and address offset of the variable.
[0076] Optionally, the host computer can directly read the pre-stored ELF file of the application in the embedded device, or obtain the source code of the application from the embedded device and compile it to obtain the ELF file of the application.
[0077] S220. 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 ELF file.
[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 ELF file of the application and identify the basic information of all types of variables generated during the operation of the application, and determine the variable address and variable size of each variable under different types from it.
[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 an instruction processing device communicatively 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] Among them, the instruction processing device realizes data communication between the embedded device and the host computer, decouples the two communication parties, improves compatibility, and improves the reliability of data transmission.
[0083] S240. Determine the variable monitoring result of the application program according to the data information of each variable obtained by the instruction processing device.
[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 result of the application program according to the data information of each variable sent by the instruction processing device.
[0085] Exemplarily, the host computer can directly use the data information of all variables obtained as the variable monitoring result of the application program, or further process the data information of all variables obtained to obtain the variable monitoring result of the application program, such as making a status judgment on whether each variable is abnormal, and using the status judgment result of each variable as the variable monitoring result of the application program.
[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, and the raw data can be converted into a data type recognizable by the host computer, such as converting the raw data into a C language type.
[0087] In an embodiment of the present application, by obtaining the executable link format file of the application program in the embedded device, based on the basic information of each variable under different types in the executable link format file, the variable address and variable size of each variable in the application program are determined, and the variable address and variable 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, and based on the data information of each variable obtained by the instruction processing device, determining the variable monitoring result of the application program; the executable link format file includes the basic information of each variable under different types generated during the operation of the application program; in the above method, since the ELF file of the application program includes the basic information of all types of variables generated during the operation of the application program, 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 variable address and variable size of each variable are determined to determine the variable monitoring result of the application program, without the need for additional configuration acquisition for different types of variables, and different types of variables are monitored at one time, thereby improving the diversity of the monitored variable types.
[0088] To obtain the variable address and variable size of each variable, in one embodiment, as Figure 3 shown, step S220, according to the basic information of each variable under different types in the executable link format file, determining the variable address and variable size of each variable in the application program, includes:
[0089] S310, obtaining the program header table and symbol table in the executable link format file.
[0090] Among them, the program header table is used to describe how the file is mapped to the content. The symbol table is used to record the functions and variables in the application program, specifically including the basic information of the variables.
[0091] Optionally, the host computer can perform structure parsing on the ELF file, read the file header of the ELF file, locate the positions of the program header table and section header table, obtain the program header table according to the position of the program header table, and obtain and traverse the section header table according to the position of the section header table to obtain the symbol table.
[0092] S320, determining the base address of the application program according to the program header table.
[0093] Among them, the base address of the application program is the starting address where the application program is loaded into the content.
[0094] Optionally, the host computer can determine the entry corresponding to the loaded segment by traversing each entry in the program header table, and use the field value of this entry as the base address of the application program. Among them, the loaded segment identifier indicates the segment that can be loaded into the content.
[0095] S330. Determine the variable addresses and variable sizes of each variable in the application program according to the basic information of each variable under different types in the symbol table and the base address of the application program.
[0096] Among them, the variable address of a variable is used to represent the absolute address of the variable, and can be obtained based on the base address of the application program combined with the address offset of the variable.
[0097] Optionally, after obtaining the base address of the application program, the host computer can combine the basic information of each variable under different types in the symbol table to determine the variable size and address offset of each variable in the application program, and then obtain the variable address of each variable according to the address offset of each variable and the base address of the application program.
[0098] In the embodiment of the present application, obtain the program header table and symbol table in the executable link format file, determine the base address of the application program according to the program header table, and determine the variable addresses and variable sizes of each variable in the application program according to the basic information of each variable under different types in the symbol table and the base address of the application program; in the above method, the program header table and symbol table accurately record the base address of the application program and the basic information of each variable. Using the program header table and symbol table in the ELF file to determine the variable addresses and variable sizes of each variable can correspondingly improve the reliability of the obtained variable addresses and variable sizes of each variable.
[0099] The basic information of a variable includes the address offset and variable size of the variable. Based on this, in one embodiment, as Figure 4 shown, the above S330. Determine the variable addresses and variable sizes of each variable in the application program according to the basic information of each variable under different types in the symbol table and the base address of the application program, includes:
[0100] S410. Obtain the address offset and variable size of each variable according to the symbol table.
[0101] Among them, the symbol table includes multiple symbols and the basic information corresponding to each symbol. The multiple symbols include symbols representing functions and symbols representing variables. For example, int and char correspond to symbols of basic variables. The address offset of a variable is used to represent the offset amount of the actual memory address of the variable compared to the base address. The core function of the address offset is to allocate a logical address for the symbol during the compilation stage, so as to quickly locate the actual memory address of the symbol through address calculation when the application program runs.
[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 as the address offset and variable size of the corresponding variable.
[0103] Exemplarily, the host computer can match the preset variable symbols with the symbols in the symbol table, and use the successfully matched symbols as the recognized variable symbols.
[0104] S420. Determine the variable addresses of the variables according to the base address of the application program and the address offsets of the variables.
[0105] Optionally, after obtaining the address offsets of the variables, for each variable, the host computer can add the base address of the application program and the address offset of the variable to obtain the actual memory address of the variable, which is recorded as the variable address of the variable.
[0106] In the embodiments of the present application, the basic information of the variable includes the address offset and the variable size of the variable. Obtain the address offset and the variable size of each variable according to the symbol table, and determine the variable address of each variable according to the base address of the application program and the address offset of each variable; in the above method, the basic information includes the address offset and the variable size, which can be used to directly determine the variable size, and use the association relationship among the base address of the application program, the address offset of the variable, and the variable address to determine the variable address, thereby improving the convenience and efficiency of determining the variable address and the variable size.
[0107] In the case where the variables of different types include structure variables, in one embodiment, as Figure 5 shown, the above S410. Obtain the address offset and the variable 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 offsets of the variables in the structure variable in the symbol table.
[0109] Among them, the structure variable includes multiple variable members. The overall address offset represents the address offset of the structure variable, and the member address offset represents the address offset of the variable member in the structure variable.
[0110] Optionally, when the host computer recognizes the symbol of the structure variable in the symbol table, it can determine that the variables of different types generated during the operation of the application program include the structure variable, and can extract the address offset of the structure variable from the symbol table, which is recorded as the overall address offset, and at the same time obtain the address offsets corresponding to the variables in the structure variable, which are recorded as the member address offsets.
[0111] S520. Determine the address offset of the structure variable according to the overall address offset and each member address offset.
[0112] Optionally, after obtaining the overall address offset of the structure variable and the member address offsets of each variable member, for each variable member, the host computer can add the overall address offset to the member address offset of the variable member to obtain the address offset of the variable member. The address offsets of all variable members in the structure variable constitute the address offset of the structure variable.
[0113] In the embodiments of the present application, in the case where each variable of different types includes a structure variable, the overall address offset corresponding to the structure variable and the member address offsets 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 according to the overall address offset and each member address offset; in the above method, the determination of the address offset of the structure variable is realized, which helps to subsequently determine the variable address of the structure variable to obtain the data information of the structure variable, and there is no need to configure an additional program for monitoring the structure variable, thereby improving the convenience of monitoring multiple types of variables.
[0114] In one of the embodiments, the process by which the instruction processing device obtains the data information of each variable from the embedded device includes:
[0115] 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.
[0116] Optionally, after receiving the variable address and variable size of each variable sent by the host computer, the instruction processing device can generate a data access request carrying the variable address and variable size of each variable, and send the data access request to the embedded device through a Data Read / Write Register to access each variable address 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 through a high-speed joint test protocol; the instruction processing device sends a 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.
[0118] Among them, the full name of the high-speed joint test protocol is the Joint Test Action Group (JTAG) protocol. The sampling rate of the high-speed TAG protocol is as high as several tens of megahertz, which is much higher than the rate of ordinary data transmission protocols (such as CAN), so the communication efficiency between the computer device and the embedded device can be improved.
[0119] Optionally, the instruction processing device is connected to the embedded device through a communication interface of the high-speed JTAG protocol. The instruction processing device sends a data access request to the embedded device through the communication interface of the high-speed JTAG protocol, and receives the data information of each variable read through the communication interface of the high-speed JTAG protocol. The instruction processing device is connected to the computer device through the communication interface of the high-speed JTAG protocol. The instruction processing device transmits the data information of each variable obtained to the computer device through the communication interface of the high-speed JTAG protocol accordingly.
[0120] It should be noted that in addition to the communication interface of the high-speed JTAG protocol, in some embodiments, the embedded device and the instruction processing device may also be connected through a communication interface of other high-speed communication protocols, such as a Debug Access Port (DAP) or a Serial Wire Debug (SWD) interface.
[0121] The high-speed TAG protocol improves the data transmission efficiency from the embedded device to the computer device, enabling the data information of the variables generated during the operation of the application program in the embedded device to be synchronously transferred to the computer device in real time. It realizes the real-time monitoring of the variables generated by the application program in the embedded device by the computer device, obtains the real-time variable monitoring results of the application program, and is adapted to variables with strong real-time variability.
[0122] The variable monitoring results of the application program may include a variable change log of the variables changing over time. Therefore, in one embodiment, as Figure 6 shown, the above S240, determining the variable monitoring results of the application program according to the data information of each variable obtained by the instruction processing device, includes:
[0123] S610, calling a 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 a data reading process.
[0125] S620, storing the data information of each variable in a buffer area.
[0126] Among them, the buffer area is a temporary storage area in the host computer for reading and writing data information.
[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 buffer area.
[0128] S630. Call the data writing process to read the data information of each variable from the buffer area, and generate a variable change log for each variable based on the data information of each variable as the variable monitoring result.
[0129] Among them, the variable change log (log) of a variable is a log that records the data information of the variable changing over time.
[0130] Optionally, after the host computer stores the data information of each variable in its own buffer area, it can call the data writing process to read the data information of each variable from the buffer area, and for each variable, sort the data information in time sequence to generate a log of the data information of the variable changing over time, which is recorded as the variable change log of the variable. The host computer can summarize the variable change logs of each variable, obtain and store the variable monitoring result of the application program, or send it to the display end for display.
[0131] Exemplarily, the variable change log of a variable can be in text form or in chart form, such as plotting the data information of the variable into a line chart or a bar chart according to time sequence as the variable change log of the variable.
[0132] In the embodiment of the present application, call the data reading process to read the data information of each variable obtained by the instruction processing device, store the data information of each variable in the buffer area, call the data writing process to read the data information of each variable from the buffer area, and generate a variable change log for each variable based on the data information of each variable as the variable monitoring result; in the above method, the reading and writing of data information are realized based on the buffer area of the computer device itself to generate the variable change log of each variable, realizing continuous monitoring of variable changes, facilitating users to understand the change trend of variables, and thus improving the variable monitoring effect.
[0133] For the convenience of understanding by those skilled in the art, the variable monitoring method provided by the present application is introduced in detail below. As Figure 7 shown, the method may include:
[0134] S701. Obtain the executable and linkable format file of the application program in the embedded device; the executable and linkable format file includes the basic information of each variable under different types generated by the application program during operation;
[0135] S702. Obtain the program header table and symbol table in the executable and linkable format file;
[0136] S703. Determine the base address of the application program according to the program header table;
[0137] S704. Determine the address offset and variable size of the variable according to the basic information of each variable in the symbol table;
[0138] S705. Determine the variable addresses of each variable according to the base address of the application program and the address offsets of each variable;
[0139] S706. Send the variable addresses and variable sizes of each variable to the instruction processing device; the instruction processing device is used to send a data access request carrying the variable addresses and variable sizes of each variable to the embedded device through the communication interface of the high-speed joint test protocol, obtain the data information of each variable from the embedded device according to the variable addresses and variable sizes of each variable, and transmit the data information of each variable to the computer device through the communication interface of the high-speed joint test protocol;
[0140] S707. Invoke 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 into the cache area;
[0142] S709. Invoke 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 according to the data information of each variable as the variable monitoring result.
[0143] It should be noted that for the descriptions in S701 - S709 above, reference can be made to the relevant descriptions in the above embodiments, and their effects are similar, so they will not be elaborated herein.
[0144] It should be understood that although the steps in the flowcharts involved in the above embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed 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 executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0145] In one embodiment, the embodiment of the present application provides a variable monitoring system, as Figure 1 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] The embedded device 102 is used to run the application program;
[0147] The computer device 104 is used to obtain the executable link format file of the application program in the embedded device 102, determine the variable addresses and variable sizes of the variables in the application program according to the basic information of the variables of different types in the application program in the executable link format file, and send the variable addresses and variable sizes of the variables to the instruction processing device 106, and determine the variable monitoring result of the application program according to the data information of the variables obtained by the instruction processing device 106; the executable link format file includes the basic information of the variables of different types generated by the operation of the application program.
[0148] The instruction processing device 106 is used to obtain the data information of the variables from the embedded device 102 according to the variable addresses and variable sizes of the variables; and transmit the obtained data information of the variables to the computer device 104.
[0149] Among them, the embedded device 102 refers to an electronic device that runs an application program to implement corresponding service functions. The computer device 104 is independent of the embedded device 102 and can be used to obtain the data information of the variables of different types generated by the operation of the application program carried by the embedded device 102. The instruction processing device 106 is an intermediate device for realizing data transmission and analysis between the embedded device 102 and the computer device 104.
[0150] Exemplarily, the embedded device 102 can be a new energy vehicle equipped with a battery management application program. The battery management application program can be used to manage the vehicle battery, such as battery data acquisition, thermal runaway management or power balance management, etc. The variables of different types generated can be the current, voltage, temperature or remaining power of the battery, etc. The computer device 104 can be the host computer of the embedded device 102. The instruction processing device 106 can be a parser, and the parser can also include a debugger.
[0151] The application program runs on the embedded device 102, and correspondingly generates the data information of the variables of different types. The host computer can directly read the ELF file of the application program pre-stored in the embedded device 102, or obtain the source code of the application program from the embedded device 102, and after compilation, obtain the ELF file of the application program, so as to parse the ELF file of the application program and identify the basic information of all types of variables generated by the operation of the application program, and determine the variable addresses and variable sizes of the variables of different types from it. For each variable, the host computer instructs the instruction processing device 106 to obtain the data information corresponding to the variable size from the corresponding memory of the embedded device 102 according to the variable address, and then the data information of the variable can be obtained, such as the specific value, and then the variable monitoring result of the application program is determined according to the obtained data information of all variables.
[0152] In one embodiment, the instruction processing device 106 is configured to send a data access request to the embedded device 102 according to the variable addresses and variable sizes of the variables sent by the computer device 104; the data access request includes the variable addresses and variable sizes of the variables, and is used to indicate obtaining the data information of the variables from the embedded device 102 according to the variable addresses and variable sizes of the variables.
[0153] The host computer sends the variable addresses and variable sizes of the variables obtained based on the ELF file to the instruction processing device 106 communicatively connected to the host computer. After receiving the variable addresses and variable sizes of the variables sent by the host computer, the instruction processing device 106 can generate a data access request carrying the variable addresses and variable sizes of the variables, and send the data access request to the embedded device 102 through a Data Read / Write Register, so as to access the variable addresses in the embedded device 102, and obtain the data information of the corresponding variable sizes at the variable addresses as the data information of the corresponding variables.
[0154] Optionally, the instruction processing device 106 and the embedded device 102 are connected through a communication interface of the high-speed JTAG protocol. The instruction processing device 106 sends a data access request to the embedded device 102 through the communication interface of the high-speed JTAG protocol, and receives the data information of the variables read through the communication interface of the high-speed JTAG protocol. The instruction processing device 106 and the computer device 104 are connected through a communication interface of the high-speed JTAG protocol. The instruction processing device 106 transmits the obtained data information of the variables to the computer device 104 through the communication interface of the high-speed JTAG protocol.
[0155] It should be noted that the computer device in the above variable monitoring system is used to implement the variable monitoring method in any of the foregoing embodiments. For the specific process, please refer to the foregoing embodiments and will not be elaborated herein.
[0156] In one embodiment, as Figure 8 shown, a variable monitoring device is provided, including: a file acquisition module 801, a variable determination module 802, a data sending module 803, and a monitoring result module 804; wherein:
[0157] The file acquisition module 801 is configured to acquire an executable link format file of an application program in the embedded device; the executable link format file includes the basic information of each variable under different types generated by the application program running.
[0158] The variable determination module 802 is configured to determine the variable addresses and variable sizes of the variables in the application program according to the basic information of each variable under different types in the executable link format file.
[0159] The data sending module 803 is used to send the variable addresses and variable sizes 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 result module 804 is used to determine the variable monitoring result of the application program according to the data information of each variable obtained by the instruction processing device.
[0161] Each module in the above variable monitoring device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0162] In an exemplary embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 9 shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC), or other technologies. The computer program, when executed by the processor, implements a variable monitoring method. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0163] Those skilled in the art can understand, Figure 9The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0164] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps of any one of the above variable monitoring methods are implemented.
[0165] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above variable monitoring methods are implemented.
[0166] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps of any one of the above variable monitoring methods are implemented.
[0167] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. 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), magnetoresistive 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 be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0168] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, 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, it should be considered as the scope described in this specification.
[0169] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A variable monitoring method, characterized in that, Applied to a computer device, the method includes: Obtaining an executable link format file of an application in an embedded device; the executable link format file includes basic information of each variable under different types generated by the operation of the application; Determining 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 executable link format file; Sending the variable address and variable size of each variable to an instruction processing device, instructing the instruction processing device to obtain data information of each variable from the embedded device; Determining a variable monitoring result of the application according to the data information of each variable obtained by the instruction processing device.
2. The method according to claim 1, characterized in that, The determining 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 executable link format file includes: Obtaining a program header table and a symbol table in the executable link format file; Determining the base address of the application according to the program header table; Determining 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 symbol table and the base address of the application.
3. The method according to claim 2, wherein The basic information of the variable includes the address offset and variable size of the variable; the determining 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 symbol table and the base address of the application includes: Obtaining the address offset and variable size of each variable according to the symbol table; Determining the variable address of each variable according to the base address of the application and the address offset of each variable.
4. The method according to claim 3, wherein When the structure variable is included in each variable under different types, obtaining the address offset of each variable according to the symbol table includes: Determining the overall address offset corresponding to the structure variable and the member address offset of each variable member in the structure variable in the symbol table; Determining the address offset of the structure variable according to the overall address offset and each member address offset.
5. The method according to any one of claims 1 to 4, characterized in that, The process of the instruction processing device obtaining 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.
6. The method according to claim 5, wherein The embedded device communicates with the instruction processing device and the computer device through 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.
7. The method according to any one of claims 1-4, characterized in that The determining the variable monitoring result of the application according to the data information of each variable obtained by the instruction processing device includes: Call the data reading process to read the data information of each variable obtained by the instruction processing device; Store the data information of each variable in the buffer area; Call the data writing process to read the data information of each variable from the buffer area, and generate a variable change log of each variable based on the data information of each variable as the variable monitoring result.
8. A variable monitoring system, characterized in that, The variable monitoring system includes an embedded device, a computer device, and an instruction processing device, and the instruction processing device is communicatively connected to the computer device and the embedded device respectively; The embedded device is used to run an application program; The computer device is used to obtain the executable link format file of the application program in the embedded device, determine the variable address and variable size of each variable in the application program according to 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, and determine the variable monitoring result of the application program according to the data information of each variable obtained by the instruction processing device; the executable link format file includes the basic information of each variable under different types generated by the running of the application program; The instruction processing device is used to obtain the data information of each variable from the embedded device according to the variable address and variable size of each variable; and transmit the obtained data information of each variable to the computer device.
9. The variable monitoring system according to claim 8, wherein, 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 indicate to obtain the data information of each variable from the embedded device according to the variable address and variable size of each variable.
10. A variable monitoring device, characterized in that, The device includes: A file acquisition module, configured to acquire an executable link format file of an application program in an embedded device; the executable link format file includes the basic information of each variable under different types generated by the running of the application program; A variable determination module, configured to determine the variable address and variable size of each variable in the application program according to the basic information of each variable under different types in the executable link format file; A data sending module, configured to send the variable address and variable size of each variable to an instruction processing device, and instruct the instruction processing device to obtain the data information of each variable from the embedded device; A monitoring result module, configured to determine the variable monitoring result of the application program according to the data information of each variable obtained by the instruction processing device.
11. A computer device, characterized in that, The computer device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
13. 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 7.
Citation Information
Patent Citations
A general upper computer symbol searching and analyzing method for ELF file debugging information
CN109683900A
Method and system for tracking target variable in executable program
CN113672499A
Communication method, device and system for vehicle and upper computer
CN114268514A
Function monitoring method and device of application program, equipment, storage medium and product
CN118733389A
File processing method and device and computer equipment
CN119645534A