WO2018165831A1 - 一种监测程序变量值的方法及系统 - Google Patents

一种监测程序变量值的方法及系统 Download PDF

Info

Publication number
WO2018165831A1
WO2018165831A1 PCT/CN2017/076506 CN2017076506W WO2018165831A1 WO 2018165831 A1 WO2018165831 A1 WO 2018165831A1 CN 2017076506 W CN2017076506 W CN 2017076506W WO 2018165831 A1 WO2018165831 A1 WO 2018165831A1
Authority
WO
WIPO (PCT)
Prior art keywords
variable
program
program variable
acquired
value
Prior art date
Application number
PCT/CN2017/076506
Other languages
English (en)
French (fr)
Inventor
张德朝
刘衍志
孙东辉
石训军
Original Assignee
深圳市鑫君特智能医疗器械有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市鑫君特智能医疗器械有限公司 filed Critical 深圳市鑫君特智能医疗器械有限公司
Priority to PCT/CN2017/076506 priority Critical patent/WO2018165831A1/zh
Publication of WO2018165831A1 publication Critical patent/WO2018165831A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs

Definitions

  • the present invention belongs to the field of computers, and in particular, to a method and system for monitoring a program variable value.
  • the value of the variable in the program is changed, but in many cases, the emulator can not be debugged online (such as security problems, PCB layout problems, etc.), so it can be through the communication port (such as serial port). , SPI interface, CAN interface, etc.) to achieve program debugging and upgrade.
  • the communication port such as serial port. , SPI interface, CAN interface, etc.
  • the command can be sent to the underlying MCU, the MCU parses the command, and then feeds back the corresponding information to monitor the data.
  • the value of the monitoring program variable is implemented by using an if ...else or a switch...case statement.
  • the present invention provides a method of monitoring a value of a program variable, the method comprising:
  • each variable structure member is at least one program variable to be monitored, a structure for monitoring a value of the program variable, and a member of the structure monitoring the value of the program variable is directed to each variable structure Body pointer
  • the MCU calculates an absolute address corresponding to the program variable to be acquired according to the number of the program variable to be acquired; [0010] The MCU reads the value of the program variable in the absolute address, and feeds back to the user.
  • the present invention provides a system for monitoring a value of a program variable, the system comprising:
  • a declaration module configured to declare at least one variable structure, each member of the variable structure is at least one program variable to be monitored, a structure for monitoring a value of the program variable, and a member of the structure for monitoring the value of the program variable is a pointer to each variable structure;
  • a definition module an object for defining an object of the variable structure and a structure for monitoring the value of the program variable
  • an initialization module configured to initialize an object of the structure that monitors the value of the program variable, and points each pointer to The object of the variable structure
  • a parsing module configured to parse the information about the value of the program variable to be acquired, and obtain the number of the program variable to be acquired, where the information carries the number of the program variable;
  • a calculation module configured to calculate, by the MCU, an absolute address corresponding to the program variable to be acquired according to the number of the program variable to be acquired;
  • a feedback module configured to: the MCU reads a value of the program variable in the absolute address, and feeds back to the user.
  • the member of the structure monitoring the value of the program variable is a pointer to each variable structure
  • the information of the value of the program variable to be acquired received by the MCU carries the number of the program variable, and the MCU according to the program to be acquired
  • the number of the variable calculates the absolute address corresponding to the program variable to be acquired, and obtains the value of the program variable. Therefore, the amount of code of the program is reduced, and the execution efficiency is improved.
  • Embodiment 1 is a flow chart of a method for monitoring a program variable value according to Embodiment 1 of the present invention.
  • FIG. 2 is a schematic structural diagram of a system for monitoring a program variable value according to Embodiment 2 of the present invention.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • a method for monitoring a program variable value according to Embodiment 1 of the present invention includes the following steps:
  • each member of the variable structure is at least one program variable to be monitored, a structure that monitors a value of the program variable, and a member of the structure that monitors the value of the program variable is directed to each a pointer to a variable structure;
  • the S1 01 may specifically declare two or more variable structures, and each variable structure has two members. Or more than two program variables to be monitored to monitor more program variables.
  • the voltage variable structure is specifically defined as
  • the members of the voltage variable structure are 4 program changes to be monitored
  • the members of the current variable structure are four program variables to be monitored.
  • the members representing the structure declaring the value of the monitoring program variable are a pointer to the voltage variable structure and a pointer to the current variable structure.
  • S102 An object that defines a variable structure object and a structure that monitors a value of a program variable
  • Monitor.Current &Current
  • the first member pointer of the object of the structure that monitors the value of the program variable is pointed to the object of the corresponding voltage variable structure, and the second member pointer points to the object of the corresponding current variable structure.
  • S104 After receiving the information about the value of the program variable to be acquired, the MCU parses the information of the value of the program variable to be acquired, and obtains the number of the program variable to be acquired, where the information carries the number of the program variable.
  • the number of the program variable may include a primary number and at least one primary sub-number, and the primary number corresponds to a member number of the object of the structure that monitors the value of the program variable (for example, the first member is 1, The second member is 2, and so on.
  • the program variable number includes the first-level sub-number
  • the sub-number corresponds to the member number of the variable structure object (for example, the first member is 1, and the second member is 2).
  • the variable structure corresponding to the sub-number is the variable structure pointed to by the pointer corresponding to the main number.
  • the first embodiment of the present invention is not limited to two levels, and may have multiple levels according to requirements.
  • the main number of the program variable is set to 1, and the sub number is set to 2.
  • S105 The MCU calculates an absolute address corresponding to the program variable to be acquired according to the number of the program variable to be acquired.
  • S105 is specifically:
  • the MCU calculates an absolute address corresponding to the program variable to be acquired according to the main number of the program variable to be acquired and at least one level sub-number.
  • the calculating by the MCU, the absolute address corresponding to the program variable to be acquired according to the main number of the program variable to be acquired and the at least one level sub-number, which may include:
  • the MCU calculates, according to the main number of the program variable to be acquired, an address pointed to by the member pointer of the object corresponding to the structure of the monitoring program variable, that is, the first address of the object corresponding to the variable structure;
  • the MCU calculates the member address of the object corresponding to the variable structure according to the sub-number of the program variable to be acquired, and the address calculated by the main number;
  • the multi-level sub-number ⁇ the MCU calculates the first address of the object pointing to the next-level corresponding variable structure according to the sub-number of the program variable to be acquired, the address calculated by the main number and the previous-level sub-number, and so on, until Calculate the member address of the object corresponding to the variable structure.
  • S106 The MCU reads the value of the program variable in the absolute address, and feeds back to the user.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1
  • a system for monitoring a program variable value according to Embodiment 2 of the present invention includes:
  • a declaration module 11 is configured to declare at least one variable structure, each member of the variable structure is at least one program variable to be monitored, a structure that monitors a value of the program variable, and a member of the structure that monitors the value of the program variable. a pointer to each variable structure;
  • the declaration module 11 may specifically be used to declare two or more variable structures, and members of each variable structure. Two or more program variables to be monitored to monitor more program variables. When the MCU is 32 bits and the data is stored as 4 bytes aligned, the members of the variable structure are 4 program variables to be monitored.
  • a definition module 12 an object for defining an object of a variable structure and a structure for monitoring a value of a program variable
  • an initialization module 13 for initializing an object of a structure that monitors a value of a program variable, pointing each pointer The object of the corresponding variable structure
  • the parsing module 14 is configured to parse the information about the value of the program variable to be acquired, and obtain the number of the program variable to be acquired, where the information carries the number of the program variable;
  • the number of the program variable may include a primary number and at least one primary sub-number, and the primary number corresponds to a member number of the object of the structure that monitors the value of the program variable (for example, the first member is 1, The second member is 2, and so on.
  • the program variable number includes the first-level sub-number
  • the sub-number corresponds to the member number of the variable structure object (for example, the first member is 1, and the second member is 2).
  • the variable structure corresponding to the sub-number is the variable structure pointed to by the pointer corresponding to the main number.
  • Embodiment 1 of the present invention is not limited to two levels, and may have multiple levels according to requirements.
  • the calculation module 15 is configured to calculate, by the MCU, an absolute address corresponding to the program variable to be acquired according to the number of the program variable to be acquired;
  • the calculating module may be specifically configured to: calculate, by the MCU, an absolute address corresponding to the to-be-obtained program variable according to the main number of the program variable to be acquired and the at least one-level sub-number.
  • the calculating module may specifically include:
  • a first sub-calculation module configured to calculate, by the MCU, an address pointed to by a member pointer of an object corresponding to the structure of the monitoring program variable according to the main number of the program variable to be acquired, that is, a first address of the object corresponding to the variable structure ;
  • a second sub-calculation module configured to: when the number of the program variable includes a first-level sub-number, the MCU calculates a member of the object corresponding to the variable structure according to the sub-number of the program variable to be acquired, and the address calculated by the main number Address; When the number of the program variable includes a multi-level sub-number, the MCU calculates the object pointing to the next-level corresponding variable structure according to the sub-number of the program variable to be acquired, the address calculated by the main number and the previous sub-number. The first address, and so on, until the member address of the object corresponding to the variable structure is calculated.
  • the feedback module 16 is configured to read, by the MCU, the value of the program variable in the absolute address, and feed back to the user.
  • the member of the structure that monitors the value of the program variable is a pointer to each variable structure
  • the information of the value of the program variable to be acquired received by the MCU carries the number of the program variable, and the MCU according to the program to be acquired
  • the number of the variable calculates the absolute address corresponding to the program variable to be acquired, and obtains the value of the program variable. . Therefore, the amount of code of the program is reduced, and the execution efficiency is improved.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

一种监测程序变量值的方法及系统,适用于计算机领域。所述方法包括:声明至少一个变量结构体,每个变量结构体的成员为多个待监测的程序变量,声明监测程序变量值的结构体,监测程序变量值的结构体的成员为指向每个变量结构体的指针(S101);定义变量结构体的对象和监测程序变量值的结构体的对象(S102);初始化监测程序变量值的结构体的对象,将每个指针指向对应的变量结构体的对象(S103);MCU接收到待获取程序变量值的信息后,解析所述待获取程序变量值的信息,得到待获取程序变量的编号,所述信息携带了程序变量的编号(S104);MCU根据待获取程序变量的编号计算出待获取程序变量对应的绝对地址(S105);MCU读取所述绝对地址中的程序变量值,并向用户反馈(S106)。上述方法及系统减少了程序的代码量,提高了执行效率。

Description

一种监测程序变量值的方法及系统 技术领域
[0001] 本发明属于计算机领域, 尤其涉及一种监测程序变量值的方法及系统。
背景技术
[0002] 在嵌入式底层程序幵发中, 经常需要监测程序中变量的值的变化。 使用仿真器 在线调试的吋候, 可以在集成幵发环境 (IDE, Integrated Development
Environment ) 的功能窗口上査看到程序中变量的值的变化, 但是很多吋候, 不 能够实现仿真器在线调试 (例如安全问题、 PCB布板问题等) , 这吋可以通过通 讯端口 (例如串口、 SPI接口、 CAN接口等) 来实现程序的调试和升级。 在使用 通讯端口进行调试程序的吋候, 为了监测程序中变量的值的变化, 可以发送命 令到底层的 MCU, MCU解析命令, 然后反馈相应的信息, 实现对数据的监测。 现有的技术方案中, 使用 if ...else或者 switch...case语句来实现监测程序变量值, 在需要监测的变量比较多的情况下, 代码量大, 执行效率低。
技术问题
[0003] 本发明的目的在于提供一种监测程序变量值的方法及系统, 旨在解决使用 if... e lse或者 switch...case语句来实现监测程序变量值, 在需要监测的变量比较多的情 况下, 代码量大, 执行效率低的问题。
问题的解决方案
技术解决方案
[0004] 第一方面, 本发明提供了一种监测程序变量值的方法, 所述方法包括:
[0005] 声明至少一个变量结构体, 每个变量结构体的成员为至少一个待监测的程序变 量, 声明监测程序变量值的结构体, 监测程序变量值的结构体的成员为指向每 个变量结构体的指针;
[0006] 定义变量结构体的对象和监测程序变量值的结构体的对象;
[0007] 初始化监测程序变量值的结构体的对象, 将每个指针指向对应的变量结构体的 对象; [0008] MCU接收到待获取程序变量值的信息后, 解析所述待获取程序变量值的信息
, 得到待获取程序变量的编号, 所述信息携带了程序变量的编号;
[0009] MCU根据待获取程序变量的编号计算出待获取程序变量对应的绝对地址; [0010] MCU读取所述绝对地址中的程序变量值, 并向用户反馈。
[0011] 第二方面, 本发明提供了一种监测程序变量值的系统, 所述系统包括:
[0012] 声明模块, 用于声明至少一个变量结构体, 每个变量结构体的成员为至少一个 待监测的程序变量, 声明监测程序变量值的结构体, 监测程序变量值的结构体 的成员为指向每个变量结构体的指针;
[0013] 定义模块, 用于定义变量结构体的对象和监测程序变量值的结构体的对象; [0014] 初始化模块, 用于初始化监测程序变量值的结构体的对象, 将每个指针指向对 应的变量结构体的对象;
[0015] 解析模块, 用于 MCU接收到待获取程序变量值的信息后, 解析所述待获取程 序变量值的信息, 得到待获取程序变量的编号, 所述信息携带了程序变量的编 号;
[0016] 计算模块, 用于 MCU根据待获取程序变量的编号计算出待获取程序变量对应 的绝对地址;
[0017] 反馈模块, 用于 MCU读取所述绝对地址中的程序变量值, 并向用户反馈。
发明的有益效果
有益效果
[0018] 在本发明中, 由于监测程序变量值的结构体的成员为指向每个变量结构体的指 针, MCU接收的待获取程序变量值的信息携带了程序变量的编号, MCU根据待 获取程序变量的编号计算出待获取程序变量对应的绝对地址, 获取程序变量值 。 因此减少了程序的代码量, 提高了执行效率。
对附图的简要说明
附图说明
[0019] 图 1是本发明实施例一提供的监测程序变量值的方法流程图。
[0020] 图 2是本发明实施例二提供的监测程序变量值的系统的结构示意图。 实施该发明的最佳实施例
本发明的最佳实施方式
[0021] 为了使本发明的目的、 技术方案及有益效果更加清楚明白, 以下结合附图及实 施例, 对本发明进行进一步详细说明。 应当理解, 此处所描述的具体实施例仅 仅用以解释本发明, 并不用于限定本发明。
[0022] 为了说明本发明所述的技术方案, 下面通过具体实施例来进行说明。
[0023] 实施例一:
[0024] 请参阅图 1, 本发明实施例一提供的监测程序变量值的方法包括以下步骤:
[0025] S101、 声明至少一个变量结构体, 每个变量结构体的成员为至少一个待监测的 程序变量, 声明监测程序变量值的结构体, 监测程序变量值的结构体的成员为 指向每个变量结构体的指针;
[0026] 由于本发明实施例一通常是应用于需要监测的程序变量比较多的情况, 因此 S1 01具体可以是声明两个或两个以上变量结构体, 每个变量结构体的成员为两个 或两个以上待监测的程序变量, 以监测更多的程序变量。
[0027] 例如, 以 32位 MCU, 数据存储为 4字节对齐为例, 声明电压变量结构体具体为
[0028] typedef struct —VOLTAGE {
[0029] Uint8 Ul;
[0030] Uint8 U2;
[0031] Uint8 U3;
[0032] Uint8 U4;
[0033] JVOLTAGE;
[0034] 该电压变量结构体的成员为 4个待监测的程序变
[0035] 声明电流变邐 :结构体具体为:
[0036] typedef struct —CURRENT {
[0037] Uint8 Il;
[0038] Uint8 12;
[0039] Uint8 13; [0040] Uint8 14;
[0041] JCURRENT;
[0042] 该电流变量结构体的成员为 4个待监测的程序变量。
[0043] 声明监测程序变量值的结构体具体为:
[0044] 例如:
[0045] typedef struct—MONITOR {
[0046] VOLTAGE *Voltage;
[0047] CURRENT *Current;
[0048] JMONITOR;
[0049] 表示声明监测程序变量值的结构体的成员为指向电压变量结构体的指针和指向 电流变量结构体的指针。
[0050] S102、 定义变量结构体的对象和监测程序变量值的结构体的对象;
[0051] S103、 初始化监测程序变量值的结构体的对象, 将每个指针指向对应的变量结 构体的对象;
[0052] 例如:
[0053] MONITOR Monitor;
[0054] Monitor. Voltage = &Voltage;
[0055] Monitor.Current = &Current;
[0056] 表示将监测程序变量值的结构体的对象的第一个成员指针指向对应的电压变量 结构体的对象, 第二个成员指针指向对应的电流变量结构体的对象。
[0057] S104、 MCU接收到待获取程序变量值的信息后, 解析所述待获取程序变量值 的信息, 得到待获取程序变量的编号, 所述信息携带了程序变量的编号;
[0058] 在本发明实施例一中, 程序变量的编号可以包括主编号和至少一级子编号, 主 编号对应监测程序变量值的结构体的对象的成员编号 (例如第一个成员为 1, 第二 个成员为 2, 以此类推), 当程序变量的编号包括一级子编号吋, 子编号对应变量 结构体的对象的成员编号 (例如第一个成员为 1, 第二个成员为 2, 以此类推), 子 编号对应的变量结构体为主编号对应的指针指向的变量结构体。 本发明实施例 一不限于两个层次, 根据需求, 可以多个层次。 [0059] 例如, 要获取 S101步骤中举例中的 U2的值, 则程序变量的主编号设为 1, 子编 号设为 2。
[0060] S105、 MCU根据待获取程序变量的编号计算出待获取程序变量对应的绝对地 址;
[0061] 在本发明实施例一中, S105具体为:
[0062] MCU根据待获取程序变量的主编号和至少一级子编号计算出待获取程序变量 对应的绝对地址。
[0063] 所述 MCU根据待获取程序变量的主编号和至少一级子编号计算出待获取程序 变量对应的绝对地址具体可以包括:
[0064] MCU根据待获取程序变量的主编号, 计算出对应监测程序变量值的结构体的 对象的成员指针指向的地址, 即对应变量结构体的对象的首地址;
[0065] 当程序变量的编号包括一级子编号吋, MCU根据待获取程序变量的子编号, 结合主编号计算的地址, 计算出对应变量结构体的对象的成员地址; 当程序变 量的编号包括多级子编号吋, MCU根据待获取程序变量的子编号, 结合主编号 以及上一级子编号计算的地址, 计算出指向下一级对应变量结构体的对象的首 地址, 依此类推, 直至计算出对应变量结构体的对象的成员地址。
[0066] S106、 MCU读取所述绝对地址中的程序变量值, 并向用户反馈。
[0067] 实施例二:
[0068] 请参阅图 2, 本发明实施例二提供的监测程序变量值的系统包括:
[0069] 声明模块 11, 用于声明至少一个变量结构体, 每个变量结构体的成员为至少一 个待监测的程序变量, 声明监测程序变量值的结构体, 监测程序变量值的结构 体的成员为指向每个变量结构体的指针;
[0070] 由于本发明实施例二通常是应用于需要监测的程序变量比较多的情况, 因此声 明模块 11具体可以是用于声明两个或两个以上变量结构体, 每个变量结构体的 成员为两个或两个以上待监测的程序变量, 以监测更多的程序变量。 当 MCU是 3 2位, 数据存储为 4字节对齐吋, 变量结构体的成员为 4个待监测的程序变量。
[0071] 定义模块 12, 用于定义变量结构体的对象和监测程序变量值的结构体的对象 [0072] 初始化模块 13, 用于初始化监测程序变量值的结构体的对象, 将每个指针指向 对应的变量结构体的对象;
[0073] 解析模块 14, 用于 MCU接收到待获取程序变量值的信息后, 解析所述待获取 程序变量值的信息, 得到待获取程序变量的编号, 所述信息携带了程序变量的 编号;
[0074] 在本发明实施例二中, 程序变量的编号可以包括主编号和至少一级子编号, 主 编号对应监测程序变量值的结构体的对象的成员编号 (例如第一个成员为 1, 第二 个成员为 2, 以此类推), 当程序变量的编号包括一级子编号吋, 子编号对应变量 结构体的对象的成员编号 (例如第一个成员为 1, 第二个成员为 2, 以此类推), 子 编号对应的变量结构体为主编号对应的指针指向的变量结构体。 本发明实施例 一不限于两个层次, 根据需求, 可以多个层次。
[0075] 计算模块 15, 用于 MCU根据待获取程序变量的编号计算出待获取程序变量对 应的绝对地址;
[0076] 在本发明实施例二中, 所述计算模块具体可以用于: MCU根据待获取程序变 量的主编号和至少一级子编号计算出待获取程序变量对应的绝对地址。
[0077] 所述计算模块具体可以包括:
[0078] 第一子计算模块, 用于 MCU根据待获取程序变量的主编号, 计算出对应监测 程序变量值的结构体的对象的成员指针指向的地址, 即对应变量结构体的对象 的首地址;
[0079] 第二子计算模块, 用于当程序变量的编号包括一级子编号吋, MCU根据待获 取程序变量的子编号, 结合主编号计算的地址, 计算出对应变量结构体的对象 的成员地址; 当程序变量的编号包括多级子编号吋, MCU根据待获取程序变量 的子编号, 结合主编号以及上一级子编号计算的地址, 计算出指向下一级对应 变量结构体的对象的首地址, 依此类推, 直至计算出对应变量结构体的对象的 成员地址。
[0080] 反馈模块 16, 用于 MCU读取所述绝对地址中的程序变量值, 并向用户反馈。
[0081] 在本发明中, 由于监测程序变量值的结构体的成员为指向每个变量结构体的指 针, MCU接收的待获取程序变量值的信息携带了程序变量的编号, MCU根据待 获取程序变量的编号计算出待获取程序变量对应的绝对地址, 获取程序变量值 。 因此减少了程序的代码量, 提高了执行效率。
[0082] 本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以 通过程序来指令相关的硬件来完成, 所述的程序可以存储于一计算机可读取存 储介质中, 所述的存储介质, 如 ROM/RAM、 磁盘、 光盘等。
[0083] 以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡在本发明的 精神和原则之内所作的任何修改、 等同替换和改进等, 均应包含在本发明的保 护范围之内。

Claims

权利要求书
[权利要求 1] 一种监测程序变量值的方法, 其特征在于, 所述方法包括:
声明至少一个变量结构体, 每个变量结构体的成员为至少一个待监测 的程序变量, 声明监测程序变量值的结构体, 监测程序变量值的结构 体的成员为指向每个变量结构体的指针;
定义变量结构体的对象和监测程序变量值的结构体的对象; 初始化监测程序变量值的结构体的对象, 将每个指针指向对应的变量 结构体的对象;
MCU接收到待获取程序变量值的信息后, 解析所述待获取程序变量 值的信息, 得到待获取程序变量的编号, 所述信息携带了程序变量的 编号;
MCU根据待获取程序变量的编号计算出待获取程序变量对应的绝对 地址;
MCU读取所述绝对地址中的程序变量值, 并向用户反馈。
[权利要求 2] 如权利要求 1所述的方法, 其特征在于, 所述声明至少一个变量结构 体具体是声明两个或两个以上变量结构体; 所述每个变量结构体的成 员为至少一个待监测的程序变量具体为每个变量结构体的成员为两个 或两个以上待监测的程序变量。
[权利要求 3] 如权利要求 1所述的方法, 其特征在于, 所述程序变量的编号包括主 编号和至少一级子编号, 主编号对应监测程序变量值的结构体的对象 的成员编号, 当程序变量的编号包括一级子编号吋, 子编号对应变量 结构体的对象的成员编号, 子编号对应的变量结构体为主编号对应的 指针指向的变量结构体。
[权利要求 4] 如权利要求 3所述的方法, 其特征在于, 所述 MCU根据待获取程序变 量的编号计算出待获取程序变量对应的绝对地址具体为:
MCU根据待获取程序变量的主编号和至少一级子编号计算出待获取 程序变量对应的绝对地址。
[权利要求 5] 如权利要求 4所述的方法, 其特征在于, 所述 MCU根据待获取程序变 量的主编号和至少一级子编号计算出待获取程序变量对应的绝对地址 具体包括:
MCU根据待获取程序变量的主编号, 计算出对应监测程序变量值的 结构体的对象的成员指针指向的地址, 即对应变量结构体的对象的首 地址;
当程序变量的编号包括一级子编号吋, MCU根据待获取程序变量的 子编号, 结合主编号计算的地址, 计算出对应变量结构体的对象的成 员地址; 当程序变量的编号包括多级子编号吋, MCU根据待获取程 序变量的子编号, 结合主编号以及上一级子编号计算的地址, 计算出 指向下一级对应变量结构体的对象的首地址, 依此类推, 直至计算出 对应变量结构体的对象的成员地址。
[权利要求 6] —种监测程序变量值的系统, 其特征在于, 所述系统包括:
声明模块, 用于声明至少一个变量结构体, 每个变量结构体的成员为 至少一个待监测的程序变量, 声明监测程序变量值的结构体, 监测程 序变量值的结构体的成员为指向每个变量结构体的指针;
定义模块, 用于定义变量结构体的对象和监测程序变量值的结构体的 对象;
初始化模块, 用于初始化监测程序变量值的结构体的对象, 将每个指 针指向对应的变量结构体的对象;
解析模块, 用于 MCU接收到待获取程序变量值的信息后, 解析所述 待获取程序变量值的信息, 得到待获取程序变量的编号, 所述信息携 带了程序变量的编号;
计算模块, 用于 MCU根据待获取程序变量的编号计算出待获取程序 变量对应的绝对地址;
反馈模块, 用于 MCU读取所述绝对地址中的程序变量值, 并向用户 反馈。
[权利要求 7] 如权利要求 6所述的系统, 其特征在于, 所述声明至少一个变量结构 体具体是声明两个或两个以上变量结构体; 所述每个变量结构体的成 员为至少一个待监测的程序变量具体为每个变量结构体的成员为两个 或两个以上待监测的程序变量。
[权利要求 8] 如权利要求 6所述的系统, 其特征在于, 所述程序变量的编号包括主 编号和至少一级子编号, 主编号对应监测程序变量值的结构体的对象 的成员编号, 当程序变量的编号包括一级子编号吋, 子编号对应变量 结构体的对象的成员编号, 子编号对应的变量结构体为主编号对应的 指针指向的变量结构体。
[权利要求 9] 如权利要求 8所述的系统, 其特征在于, 所述计算模块具体用于:
MCU根据待获取程序变量的主编号和至少一级子编号计算出待获取 程序变量对应的绝对地址。
[权利要求 10] 如权利要求 9所述的系统, 其特征在于, 所述计算模块具体包括: 第一子计算模块, 用于 MCU根据待获取程序变量的主编号, 计算出 对应监测程序变量值的结构体的对象的成员指针指向的地址, 即对应 变量结构体的对象的首地址;
第二子计算模块, 用于当程序变量的编号包括一级子编号吋, MCU 根据待获取程序变量的子编号, 结合主编号计算的地址, 计算出对应 变量结构体的对象的成员地址; 当程序变量的编号包括多级子编号吋 , MCU根据待获取程序变量的子编号, 结合主编号以及上一级子编 号计算的地址, 计算出指向下一级对应变量结构体的对象的首地址, 依此类推, 直至计算出对应变量结构体的对象的成员地址。
PCT/CN2017/076506 2017-03-13 2017-03-13 一种监测程序变量值的方法及系统 WO2018165831A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/076506 WO2018165831A1 (zh) 2017-03-13 2017-03-13 一种监测程序变量值的方法及系统

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/076506 WO2018165831A1 (zh) 2017-03-13 2017-03-13 一种监测程序变量值的方法及系统

Publications (1)

Publication Number Publication Date
WO2018165831A1 true WO2018165831A1 (zh) 2018-09-20

Family

ID=63521806

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/076506 WO2018165831A1 (zh) 2017-03-13 2017-03-13 一种监测程序变量值的方法及系统

Country Status (1)

Country Link
WO (1) WO2018165831A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090063725A1 (en) * 2007-08-31 2009-03-05 O2Micro Inc. Direct memory access system
CN101751321A (zh) * 2008-12-18 2010-06-23 中兴通讯股份有限公司 一种动态可视化查看变量的实现方法及系统
CN102787932A (zh) * 2012-08-28 2012-11-21 江西直方数控动力有限公司 基于串行通信的电控柴油发动机匹配标定装置和方法
CN103136107A (zh) * 2011-12-03 2013-06-05 南京南瑞继保电气有限公司 一种嵌入式程序动态分配内存的变量调试方法
CN104035360A (zh) * 2014-05-07 2014-09-10 株洲易力达机电有限公司 一种eps控制器的调参方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090063725A1 (en) * 2007-08-31 2009-03-05 O2Micro Inc. Direct memory access system
CN101751321A (zh) * 2008-12-18 2010-06-23 中兴通讯股份有限公司 一种动态可视化查看变量的实现方法及系统
CN103136107A (zh) * 2011-12-03 2013-06-05 南京南瑞继保电气有限公司 一种嵌入式程序动态分配内存的变量调试方法
CN102787932A (zh) * 2012-08-28 2012-11-21 江西直方数控动力有限公司 基于串行通信的电控柴油发动机匹配标定装置和方法
CN104035360A (zh) * 2014-05-07 2014-09-10 株洲易力达机电有限公司 一种eps控制器的调参方法及装置

Similar Documents

Publication Publication Date Title
Nunes et al. {VRASED}: A verified {Hardware/Software}{Co-Design} for remote attestation
JP4768990B2 (ja) オンチップ・システム用の構成可能アドレス・マッピングと保護アーキテクチャ及びハードウエアに関する方法及び装置
Song et al. BitBlaze: A new approach to computer security via binary analysis
Nelson et al. Specification and verification in the field: Applying formal methods to {BPF} just-in-time compilers in the linux kernel
US20100205580A1 (en) Generating parallel simd code for an arbitrary target architecture
US8086438B2 (en) Method and system for instruction-set architecture simulation using just in time compilation
KR20040075696A (ko) 네트워크 내의 장치들을 관리하기 위한 방법, 시스템 및프로그램
Yang et al. Formal process virtual machine for smart contracts verification
Wang et al. Demadroid: Object Reference Graph‐Based Malware Detection in Android
US10656926B2 (en) Compact type layouts
CN109542419B (zh) 一种can信息处理软件开发的方法、系统及设备
WO2012079401A1 (zh) 一种虚拟串口系统及其通信方法
WO2018165831A1 (zh) 一种监测程序变量值的方法及系统
De Oliveira Nunes et al. Casu: Compromise avoidance via secure update for low-end embedded systems
CN107015798A (zh) 一种监测程序变量值的方法及系统
CN109214184A (zh) 一种Android加固应用程序通用自动化脱壳方法和装置
CN103399782B (zh) 一种实现Simulink模块仿真数据输出到界面的方法及装置
Bogdanov et al. Flash programming low power microcontrollers over the Internet
Bergstra et al. A bypass of Cohen’s impossibility result
Nunes et al. Formally verified hardware/software co-design for remote attestation
CN112995339B (zh) 一种基于动态字节码技术自动适配传感器数据解析方法
Viarheichyk Embedded Programming with Modern C++ Cookbook: Practical recipes to help you build robust and secure embedded applications on Linux
CN111857664B (zh) 一种应用开发的方法、装置、设备及存储介质
Jin et al. Strategies of modeling from VDM-SL to JML
CN110347574B (zh) 一套终端节点的辅助开发系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17900697

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 17/01/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17900697

Country of ref document: EP

Kind code of ref document: A1