JP5541201B2 - Program execution status monitoring apparatus and execution status monitoring program - Google Patents
Program execution status monitoring apparatus and execution status monitoring program Download PDFInfo
- Publication number
- JP5541201B2 JP5541201B2 JP2011058289A JP2011058289A JP5541201B2 JP 5541201 B2 JP5541201 B2 JP 5541201B2 JP 2011058289 A JP2011058289 A JP 2011058289A JP 2011058289 A JP2011058289 A JP 2011058289A JP 5541201 B2 JP5541201 B2 JP 5541201B2
- Authority
- JP
- Japan
- Prior art keywords
- value
- program
- execution status
- status monitoring
- updating
- Prior art date
- Legal status (The legal status 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 status listed.)
- Expired - Fee Related
Links
Landscapes
- Debugging And Monitoring (AREA)
Description
本発明は、コンピュータにおいて実行されるプログラムが正常に実行されているか否かを監視するプログラム実行状況監視装置、および実行状況監視プログラムに関する。 The present invention relates to a program execution status monitoring apparatus and an execution status monitoring program for monitoring whether or not a program executed in a computer is normally executed.
上記プログラム実行状況監視装置として、プログラムにおいて関数定義の際(サブルーチンを実行する際)に、命令内容や復帰アドレス等を表に書き込み、この表を検査することでプログラムが正常に実行されているか否かを検査できるようにしたものが知られている(例えば特許文献1参照)。 Whether the program is executed normally by writing the command contents, return address, etc. into a table when defining a function in the program (when executing a subroutine) as a program execution status monitoring device. There is known one that can check whether or not (see, for example, Patent Document 1).
しかしながら、上記プログラム実行状況監視装置では、命令内容や復帰アドレス等を表に書き込むため、表のための膨大な記憶容量が必要になるという問題点があった。
そこで、このような問題点を鑑み、コンピュータにおいて実行されるプログラムが正常に実行されているか否かを監視するプログラム実行状況監視装置、および実行状況監視プログラムにおいて、多くの記憶容量を必要とすることなくプログラムが正常に実行されているか否かを監視できる技術を提供することを本発明の目的とする。
However, the program execution status monitoring apparatus has a problem in that a huge storage capacity is required for the table because the contents of the instruction, the return address, and the like are written in the table.
Therefore, in view of such problems, a program execution status monitoring apparatus and an execution status monitoring program for monitoring whether or not a program executed on a computer is normally executed require a large amount of storage capacity. It is an object of the present invention to provide a technique capable of monitoring whether or not a program is normally executed.
かかる目的を達成するために成された第1の構成のプログラム実行状況監視装置において、第1更新手段は、監視対象プログラムの一部の処理として、予め第1の記録領域に記録された第1の値および予め第2の記録領域に記録された第2の値のうちの直近の時刻に更新された値(現在を基準として更新時刻が最も近いもの)との対応関係が所定条件を満たすための第1の操作を行うことで求められる値である第1新値に、第1の値および第2の値のうちの直近の時刻に更新されていない値を更新する。また、操作値生成手段は、監視対象プログラムの一部の処理として、第1新値に対して第2の操作を行うことで得られる操作値を生成する。そして、第2更新手段は、監視対象プログラムの一部の処理として、正常な順序でこの監視対象プログラムが実施される場合に第1更新手段による処理の後で第1更新手段が更新していない第1の値または第2の値を更新する処理であって、操作値に対して第1の操作および第2の操作を相殺する操作を行うことで求められる値である第2新値に、第1の値および第2の値のうちの直近の時刻に更新されていない値を更新する。さらに、対応関係判定出力手段は、監視対象プログラムとは別の処理として、第1の値と第2の値との対応関係が所定の関係になっているか否かを繰り返し判定し、この判定結果に応じた出力を行う。 In the program execution status monitoring apparatus having the first configuration configured to achieve such an object, the first updating means includes a first update unit previously recorded in the first recording area as part of the process of the monitoring target program. And the value updated at the most recent time among the second values previously recorded in the second recording area (the one with the closest update time based on the current time) satisfies the predetermined condition. The value which is not updated at the latest time among the first value and the second value is updated to the first new value which is a value obtained by performing the first operation. The operation value generation means generates an operation value obtained by performing a second operation on the first new value as part of the process of the monitoring target program. Then, the second updating unit does not update the first updating unit after the processing by the first updating unit when the monitoring target program is executed in a normal order as a part of the monitoring target program. In the process of updating the first value or the second value, the second new value, which is a value obtained by performing an operation that cancels the first operation and the second operation with respect to the operation value, Of the first value and the second value, the value not updated at the latest time is updated. Further, the correspondence relationship determination output means repeatedly determines whether or not the correspondence relationship between the first value and the second value is a predetermined relationship as a process different from the monitoring target program. Output according to.
本発明において例えば、第1更新手段によって求められる第1新値が第1の値を更新する値である場合には、正常な順序で第2更新手段が作動する場合には、第2の値が第2新値に更新される。この第2新値を求める際には、第1の値との関係が所定条件を満たす第2の値に対して第1の操作および第2の操作を行うことで生成された操作値に対して、第1の操作と第2の操作とを相殺する操作を行うので、第2の値は第1の値との対応関係は所定条件を満たすように維持される。 In the present invention, for example, when the first new value obtained by the first updating unit is a value for updating the first value, the second value is used when the second updating unit operates in a normal order. Is updated to the second new value. When obtaining the second new value, the first operation and the operation value generated by performing the second operation on the second value whose relationship with the first value satisfies a predetermined condition are obtained. Thus, since the operation for canceling the first operation and the second operation is performed, the correspondence between the second value and the first value is maintained so as to satisfy a predetermined condition.
一方、正常な順序で第2更新手段が作動せず、別の処理によって第2の値が更新されたと仮定し、次に第2更新手段が作動すると第1の値が第2新値に更新される。この場合には、本来、第2の値となるべき値が第1の値になるため、第1新値(第1の値)と第2新値(第2の値)との対応関係は所定条件を満たすように維持されない可能性が高い。また、プログラムカウンタが電磁波の影響等によって破壊等され、意図しない値に書き換わる場合においても、第1新値(第1の値)と第2新値(第2の値)との対応関係は所定条件を満たすように維持されない可能性が高い。 On the other hand, it is assumed that the second updating unit does not operate in a normal order and the second value is updated by another process, and then the first value is updated to the second new value when the second updating unit is operated next. Is done. In this case, since the value that should be the second value is originally the first value, the correspondence between the first new value (first value) and the second new value (second value) is There is a high possibility that the predetermined condition is not maintained. In addition, even when the program counter is destroyed due to the influence of electromagnetic waves or the like and rewritten to an unintended value, the correspondence between the first new value (first value) and the second new value (second value) is There is a high possibility that the predetermined condition is not maintained.
したがって、このようなプログラム実行状況監視装置によれば、第1の数値と第2の数値との関係を監視することでプログラムの実行状況を判定することができる。また、この判定の際には、第1の値、第2の値、および操作値を記録する記録領域を備えておけばよいので、実行された命令等を記録した表を準備する構成と比較して、少ない記録領域でプログラムが正常に実行されているか否かを監視することができる。 Therefore, according to such a program execution status monitoring apparatus, the program execution status can be determined by monitoring the relationship between the first numerical value and the second numerical value. Further, in this determination, since it is sufficient to provide a recording area for recording the first value, the second value, and the operation value, it is compared with a configuration in which a table in which executed instructions are recorded is prepared. Thus, it is possible to monitor whether the program is normally executed with a small recording area.
なお、第1更新手段は、第1の値および第2の値のうちの直近の時刻に更新されていない値等の所定の値に対して第1の操作を行うようにすればよい。
ところで、上記プログラム実行状況監視装置においては、第2の構成のように、第1更新手段、操作値生成手段、および第2更新手段は、これらを1組として複数組備えられており、操作値生成手段は、第1新値に対してこの第1更新手段が属する組特有の第2の操作を行うことで操作値を生成し、第2更新手段は、既に読み出された操作値を除く操作値のうちの最新のものを読み出し、この操作値に対して、この第2更新手段が属する組の操作値生成手段が行った第2の操作および第1の操作を相殺する操作を行うことで第2新値を演算するようにしてもよい。
Note that the first updating means may perform the first operation on a predetermined value such as a value that has not been updated at the most recent time among the first value and the second value.
By the way, in the program execution status monitoring apparatus, as in the second configuration, a plurality of first update means, operation value generation means, and second update means are provided as one set. The generation unit generates an operation value by performing a second operation specific to the set to which the first update unit belongs to the first new value, and the second update unit excludes the operation value that has already been read. Reading the latest one of the operation values and performing an operation to cancel the second operation and the first operation performed by the operation value generation unit of the set to which the second update unit belongs with respect to the operation value. The second new value may be calculated with
このようなプログラム実行状況監視装置によれば、操作値生成手段は、組毎に異なる操作値を生成し、第2更新手段は既に読み出された操作値を除く操作値のうちの最新のものを読み出し、該操作値に対して組毎に異なる第2の操作を相殺する操作を行うので、プログラムの実行順序に誤りが生じると、第2更新手段は第2の操作を相殺することができなくなる。この結果、プログラムの実行順序に誤りが生じると、第1の値と第2の値との対応関係が変化する可能性が高くなるため、複数組の第1更新手段、操作値生成手段、および第2更新手段を備えた構成であっても、プログラムの実行状況を判定することができる。 According to such a program execution status monitoring apparatus, the operation value generating means generates a different operation value for each set, and the second updating means is the latest one of the operation values excluding the already read operation values. , And an operation for canceling out the second operation that differs for each set with respect to the operation value is performed. Therefore, if an error occurs in the execution order of the program, the second update means can cancel out the second operation. Disappear. As a result, if an error occurs in the execution order of the program, there is a high possibility that the correspondence between the first value and the second value will change. Therefore, a plurality of sets of first update means, operation value generation means, and Even with the configuration provided with the second update means, the execution status of the program can be determined.
なお、本発明においては、ある組の第1更新手段および操作値生成手段が実施された直後に、この組の第2更新手段が実施された場合、または、ある組の第1更新手段および操作値生成手段が実施された後、この組の第2更新手段が実施される前に、他の組(複数の組でも可。)の第1更新手段、操作値生成手段、および第2更新手段が実施された場合に、プログラムの実行順序が正しい場合の第2新値が演算される。 In the present invention, when this set of second update means is implemented immediately after a set of first update means and operation value generation means is implemented, or a set of first update means and operation. After the value generation means is implemented and before this set of second update means is implemented, the first update means, the operation value generation means, and the second update means of another set (may be a plurality of sets). Is executed, the second new value when the execution order of the program is correct is calculated.
さらに、上記プログラム実行状況監視装置においては、第3の構成のように、第1更新手段は、監視対象プログラムにおける関数定義の前半部分において第1新値を演算し、第2更新手段は、第1更新手段が第1新値を演算する関数定義の後半部分において第2新値を演算するようにしてもよい。 Further, in the program execution status monitoring apparatus, as in the third configuration, the first update means calculates the first new value in the first half of the function definition in the monitored program, and the second update means The second update value may be calculated in the second half of the function definition in which one update means calculates the first new value.
このようなプログラム実行状況監視装置によれば、第1更新手段および第2更新手段による処理が実施される関数定義内のプログラムが正常に作動したか否かを確認することができる。 According to such a program execution status monitoring apparatus, it is possible to confirm whether or not the program in the function definition in which the processing by the first update unit and the second update unit is performed normally operates.
また、上記プログラム実行状況監視装置においては、第4の構成のように、対応関係判定出力手段は、第1の値と第2の値との対応関係が所定の関係になっていない場合の出力として、監視対象プログラムを実行する処理をリセットさせる信号を出力するようにしてもよい。 In the program execution status monitoring apparatus, as in the fourth configuration, the correspondence determination output means outputs when the correspondence between the first value and the second value is not a predetermined relationship. As another example, a signal for resetting the process of executing the monitoring target program may be output.
このようなプログラム実行状況監視装置によれば、第1の値と第2の値との対応関係が所定の関係になっていない状態、つまり、プログラム実行状況に異常がある場合に、監視対象プログラムを実行する処理をリセットさせることができる。 According to such a program execution status monitoring apparatus, when the correspondence relationship between the first value and the second value is not a predetermined relationship, that is, when the program execution status is abnormal, the monitored program Can be reset.
次に、上記目的を達成するために成された実行状況監視プログラムは、コンピュータを、上記何れかに記載のプログラム実行状況監視装置を構成する各手段として機能させるためのプログラムであることを特徴とする。 Next, the execution status monitoring program formed to achieve the above object is a program for causing a computer to function as each means constituting the program execution status monitoring device described above. To do.
このような実行状況監視プログラムによれば、少なくとも請求項1に記載のプログラム実行状況監視装置と同様の効果を享受することができる。 According to such an execution status monitoring program, at least the same effects as those of the program execution status monitoring device according to claim 1 can be obtained.
以下に本発明にかかる実施の形態を図面と共に説明する。
[本実施形態の構成]
図1は、本発明が適用された実行状況監視装置1の概略構成を示すブロック図である。実行状況監視装置1は、図1に示すように、処理実行装置10(プログラム実行状況監視装置)と、ウォッチドック回路21と、を備えて構成されており、処理実行装置10にて実行されるプログラムが正常に実行されているか否かを監視する機能を有する。
Embodiments according to the present invention will be described below with reference to the drawings.
[Configuration of this embodiment]
FIG. 1 is a block diagram showing a schematic configuration of an execution status monitoring apparatus 1 to which the present invention is applied. As shown in FIG. 1, the execution status monitoring device 1 includes a process execution device 10 (program execution status monitoring device) and a watchdog circuit 21, and is executed by the process execution device 10. It has a function of monitoring whether or not the program is normally executed.
詳細には、処理実行装置10は、CPU11と、ROMに格納されたメインプログラム13および監視プログラム14と、RAMとして構成された記憶領域15と、を備えたマイコンとして構成されている。CPU11には、プログラムの起動タイミングを制御するためのクロック12(タイマ)が備えられている。クロック12は、所定の時間毎(例えば1秒程度毎)にCPU11に対して監視プログラム14を実行させるための信号を送る。 Specifically, the process execution device 10 is configured as a microcomputer including a CPU 11, a main program 13 and a monitoring program 14 stored in a ROM, and a storage area 15 configured as a RAM. The CPU 11 is provided with a clock 12 (timer) for controlling the start timing of the program. The clock 12 sends a signal for causing the CPU 11 to execute the monitoring program 14 every predetermined time (for example, about every 1 second).
記憶領域15は、関数定義毎に演算される一次記憶値がそれぞれ格納される。また、CPU11は、記憶領域15に記憶された一次記憶値を読み出す際には、各一次記憶値のうちの最新のものを読み出し、一度読み出した値は読み出さないよう設定されている。なお、CPU11は読み出す一次記憶値を削除してもよい。 The storage area 15 stores primary storage values calculated for each function definition. Further, when reading the primary storage value stored in the storage area 15, the CPU 11 is set so as to read the latest one of the primary storage values and not read the value once read. Note that the CPU 11 may delete the primary storage value to be read.
ウォッチドック回路21は、処理実行装置10から一定時間内にエッジ信号が得られない場合に、処理実行装置10をリセットさせるリセット信号を出力する。つまり、後述する処理において、プログラムが正常に実行されていれば処理実行装置10はエッジ信号を定期的にウォッチドック回路21に送信することでウォッチドック回路21からリセット信号が出力されることを防止するが、プログラムが正常に実行されていなければ処理実行装置10はエッジ信号をウォッチドック回路21に送信しなくなり、ウォッチドック回路21からリセット信号が出力されることになる。 The watchdog circuit 21 outputs a reset signal for resetting the process execution device 10 when an edge signal cannot be obtained from the process execution device 10 within a predetermined time. That is, in the process described later, if the program is executed normally, the process execution device 10 periodically transmits an edge signal to the watchdog circuit 21 to prevent the reset signal from being output from the watchdog circuit 21. However, if the program is not executed normally, the process execution device 10 does not transmit the edge signal to the watchdog circuit 21, and a reset signal is output from the watchdog circuit 21.
メインプログラム13は、例えば、実行状況監視装置1が車両に搭載されている場合、車両の各部を制御するためのプログラム等として機能する。ここで、図2はメインプログラム13の概略構成および階層構造を示す説明図である。 For example, when the execution status monitoring device 1 is mounted on a vehicle, the main program 13 functions as a program for controlling each part of the vehicle. Here, FIG. 2 is an explanatory diagram showing a schematic configuration and a hierarchical structure of the main program 13.
メインプログラム13は、図2に示すように、最も上位の階層である階層0(ネストの深さが0)において、スタートアップルーチンに続いてメインルーチンが記述されている。図2に示すメインルーチンでは、2つの関数定義(サブルーチン)A1、A2が含まれており、これらの関数定義A1,A2についてプログラムは、1つ下位の階層である階層1として記述されている。 As shown in FIG. 2, the main program 13 describes the main routine following the start-up routine at the highest layer, layer 0 (the nesting depth is 0). The main routine shown in FIG. 2 includes two function definitions (subroutines) A1 and A2, and the program is described as layer 1 which is one layer below these function definitions A1 and A2.
また、関数定義A1内には、関数定義B1が含まれており、これらの関数定義B1についてのプログラムは、さらに1つ下位の階層である階層2として記述されている。そして、関数定義B1内には、関数定義C1,C2が含まれており、これらの関数定義C1,C2についてのプログラムは、さらに1つ下位の階層である階層3として記述されている。 In addition, the function definition A1 includes a function definition B1, and the program for the function definition B1 is described as a hierarchy 2 that is one level lower. The function definition B1 includes function definitions C1 and C2, and a program for these function definitions C1 and C2 is described as a hierarchy 3 that is one level lower.
ここで、本実施形態の各関数定義には、先頭マクロ(プログラム)および末尾マクロが、通常のプログラム(例えば車両を制御するためのプログラム)に影響を及ぼさない形態で追記されている。例えば、関数定義A1には、関数定義A1用のマクロであるA1先頭マクロおよびA1末尾マクロが追記されており、関数定義C2には、関数定義C2用のマクロであるC2先頭マクロおよびC2末尾マクロが追記されている。 Here, in each function definition of the present embodiment, a head macro (program) and a tail macro are added in a form that does not affect a normal program (for example, a program for controlling a vehicle). For example, the function definition A1 includes an A1 head macro and an A1 tail macro that are macros for the function definition A1, and the function definition C2 includes a C2 head macro and a C2 tail macro that are macros for the function definition C2. Is added.
[本実施形態の処理]
このように構成された処理実行装置10において実行される、具体的な先頭マクロの作動について、図3を用いて説明する。図3(a)はCPU11がメインプログラム13の一部として実行する先頭マクロ処理を示すフローチャート、図3(b)はCPU11がメインプログラム13の一部として実行する末尾マクロ処理を示すフローチャートである。
[Process of this embodiment]
A specific operation of the leading macro executed in the processing execution apparatus 10 configured as described above will be described with reference to FIG. FIG. 3A is a flowchart showing the leading macro process executed by the CPU 11 as a part of the main program 13, and FIG. 3B is a flowchart showing the tail macro process executed by the CPU 11 as a part of the main program 13.
なお、先頭マクロ処理および末尾マクロ処理では、フラグt、変数t1,t2を利用する。これらの値は、スタートアップルーチンにおいて、初期値として、t=ON、t1=0、t2=1、が与えられるものとする。 Note that the flag t and the variables t1 and t2 are used in the head macro process and the tail macro process. These values are given as t = ON, t1 = 0, t2 = 1 as initial values in the startup routine.
先頭マクロ処理は、各関数定義において先頭マクロが読み込まれると開始される処理である。詳細には、図3(a)に示すように、まず、フラグtの状態を判定する(S110)。 The head macro process is a process that starts when the head macro is read in each function definition. Specifically, as shown in FIG. 3A, first, the state of the flag t is determined (S110).
tがONであれば(S110:ON)、「t1+1」(第1の操作、第1新値)をt2に上書きし(S120:第1更新手段)、「t2+P」(第2の操作、操作値)を一次記憶値として記憶領域15内のスタックに記録させる(S130:操作値生成手段)。ここで、Pは関数定義固有の任意の値であって、ある関数定義iでのPの値P_iは、他の関数定義jでのPの値P_jとは異なる値となり、かつ、|1−P_i+P_j|(絶対値)が、1にならないように設定されている。 If t is ON (S110: ON), “t1 + 1” (first operation, first new value) is overwritten on t2 (S120: first update means), and “t2 + P” (second operation, operation) Value) is recorded as a primary storage value on the stack in the storage area 15 (S130: operation value generation means). Here, P is an arbitrary value specific to the function definition, and the value P_i of P in a certain function definition i is different from the value P_j of P in another function definition j, and | 1− P_i + P_j | (absolute value) is set so as not to be 1.
この処理が終了すると後述するS160の処理に移行する。また、S110の処理にて、フラグtがOFFであれば(S110:OFF)、「t2+1」(第1の操作、第1新値)をt1に上書きし(S140:第1更新手段)、「t1+P」(第2の操作、操作値)を一次記憶値として記憶領域15内のスタックに記録させる(S150:操作値生成手段)。そして、フラグtの状態を反転させて(つまり、tがONであればOFFにし、tがOFFであればONにして)(S160)、先頭マクロ処理を終了する。 When this process ends, the process proceeds to S160 described later. If the flag t is OFF in the processing of S110 (S110: OFF), “t2 + 1” (first operation, first new value) is overwritten on t1 (S140: first updating means), and “ “t1 + P” (second operation, operation value) is recorded as a primary storage value on the stack in the storage area 15 (S150: operation value generation means). Then, the state of the flag t is reversed (that is, if t is ON, it is turned OFF, and if t is OFF, it is turned ON) (S160), and the head macro process is terminated.
次に、末尾マクロ処理は、各関数定義において末尾マクロが読み込まれると開始される処理であり、詳細には、図3(b)に示すように、まず、一次記憶値のうちの最新のもの(pop)をtempとして読み出す(S210)。そして、フラグtの状態を判定する(S220)。 Next, the tail macro processing is processing that is started when the tail macro is read in each function definition. Specifically, as shown in FIG. (Pop) is read as temp (S210). Then, the state of the flag t is determined (S220).
tがOFFであれば(S220:OFF)、「temp−1−P」(第2新値)をt1に上書きし(S230:第2更新手段)、後述するS250の処理に移行する。また、tがONであれば(S220:ON)、「temp−1−P」(第2新値)をt2に上書きし(S240:第2更新手段)、フラグtの状態を反転させて(S250)、末尾マクロ処理を終了する。 If t is OFF (S220: OFF), “temp-1-P” (second new value) is overwritten on t1 (S230: second updating means), and the process proceeds to S250 described later. If t is ON (S220: ON), “temp-1-P” (second new value) is overwritten on t2 (S240: second updating means), and the state of flag t is reversed ( S250), the tail macro process is terminated.
つまり、S230、S240の処理では、読み出した一次記憶値に対して第1の操作(1を加算する処理)および第2の操作(Pを加算する処理)を相殺する操作を行う。なお、先頭マクロ処理および末尾マクロ処理のうちのt1、t2を更新する処理(S120,S140,S230,S240)では、割込タスクからの影響を避けるため、1命令で済むようプログラムの記載が考慮されている。 That is, in the processes of S230 and S240, an operation for canceling the first operation (a process for adding 1) and the second operation (a process for adding P) is performed on the read primary storage value. In the process of updating t1 and t2 (S120, S140, S230, S240) of the head macro process and the tail macro process, the description of the program is considered so that only one instruction is required to avoid the influence from the interrupt task. Has been.
次に、プログラムが正常に実行されているか否かを評価する処理について図4を用いて説明する。図4はCPU11が監視プログラム14として実行する評価処理を示すフローチャートである。評価処理は、クロック12から当該処理を起動する旨の信号を受けると開始される。 Next, processing for evaluating whether or not the program is executed normally will be described with reference to FIG. FIG. 4 is a flowchart showing an evaluation process executed by the CPU 11 as the monitoring program 14. The evaluation process is started when a signal to start the process is received from the clock 12.
評価処理では、図4に示すように、まず、|t1−t2|(絶対値)が1であるか否かを判定する(S310:対応関係判定出力手段)。|t1−t2|が1であれば(S310:YES)、ウォッチドック回路21に対してエッジ信号を出力し(S320:対応関係判定出力手段)、評価処理を終了する。また、|t1−t2|が1でなければ(S310:NO)、エッジ信号を出力することなく評価処理を終了する。 In the evaluation process, as shown in FIG. 4, first, it is determined whether or not | t1-t2 | (absolute value) is 1 (S310: correspondence determination output means). If | t1-t2 | is 1 (S310: YES), an edge signal is output to the watchdog circuit 21 (S320: correspondence determination output means), and the evaluation process ends. If | t1-t2 | is not 1 (S310: NO), the evaluation process is terminated without outputting an edge signal.
図2に示すプログラム構成において、上記先頭マクロ処理および末尾マクロ処理を実行した場合において、記憶領域15内の各値の遷移状態を、図5を用いて説明する。図5は正常時において記憶領域15内の各値の遷移状態を示す説明図である。 In the program configuration shown in FIG. 2, the transition state of each value in the storage area 15 when the top macro process and the end macro process are executed will be described with reference to FIG. FIG. 5 is an explanatory diagram showing the transition state of each value in the storage area 15 at the normal time.
前述のように、スタートアップルーチン実施直後においては、フラグtがON、t1=1、t2=1に設定されている。
メインルーチンが開始され、A1先頭マクロが実行されると、フラグtがOFFになり、記憶領域15のA1スタックに「1+P_A1」が記録される。このとき、t2は1のままとなる。
As described above, immediately after the start-up routine is executed, the flag t is set to ON, t1 = 1, and t2 = 1.
When the main routine is started and the A1 head macro is executed, the flag t is turned OFF, and “1 + P_A1” is recorded in the A1 stack of the storage area 15. At this time, t2 remains at 1.
続いて、B1先頭マクロが実行されると、t1=2となり、フラグtがONになる。そして、記憶領域15のB1スタックに「2+P_B1」が記録される。次に、C1先頭マクロが実行されると、t2=3となり、フラグtがOFFになる。そして、記憶領域15のC1スタックに「3+P_C1」が記録される。 Subsequently, when the B1 head macro is executed, t1 = 2 and the flag t is turned ON. Then, “2 + P_B1” is recorded in the B1 stack of the storage area 15. Next, when the C1 head macro is executed, t2 = 3 and the flag t is turned OFF. Then, “3 + P_C1” is recorded in the C1 stack of the storage area 15.
続いて、C1末尾マクロが実行されると、t1=(3+P_C1)−1−P_C1=2となり、フラグtがONになる。また、C2先頭マクロが実行されると、フラグtがOFFになり、記憶領域15のC2スタックに「3+P_C2」が記録される。 Subsequently, when the C1 end macro is executed, t1 = (3 + P_C1) -1-P_C1 = 2 and the flag t is turned ON. When the C2 head macro is executed, the flag t is turned OFF, and “3 + P_C2” is recorded in the C2 stack of the storage area 15.
そして、C2末尾マクロが実行されると、t1=(3+P_C2)−1−P_C2=2となり、フラグtがONになる。続いて、B1末尾マクロが実行されると、t2=(2+P_B1)−1−P_B1=1となり、フラグtがOFFになる。 When the C2 end macro is executed, t1 = (3 + P_C2) -1-P_C2 = 2 and the flag t is turned ON. Subsequently, when the B1 tail macro is executed, t2 = (2 + P_B1) -1-P_B1 = 1 and the flag t is turned OFF.
また、A1末尾マクロが実行されると、t1=(1+P_A1)−1−P_A1=0となり、フラグtがONになる。続いて、A2先頭マクロが実行されるとフラグtがOFFになり、記憶領域15のA1スタックに「1+P_A2」が記録される。また、A1末尾マクロが実行されると、フラグtがONになる。なお、t1=(1+P_A2)−1−P_A2=0となり、t1の値は変化しない。 When the A1 tail macro is executed, t1 = (1 + P_A1) -1-P_A1 = 0 and the flag t is turned ON. Subsequently, when the A2 head macro is executed, the flag t is turned OFF, and “1 + P_A2” is recorded in the A1 stack of the storage area 15. When the A1 tail macro is executed, the flag t is turned ON. Note that t1 = (1 + P_A2) -1-P_A2 = 0, and the value of t1 does not change.
このように、正常な順序でプログラムが実行されている場合には、|t1−t2|(絶対値)が常に1となり、評価処理にてエッジ信号が出力される状態となる。
次に、図6は異常時において記憶領域15内の各値の遷移状態を示す説明図である。図6では、関数定義C2の実行後、B1末尾マクロ実行前に、誤ってC1末尾マクロが実行されたものとして説明する。
In this way, when the program is executed in a normal order, | t1-t2 | (absolute value) is always 1, and an edge signal is output in the evaluation process.
Next, FIG. 6 is an explanatory diagram showing a transition state of each value in the storage area 15 at the time of abnormality. In FIG. 6, it is assumed that the C1 end macro is erroneously executed after the function definition C2 is executed and before the B1 end macro is executed.
図6に示すように、図5と同様に、C2末尾マクロが終了するまでは、|t1−t2|(絶対値)が常に1となっている。しかし、C2末尾マクロの次にC1末尾マクロが実行されると、t2=(2+P_B1)−1−P_C1=1+P_B1−P_C1、となり、前述の条件より、|1−P_B1+P_C1|が1でないので、|t1−t2|が1でなくなる。よって、評価処理にてエッジ信号が出力されない状態となる。 As shown in FIG. 6, as in FIG. 5, | t1-t2 | (absolute value) is always 1 until the end of the C2 macro. However, when the C1 end macro is executed next to the C2 end macro, t2 = (2 + P_B1) -1-P_C1 = 1 + P_B1-P_C1, and | 1-P_B1 + P_C1 | is not 1 because of the above condition. -T2 | is not 1. Therefore, an edge signal is not output in the evaluation process.
[本実施形態による効果]
以上のように詳述した実行状況監視装置1において、処理実行装置10のCPU11は、メインプログラム13の一部の処理として、予め第1の記録領域に記録された第1の値および予め第2の記録領域に記録された第2の値のうちの直近の時刻に更新された値との対応関係が所定条件を満たすための第1の操作を行うことで求められる値である第1新値に、第1の値および第2の値のうちの直近の時刻に更新されていない値を更新し、第1新値に対して第2の操作を行うことで得られる操作値を生成する。そして、正常な順序でこのメインプログラム13が実施される場合にCPU11による処理の後でCPU11が更新していない第1の値または第2の値を更新する処理であって、操作値に対して第1の操作および第2の操作を相殺する操作を行うことで求められる値である第2新値に、第1の値および第2の値のうちの直近の時刻に更新されていない値を更新する。さらに、CPU11は、メインプログラム13とは別の監視プログラム14において、第1の値と第2の値との対応関係が所定の関係になっているか否かを繰り返し判定し、この判定結果に応じた出力を行う。
[Effects of this embodiment]
In the execution status monitoring device 1 described in detail above, the CPU 11 of the process execution device 10 performs the first value recorded in the first recording area and the second value in advance as a part of the processing of the main program 13. The first new value that is a value obtained by performing the first operation for the correspondence relationship with the value updated at the most recent time among the second values recorded in the recording area to satisfy the predetermined condition In addition, the value that has not been updated at the most recent time among the first value and the second value is updated, and an operation value obtained by performing the second operation on the first new value is generated. Then, when the main program 13 is executed in a normal order, the CPU 11 updates the first value or the second value that has not been updated after the processing by the CPU 11. A value that is not updated at the most recent time of the first value and the second value is added to the second new value that is a value obtained by performing an operation that cancels the first operation and the second operation. Update. Further, the CPU 11 repeatedly determines whether or not the correspondence relationship between the first value and the second value is a predetermined relationship in a monitoring program 14 different from the main program 13, and according to the determination result. Output.
このような処理実行装置10によれば、第1の数値と第2の数値との関係を監視することでプログラムの実行状況を判定することができる。また、この判定の際には、第1の値、第2の値、および操作値を記録する記録領域を備えておけばよいので、実行された命令等を記録した表を準備する構成と比較して、少ない記録領域でプログラムが正常に実行されているか否かを監視することができる。 According to such a processing execution device 10, the execution status of the program can be determined by monitoring the relationship between the first numerical value and the second numerical value. Further, in this determination, since it is sufficient to provide a recording area for recording the first value, the second value, and the operation value, it is compared with a configuration in which a table in which executed instructions are recorded is prepared. Thus, it is possible to monitor whether the program is normally executed with a small recording area.
また、処理実行装置10においてCPU11は、メインプログラム13における各関数定義において、関数定義の前半部分において第1新値を演算し、関数定義の後半部分において第2新値を演算する。特に、CPU11は、第1新値に対して各関数定義特有の第2の操作を行うことで操作値を生成し、既に読み出された操作値を除く操作値のうちの最新のものを読み出し、該操作値に対して、この関数定義特有の第2の操作および第1の操作を相殺する操作を行うことで第2新値を演算する。 In the process execution device 10, the CPU 11 calculates the first new value in the first half of the function definition and the second new value in the second half of the function definition in each function definition in the main program 13. In particular, the CPU 11 generates an operation value by performing a second operation specific to each function definition with respect to the first new value, and reads the latest one of the operation values excluding the already read operation value. The second new value is calculated by performing an operation that cancels the second operation and the first operation specific to the function definition with respect to the operation value.
このような処理実行装置10によれば、関数定義毎に異なる操作値を生成し、関数定義毎に異なる第2の操作を相殺する操作を行うので、プログラムの実行順序に誤りが生じると、第2の操作を相殺することができなくなる。この結果、プログラムの実行順序に誤りが生じると、第1の値と第2の値との対応関係が変化する可能性が高くなるため、関数定義内のプログラムが正常に作動したか否かを確認することができる。 According to such a processing execution device 10, a different operation value is generated for each function definition, and an operation that cancels the second operation that is different for each function definition is performed. The operation of 2 cannot be canceled. As a result, if an error occurs in the execution order of the program, the correspondence between the first value and the second value is likely to change, so whether or not the program in the function definition has been operated normally. Can be confirmed.
また、処理実行装置10においてCPU11は、第1の値と第2の値との対応関係が所定の関係になっていない場合の出力として、メインプログラム13を実行する処理をリセットさせる信号を出力する。 In the process execution device 10, the CPU 11 outputs a signal for resetting the process for executing the main program 13 as an output when the correspondence between the first value and the second value is not a predetermined relationship. .
このような処理実行装置10によれば、第1の値と第2の値との対応関係が所定の関係になっていない状態、つまり、プログラム実行状況に異常がある場合に、メインプログラム13を実行する処理をリセットさせることができる。 According to such a processing execution device 10, when the correspondence between the first value and the second value is not a predetermined relationship, that is, when the program execution status is abnormal, the main program 13 is The process to be executed can be reset.
[その他の実施形態]
本発明の実施の形態は、上記の実施形態に何ら限定されることはなく、本発明の技術的範囲に属する限り種々の形態を採りうる。
[Other Embodiments]
Embodiments of the present invention are not limited to the above-described embodiments, and can take various forms as long as they belong to the technical scope of the present invention.
例えば、上記実施形態においては、第1の操作としてt1またはt2に「1」を加算し、第2の操作としてt1またはt2に「P」を加算したが、任意の値を加減算、或いは乗除算等の任意の演算をするようにしてもよい。また、第1の値と第2の値との対応関係を検査する際には、評価処理にて、これら任意の演算に対応した対応関係になっているか否かを検査すればよい。 For example, in the above-described embodiment, “1” is added to t1 or t2 as the first operation, and “P” is added to t1 or t2 as the second operation. Arbitrary calculations such as these may be performed. Further, when checking the correspondence relationship between the first value and the second value, it is only necessary to check whether or not the correspondence relationship corresponds to these arbitrary calculations in the evaluation process.
例えば、第1の操作としてt1またはt2に「2」を乗じる場合、評価処理では、t1がt2の2倍または0.5倍になっているか否かを検査すればよい。 For example, when t1 or t2 is multiplied by “2” as the first operation, the evaluation process may check whether t1 is twice or 0.5 times t2.
1…実行状況監視装置、10…処理実行装置、11…CPU、12…クロック、13…メインプログラム、14…監視プログラム、15…記憶領域、21…ウォッチドック回路。 DESCRIPTION OF SYMBOLS 1 ... Execution condition monitoring apparatus, 10 ... Processing execution apparatus, 11 ... CPU, 12 ... Clock, 13 ... Main program, 14 ... Monitoring program, 15 ... Storage area, 21 ... Watch dock circuit.
Claims (5)
前記監視対象プログラムの一部の処理として、予め第1の記録領域に記録された第1の値および予め第2の記録領域に記録された第2の値のうちの直近の時刻に更新された値との対応関係が所定条件を満たすための第1の操作を行うことで求められる値である第1新値に、前記第1の値および前記第2の値のうちの直近の時刻に更新されていない値を更新する第1更新手段と、
前記監視対象プログラムの一部の処理として、前記第1新値に対して第2の操作を行うことで得られる操作値を生成する操作値生成手段と、
前記監視対象プログラムの一部の処理として、正常な順序で当該監視対象プログラムが実施される場合に前記第1更新手段による処理の後で前記第1更新手段が更新していない第1の値または第2の値を更新する処理であって、前記操作値に対して前記第1の操作および前記第2の操作を相殺する操作を行うことで求められる値である第2新値に、前記第1の値および前記第2の値のうちの直近の時刻に更新されていない値を更新する第2更新手段と、
前記監視対象プログラムとは別の処理として、前記第1の値と前記第2の値との対応関係が所定の関係になっているか否かを繰り返し判定し、該判定結果に応じた出力を行う対応関係判定出力手段と、
を備えたことを特徴とするプログラム実行状況監視装置。 A program execution status monitoring device for monitoring whether a monitoring target program executed in a computer is normally executed,
As part of the process of the monitoring target program, it is updated at the latest time of the first value recorded in the first recording area and the second value recorded in the second recording area in advance. The first new value, which is a value obtained by performing the first operation for the correspondence relationship with the value to satisfy the predetermined condition, is updated at the most recent time of the first value and the second value. First updating means for updating a value that has not been performed;
An operation value generating means for generating an operation value obtained by performing a second operation on the first new value as part of the process of the monitoring target program;
As a part of the processing of the monitoring target program, when the monitoring target program is executed in a normal order, the first value or the first value not updated by the first updating unit after the processing by the first updating unit or A process of updating a second value, wherein the second new value, which is a value obtained by performing an operation that cancels the first operation and the second operation with respect to the operation value, A second updating means for updating a value not updated at the latest time among the value of 1 and the second value;
As a process different from the monitoring target program, it is repeatedly determined whether or not the correspondence relationship between the first value and the second value is a predetermined relationship, and an output corresponding to the determination result is performed. Correspondence determination output means;
A program execution status monitoring apparatus comprising:
前記第1更新手段、前記操作値生成手段、および前記第2更新手段は、これらを1組として複数組備えられており、
前記操作値生成手段は、前記第1新値に対して当該第1更新手段が属する組特有の第2の操作を行うことで操作値を生成し、
前記第2更新手段は、既に読み出された操作値を除く操作値のうちの最新のものを読み出し、該操作値に対して、当該第2更新手段が属する組の操作値生成手段が行った第2の操作および前記第1の操作を相殺する操作を行うことで前記第2新値を演算すること
を特徴とするプログラム実行状況監視装置。 In the program execution status monitoring device according to claim 1,
The first updating unit, the operation value generating unit, and the second updating unit are provided as a plurality of sets, and
The operation value generation means generates an operation value by performing a second operation specific to the set to which the first update means belongs to the first new value,
The second update unit reads the latest one of the operation values excluding the operation value that has already been read, and the operation value generation unit to which the second update unit belongs is performed on the operation value. The program execution status monitoring apparatus, wherein the second new value is calculated by performing a second operation and an operation that cancels the first operation.
前記第1更新手段は、前記監視対象プログラムにおける関数定義の前半部分において前記第1新値を演算し、
前記第2更新手段は、前記第1更新手段が第1新値を演算する関数定義の後半部分において前記第2新値を演算すること
を特徴とするプログラム実行状況監視装置。 In the program execution status monitoring apparatus according to claim 1 or 2,
The first update means calculates the first new value in the first half of the function definition in the monitoring target program,
The program execution status monitoring apparatus, wherein the second update means calculates the second new value in a second half of a function definition in which the first update means calculates a first new value.
前記対応関係判定出力手段は、前記第1の値と前記第2の値との対応関係が所定の関係になっていない場合の出力として、前記監視対象プログラムを実行する処理をリセットさせる信号を出力すること
を特徴とするプログラム実行状況監視装置。 In the program execution status monitoring apparatus according to claim 1 or 2,
The correspondence determination output means outputs a signal for resetting the process of executing the monitoring target program as an output when the correspondence between the first value and the second value is not a predetermined relationship. A program execution status monitoring device characterized by:
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2011058289A JP5541201B2 (en) | 2011-03-16 | 2011-03-16 | Program execution status monitoring apparatus and execution status monitoring program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2011058289A JP5541201B2 (en) | 2011-03-16 | 2011-03-16 | Program execution status monitoring apparatus and execution status monitoring program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2012194786A JP2012194786A (en) | 2012-10-11 |
| JP5541201B2 true JP5541201B2 (en) | 2014-07-09 |
Family
ID=47086618
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2011058289A Expired - Fee Related JP5541201B2 (en) | 2011-03-16 | 2011-03-16 | Program execution status monitoring apparatus and execution status monitoring program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5541201B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2017162135A (en) * | 2016-03-09 | 2017-09-14 | 三菱電機株式会社 | Information processing device, debug system, and stack overflow detection method |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH05189255A (en) * | 1992-01-14 | 1993-07-30 | Matsushita Electric Ind Co Ltd | Program runaway detection method |
| JP4983142B2 (en) * | 2006-08-09 | 2012-07-25 | 富士通株式会社 | Program monitoring method, computer, and abnormality monitoring program |
-
2011
- 2011-03-16 JP JP2011058289A patent/JP5541201B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2012194786A (en) | 2012-10-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP6692763B2 (en) | Control device and control program updating method | |
| JP6011162B2 (en) | Electronic control unit | |
| JP2014099097A (en) | Information processing device, information processing method, and computer program | |
| US9772905B2 (en) | Updating control firmware of information processing apparatus, method of controlling the same, and storage medium | |
| JP5541201B2 (en) | Program execution status monitoring apparatus and execution status monitoring program | |
| US9778981B2 (en) | Microcontroller | |
| JP2015185123A (en) | Electronic control unit | |
| US10108244B2 (en) | Electronic apparatus and non-transitory computer readable medium for power consumption control of processors | |
| JP2011008702A (en) | Fault processor | |
| JP2016081341A (en) | Electronic control device | |
| JP5012548B2 (en) | Programmable controller | |
| JP5518021B2 (en) | Information processing device | |
| JP2012174198A (en) | Abnormality detection device and abnormality detection program | |
| JP6183251B2 (en) | Electronic control unit | |
| JP2016134082A (en) | Microcomputer | |
| JP5590667B2 (en) | Subroutine execution monitoring apparatus and subroutine execution monitoring method | |
| JP6229552B2 (en) | Control device and initialization program | |
| JP5561241B2 (en) | Microcomputer | |
| JP2012173919A (en) | Information processor, electronic control unit for vehicle, and data storage method | |
| JP6624005B2 (en) | Mutual monitoring system | |
| JP2016143103A (en) | Control device | |
| JP2021172142A (en) | Abnormality detection device | |
| US20180373582A1 (en) | Data access device and access error notification method | |
| JP2010018150A (en) | Electronic control device | |
| JP7091853B2 (en) | Electronic control device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20130726 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20140319 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20140408 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20140421 |
|
| R151 | Written notification of patent or utility model registration |
Ref document number: 5541201 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| LAPS | Cancellation because of no payment of annual fees |