JPH01214934A - System for detecting indirect recursive calling of program - Google Patents
System for detecting indirect recursive calling of programInfo
- Publication number
- JPH01214934A JPH01214934A JP4174488A JP4174488A JPH01214934A JP H01214934 A JPH01214934 A JP H01214934A JP 4174488 A JP4174488 A JP 4174488A JP 4174488 A JP4174488 A JP 4174488A JP H01214934 A JPH01214934 A JP H01214934A
- Authority
- JP
- Japan
- Prior art keywords
- program
- return address
- address
- area
- save area
- 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.)
- Pending
Links
- 238000001514 detection method Methods 0.000 claims abstract description 13
- 238000000034 method Methods 0.000 claims description 7
- 238000011423 initialization method Methods 0.000 claims 1
- 239000000470 constituent Substances 0.000 abstract description 8
- 230000002159 abnormal effect Effects 0.000 abstract description 2
- 238000003745 diagnosis Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
Landscapes
- Executing Machine-Instructions (AREA)
Abstract
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明はプログラムの間接再帰呼出し検出方式に関し、
特にプログラムの再帰呼出しが禁止されているデータ処
理システムにおけるプログラムの間接再帰呼出し検出方
式に関する。[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to a method for detecting indirect recursive calls of programs;
In particular, the present invention relates to a method for detecting indirect recursive calls to programs in data processing systems in which recursive calls to programs are prohibited.
従来、プログラムの再帰呼出しが禁止されているデータ
処理システムにおいてプログラムの再帰呼出しの検出を
行うプログラムの再帰呼出し検出方式は、プログラムの
翻訳時にプログラムの直接再帰呼出しく特定のプログラ
ム内で行われる当該特定のプログラムの呼出し)を検出
しエラー診断(プログラムの構造にエラーがあることを
プログラム作成者等に通知しプログラムの修正を促すこ
と)を行うだけであった。Conventionally, program recursive call detection methods detect program recursive calls in data processing systems where program recursive calls are prohibited. The only thing that needed to be done was to detect errors (calls to programs) and perform error diagnosis (notify the program creator that there is an error in the structure of the program and prompt them to modify the program).
プログラムの間接再帰呼出しく特定のプログラムにより
呼び出された他のプログラム内で行われる当該特定のプ
ログラムの呼出し)については、あるプログラムの翻訳
時には他のプログラムの状態が分からないために上述の
プログラムの再帰呼出し検出方式では検出することがで
きなかった(翻訳されたプログラムが実行可能プログラ
ムの1つの構成ルーチンとして実行される際にもプログ
ラムの間接再帰呼出しを検出して対処することはできな
かった)。Regarding indirect recursive calls of programs (calls of a specific program within another program called by a specific program), since the state of other programs is not known at the time of compiling a program, the recursion of the program described above is Call detection methods were unable to detect this (even when the translated program was executed as one of the constituent routines of an executable program, it was not possible to detect and deal with indirect recursive calls to the program).
上述した従来のプログラムの再帰呼出し検出方式では、
プログラムの翻訳時にプログラムの直接再帰呼出しを検
出してエラー診断を行うだけで、プログラムの間接再帰
呼出しの検出については翻訳時および実行時を通じて行
うことができないので、プログラム作成者が誤って間接
再帰呼出しを行うプログラムを作成した場合にはそのプ
ログラムを構成ルーチンとする実行可能プログラムの実
行時に無限ループに陥ってしまうという欠点がある。In the conventional program recursive call detection method described above,
Error diagnosis is only performed by detecting direct recursive calls to a program when compiling a program, but indirect recursive calls to a program cannot be detected at the time of translation or execution. If you create a program that performs this, there is a drawback that an infinite loop will occur when an executable program that uses the program as a constituent routine is executed.
本発明の目的は、上述の点に鑑み、間接再帰呼出しを行
うプログラムの実行時にその間接再帰呼出しを検出し、
間接再帰呼出しを行うそのプログラムを構成ルーチンと
する実行可能プログラムの実行時に無限ループに陥るこ
とを防止するプログラムの再帰呼出し検出方式(プログ
ラムの間接再帰呼出し検出方式)を提供することにある
。In view of the above-mentioned points, an object of the present invention is to detect indirect recursive calls when executing a program that makes indirect recursive calls,
To provide a recursive call detection method for a program (indirect recursive call detection method for a program) that prevents falling into an infinite loop when executing an executable program whose constituent routine is a program that makes an indirect recursive call.
本発明のプログラムの間接再帰呼出し検出方式は、プロ
グラムの再帰呼出しが禁止されておりプログラム割込み
命令を有するデータ処理システムにおいて、メモリへの
プログラムのロード時にこのプログラム内の戻りアドレ
ス退避領域を上値で初期化する上値初期化手段と、プロ
グラム入口点において前記戻りアドレス退避領域の内容
が上値であるか否かを識別する前記プログラム内の上値
識別手段と、この上値識別手段によ乞識別で前記戻りア
ドレス退避領域の内容が上値ではない場合にプログラム
割込み命令を実行して前記プログラムを異常終了させる
前記プログラム内の割込み命令実行手段と、前記上値識
別手段による識別で前記戻りアドレス退避領域の内容が
上値である場合に呼出し側プログラムから渡された呼出
し側プログラムへの戻りアドレスを前記戻りアドレス退
避領域に格納する前記プログラム内の戻りアドレス格納
手段と、前記プログラムにおける所定の処理の実行後に
前記戻りアドレス退避領域の内容を前記プログラム内の
一時アドレス退避領域に複写する前記プログラム内のア
ドレス領域複写手段と、このアドレス領域複写手段によ
る複写処理で前記戻りアドレス退避領域の内容を前記一
時アドレス退避領域に格納した後に前記戻りアドレス退
避領域に上値を設定する前記プログラム内の上値設定手
段と、前記一時アドレス退M領域に格納されている呼出
し側プログラム中の戻りアドレスへの分岐を行う前記プ
ログラム内の戻りアドレス分岐手段とを有する。The indirect program indirect recursive call detection method of the present invention, in a data processing system in which recursive program calls are prohibited and has a program interrupt instruction, initializes the return address save area in the program with an upper value when the program is loaded into memory. an upper price initializing means for initializing the upper value; an upper value identifying means within the program for identifying whether the contents of the return address save area are an upper value at a program entry point; Interrupt instruction execution means in the program that executes a program interrupt instruction to abnormally terminate the program when the contents of the save area are not at the upper value, and identification by the upper value identification means that the contents of the return address save area are at the upper value. return address storage means within the program for storing a return address to the calling program passed from the calling program in the return address save area in a certain case; and the return address save area after execution of a predetermined process in the program. address area copying means in the program for copying the contents of the return address to the temporary address saving area in the program; Upper value setting means in the program that sets an upper value in the return address save area; and return address branching means in the program that branches to a return address in the calling program stored in the temporary address save M area. and has.
本発明のプログラムの間接再帰呼出し検出方式では、上
値初期化手段がメモリへのプログラムのロード時にプロ
グラム内の戻りアドレス退避領域を上値で初期化し、プ
ログラム内の上値識別手段がプログラム入口点において
戻りアドレス退避領域の内容が上値であるか否かを識別
し、プログラム内の割込み命令実行手段が上値識別手段
による識別で戻りアドレス退避領域の内容が上値ではな
い場合にプログラム割込み命令を実行してプログラムを
異常終了させ、プログラム内の戻りアドレス格納手段が
上値識別手段による識別で戻りアドレス退避領域の内容
が上値である場合に呼出し側プログラムから渡された呼
出し側プログラムへの戻りアドレスを戻りアドレス退避
領域に格納し、プログラム内のアドレス領域複写手段が
プログラムにおける所定の処理の実行後に戻りアドレス
退避領域の内容をプログラム内の一時アドレス退避領域
に複写し、プログラム内の上値設定手段がアドレス領域
複写手段による複写処理で戻りアドレス退避領域の内容
を一時アドレス退避領域に格納した後に戻りアドレス退
避領域に上値を設定し、プログラム内の戻りアドレス分
岐手段が一時アドレス退避領域に格納されている呼出し
側プログラム中の戻りアドレスへの分岐を行う。In the program indirect recursive call detection method of the present invention, the upper value initializing means initializes the return address save area in the program with the upper value when the program is loaded into the memory, and the upper value identifying means in the program detects the return address at the program entry point. The interrupt instruction execution means in the program identifies whether the contents of the save area are the upper value or not, and executes the program interrupt instruction when the contents of the return address save area are not the upper value as identified by the upper value identifying means. When the return address storage means in the program terminates abnormally and the contents of the return address save area are the upper value as identified by the upper value identification means, the return address passed from the calling program to the calling program is stored in the return address save area. The address area copying means in the program copies the contents of the return address save area to the temporary address save area in the program after executing a predetermined process in the program, and the upper value setting means in the program copies the contents by the address area copying means. After the contents of the return address save area are stored in the temporary address save area during processing, the upper value is set in the return address save area, and the return address branching means in the program executes a return in the calling program that is stored in the temporary address save area. Branch to address.
次に、本発明について図面を参照して説明する。 Next, the present invention will be explained with reference to the drawings.
第1図は、本発明のプログラムの間接再帰呼出し検出方
式の一実施例の構成を示すブロック図である。本実施例
のプログラムの間接再帰呼出し検出方式は、戻りアドレ
ス1と、上値識別手段2と、戻りアドレス格納手段3と
、割込み命令実行手段4と、プログラム処理手段5と、
アドレス領域複写手段6と、上値設定手段7と、戻りア
ドレス分岐手段8と、戻りアドレス退避領域9と、一時
アドレス退避領域10と、プログラム入口点11と、プ
ログラム終了点12と、上値初期化手段13とを含んで
構成されている。FIG. 1 is a block diagram showing the structure of an embodiment of the method for detecting indirect recursive calls of programs according to the present invention. The program indirect recursive call detection method of this embodiment includes a return address 1, an upper value identification means 2, a return address storage means 3, an interrupt instruction execution means 4, a program processing means 5,
Address area copying means 6, upper value setting means 7, return address branching means 8, return address saving area 9, temporary address saving area 10, program entry point 11, program end point 12, upper value initializing means 13.
第1図中の2〜12の符号で示される構成要素は、翻訳
処理および連係編集処理を経て生成された実行可能プロ
グラム(図示せず)の構成ルーチンの1つであるプログ
ラム100に含まれている(プログラム100の翻訳時
に生成される)。Components indicated by numerals 2 to 12 in FIG. 1 are included in a program 100 that is one of the configuration routines of an executable program (not shown) generated through translation processing and linked editing processing. (generated when the program 100 is translated).
次に、このように構成された本実施例のプログラムの間
接再帰呼出し検出方式の動作について説明する。Next, the operation of the indirect recursive call detection method of the program of this embodiment configured as described above will be explained.
本実施例のプログラムの間接再帰呼出し検出方式が適用
されるデータ処理システムにおけるプログラム100の
メモリ (図示せず)へのロード時には、戻りアドレス
退避領域9が上値(いずれのアドレ、スも指示しない値
。例えば、NULL値)となるようにO3(Opera
ting System、図示せず)等で実現される
上値初期化手段13によって初期化される。When the program 100 is loaded into a memory (not shown) in a data processing system to which the program indirect recursive call detection method of this embodiment is applied, the return address save area 9 is set to an upper value (a value that does not indicate any address or address). For example, O3 (Opera
ting System (not shown) or the like.
このようにしてメモリにロードされたプログラム100
の呼出し側プログラム(図示せず。実行可能プログラム
を構成する他のプログラムやO3)からの呼出しは、戻
りアドレス1 (プログラム100の所定の処理が終了
したときに復帰する呼出し側プログラム中のアドレス)
を伴−たプログラム入口点11の呼出しにより行われる
。Program 100 loaded into memory in this way
A call from a calling program (not shown; other programs constituting the executable program or O3) returns at return address 1 (address in the calling program that returns when the specified processing of the program 100 is completed).
This is done by calling the program entry point 11 with the .
プログラム入口点11においては、上値識別手段2が起
動される。At the program entry point 11, the upper price identification means 2 is activated.
上値識別手段2では、戻りアドレス退避領域9の内容が
上値であるか否かが識別される。The upper price identification means 2 identifies whether the contents of the return address save area 9 are the upper price.
この識別で戻りアドレス退避領域9の内容が上値である
場合には、戻りアドレス格納手段3が起動される。If the content of the return address save area 9 is an upper value in this identification, the return address storage means 3 is activated.
戻りアドレス格納手段3では、プログラム入口点工1が
呼び出されたと−きに渡された戻りアドレス1が戻りア
ドレス退避領域9に格納される。In the return address storage means 3, the return address 1 passed when the program entry pointer 1 is called is stored in the return address save area 9.
次に、プログラム処理手段5に制御が渡され、所定の処
理が実行され、その実行後にアドレス領域複写手段6が
起動される。Next, control is passed to the program processing means 5, a predetermined process is executed, and after the execution, the address area copying means 6 is activated.
アドレス領域複写手段6では、戻りアドレス退避領域9
の内容が一時アドレス退避領域1oに複写されて格納さ
れる。In the address area copying means 6, the return address saving area 9
The contents are copied and stored in the temporary address save area 1o.
次に、上値設定手段7が起動され、戻りアドレス退避領
域9に上値が設定される。Next, the upper value setting means 7 is activated, and the upper value is set in the return address save area 9.
さらに、戻りアドレス分岐手段8が起動され、一時アド
レス退避領域10に格納されている戻りアドレス1が取
り出され、呼出し側プログラム中の戻りアドレスlへの
分岐(復帰)が行ゎる。Further, the return address branching means 8 is activated, the return address 1 stored in the temporary address save area 10 is taken out, and a branch (return) to the return address l in the calling program is performed.
上値識別手段2における戻りアドレス退避領域9の内容
が上値であるが否かの識別において戻りアドレス退避領
域9の内容が上値ではない場合(プログラム処理手段5
における所定の処理が終了して上値設定手段7により上
値の設定が行われる前にプログラム処理手段5による他
のプログラムの呼出しを介して当該他のプログラムから
再びプログラム100の呼出しく間接再帰呼出し)が行
われたために戻りアドレス退避領域9の内容が上値では
ない状態となっている。なお、直接再帰呼出しについて
はプログラム100の翻訳時にエラー診断が行われてい
るので、発生する再帰呼出しは間接再帰呼出しのみであ
る)には、プログラム100の間接再帰呼出しが行われ
たものと判定され、割込み命令実行手段4が起動される
。When the contents of the return address save area 9 are not an upper price in identifying whether the contents of the return address save area 9 are an upper price in the upper price identifying means 2 (the program processing means 5
After the predetermined processing in , before the upper price setting means 7 sets the upper price, the program 100 is called again from the other program via the program processing means 5 (indirect recursive call). Because of this, the contents of the return address save area 9 are not at the upper value. Note that error diagnosis is performed for direct recursive calls when the program 100 is translated, so the only recursive calls that occur are indirect recursive calls). , the interrupt instruction execution means 4 is activated.
割込み命令実行手段4では、プログラム終了点12に制
御が移されてプログラム100め異常終了(この異常終
了により、プログラム100や呼出し側プログラム(O
3を除く)を構成ルーチンとする実行可能プログラム全
体の実行が終了する)が行われる。これにより、プログ
ラム100を構成ルーチンとする実行可能プログラムが
無限ループに陥ることが回避される。In the interrupt instruction execution means 4, control is transferred to the program end point 12, and the program 100 ends abnormally (this abnormal end causes the program 100 and the calling program (O
Execution of the entire executable program whose constituent routines are 3) is completed. This prevents the executable program whose constituent routine is program 100 from falling into an infinite loop.
以上説明したように本発明は、プログラムの再帰呼出し
が禁止されているデータ処理システムにおいてプログラ
ムの間接再帰呼出しの検出をプログラムの実行時に可能
とすることにより、プログラムの間接再帰呼出しを行う
プログラムを実行してもそのプログラムを構成ルーチン
とする実行可能プログラムが無限ループに陥ることを防
止できるという効果がある。As explained above, the present invention enables detection of indirect recursive calls of programs during program execution in data processing systems where recursive calls of programs are prohibited, thereby executing programs that make indirect recursive calls of programs. This has the effect of preventing an executable program that has this program as a constituent routine from falling into an infinite loop.
第1図は本発明の一実施例の構成を示すブロック図であ
る。
図において、
1・・・戻りアドレス、
2・・・上値識別手段、
3・・・戻りアドレス格納手段、
4・・・割込み命令実行手段、
5・・・プログラム処理手段、
6・・・アドレス領域複写手段、
7・・・上値設定手段、
8・・・戻りアドレス分岐手段、
9・・・戻りアドレス退避領域、
10・・・一時アドレス退避領域、
11・・・プログラム入口点、
12・・・プログラム終了点、
13・・・上値初期化手段、
100 ・・プログラムである。FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention. In the figure, 1...Return address, 2...Upper value identification means, 3...Return address storage means, 4...Interrupt instruction execution means, 5...Program processing means, 6...Address area Copying means, 7... Upper value setting means, 8... Return address branching means, 9... Return address saving area, 10... Temporary address saving area, 11... Program entry point, 12... Program end point, 13...Upper price initialization means, 100...Program.
Claims (1)
込み命令を有するデータ処理システムにおいて、 メモリへのプログラムのロード時にこのプログラム内の
戻りアドレス退避領域を空値で初期化する空値初期化手
段と、 プログラム入口点において前記戻りアドレス退避領域の
内容が空値であるか否かを識別する前記プログラム内の
空値識別手段と、 この空値識別手段による識別で前記戻りアドレス退避領
域の内容が空値ではない場合にプログラム割込み命令を
実行して前記プログラムを異常終了させる前記プログラ
ム内の割込み命令実行手段と、 前記空値識別手段による識別で前記戻りアドレス退避領
域の内容が空値である場合に呼出し側プログラムから渡
された呼出し側プログラムへの戻りアドレスを前記戻り
アドレス退避領域に格納する前記プログラム内の戻りア
ドレス格納手段と、前記プログラムにおける所定の処理
の実行後に前記戻りアドレス退避領域の内容を前記プロ
グラム内の一時アドレス退避領域に複写する前記プログ
ラム内のアドレス領域複写手段と、 このアドレス領域複写手段による複写処理で前記戻りア
ドレス退避領域の内容を前記一時アドレス退避領域に格
納した後に前記戻りアドレス退避領域に空値を設定する
前記プログラム内の空値設定手段と、 前記一時アドレス退避領域に格納されている呼出し側プ
ログラム中の戻りアドレスへの分岐を行う前記プログラ
ム内の戻りアドレス分岐手段と、を有することを特徴と
するプログラムの間接再帰呼出し検出方式。[Claims] In a data processing system in which recursive calling of a program is prohibited and has a program interrupt instruction, a null value initialization method is provided for initializing a return address save area in the program with a null value when the program is loaded into memory. null value identification means in the program for identifying whether or not the contents of the return address save area are null values at a program entry point; Interrupt instruction execution means within the program that executes a program interrupt instruction to abnormally terminate the program if the content is not a null value; and an interrupt instruction execution means in the program that abnormally terminates the program when the content is not a null value; return address storage means within the program for storing a return address to the calling program passed from the calling program in the return address save area in a certain case; and the return address save area after execution of a predetermined process in the program. address area copying means in the program for copying the contents of the return address saving area to a temporary address saving area in the program; A null value setting means in the program that sets a null value in the return address save area; and a return address branch in the program that branches to a return address in the calling program stored in the temporary address save area. An indirect recursive call detection method for a program, comprising: means.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP4174488A JPH01214934A (en) | 1988-02-23 | 1988-02-23 | System for detecting indirect recursive calling of program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP4174488A JPH01214934A (en) | 1988-02-23 | 1988-02-23 | System for detecting indirect recursive calling of program |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH01214934A true JPH01214934A (en) | 1989-08-29 |
Family
ID=12616933
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP4174488A Pending JPH01214934A (en) | 1988-02-23 | 1988-02-23 | System for detecting indirect recursive calling of program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH01214934A (en) |
-
1988
- 1988-02-23 JP JP4174488A patent/JPH01214934A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP0402856B1 (en) | Instruction execution control system | |
| US4679138A (en) | Microsequencer in a data processing system using stack storage for controlling the sequencing of microroutines | |
| JP4275451B2 (en) | Illegal memory access detection method and program thereof | |
| JPH09128267A (en) | Data processor and data processing method | |
| EP0417916B1 (en) | Procedure state descriptor system for digital data processors | |
| JPH01214934A (en) | System for detecting indirect recursive calling of program | |
| JPH0731617B2 (en) | Program runaway detection method | |
| JPH01286029A (en) | Microprogram patching system | |
| JPH09288595A (en) | Arithmetic processing unit | |
| JPH04332055A (en) | Method for detecting program runaway | |
| JPS62137627A (en) | Memory dump system | |
| JPH04205144A (en) | Microprocessor | |
| JPS5842891B2 (en) | Meirei Seigiyohoushiki | |
| JPH02159619A (en) | Normal end outlet calling system | |
| JPS638841A (en) | Interruption accepting system | |
| JPH03240831A (en) | Interruption processing system | |
| JPH059815B2 (en) | ||
| JP2978658B2 (en) | Program development support device | |
| JPH04177535A (en) | Processing control system at the time of generation of interruption factor | |
| JPS604492B2 (en) | calculator | |
| JPH0546444A (en) | Debugger with log function | |
| JPH02100720A (en) | Instruction system with permission for execution | |
| JPH01185729A (en) | Overlay structure program execution system | |
| JPH06332720A (en) | Signal control method | |
| JPS6259818B2 (en) |