JP2754528B2 - Debug mode switching processing method - Google Patents

Debug mode switching processing method

Info

Publication number
JP2754528B2
JP2754528B2 JP59177484A JP17748484A JP2754528B2 JP 2754528 B2 JP2754528 B2 JP 2754528B2 JP 59177484 A JP59177484 A JP 59177484A JP 17748484 A JP17748484 A JP 17748484A JP 2754528 B2 JP2754528 B2 JP 2754528B2
Authority
JP
Japan
Prior art keywords
mode
program
debug
memory
interpreter
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
Application number
JP59177484A
Other languages
Japanese (ja)
Other versions
JPS6155749A (en
Inventor
純一 大槻
弘之 斉藤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry Co Ltd
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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP59177484A priority Critical patent/JP2754528B2/en
Publication of JPS6155749A publication Critical patent/JPS6155749A/en
Application granted granted Critical
Publication of JP2754528B2 publication Critical patent/JP2754528B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Description

【発明の詳細な説明】 (技術分野) 本発明はインタプリタによって命令解読を行ない、プ
ログラムを実行する情報処理装置において、デバッグ処
理プログラムを実行する際の、デバッグモード、運用モ
ードの切り替え処理方法に関する。 (従来技術) 従来、この種の情報処理装置においてプログラムのデ
バッグは、プログラム実行中に問題が発生した時点でイ
ンタプリタを中断させ、コンソールをモニタモードと
し、メモリダンプ等によりその内容を解析し、プログラ
ムを訂正した後インタプリタを再起動し、プログラムの
先頭から実行するという方法をとっていた。 (発明が解決しようとする問題) しかしながら前記従来の方法では、デバッグの都度プ
ログラムの先頭から実行させる為、訂正した個所が実行
されるまでに毎回多くの無駄な処理時間を要する欠点が
あった。また実行中にメモリの内容がどう変わるかを見
るためには、この実行されるプログラム中にこのメモリ
内容を読取り、表示または印字させるプログラムを予め
組み込んでおかねばならないという欠点があり、入力が
わずらわしいし、またチェックすべきプログラムを変更
してしまう為、デバッグ後にその変更個所を訂正してお
かねばならず作業者にとって負担が大きかった。 (問題点を解決するための手段) 本発明は、インタプリタにより対象プログラムを解
読、実行すると共に、特定キー入力に従ってデバッグモ
ードへの移行及び運用モードへの移行を行うデバッグモ
ード切り替え処理方法において、運用モードで、前記特
定キー入力を検出した場合には、前記インタプリタによ
る対象プログラムの解読、実行を一時保留して、デバッ
グ用プログラムと共用されるメモリエリアの内容を退避
すると共に、退避していないメモリエリアとデバッグ条
件を設定する会話エリアをディスプレイの同一画面上に
表示することにより、デバッグモードへ移行し、デバッ
グモードで、前記特定キー入力を検出した場合には、前
記退避しておいたメモリエリアの内容を復元すると共
に、前記会話エリアの設定を解除することにより、運用
モードに移行し、デバッグモードで設定されたデバッグ
条件に応じてインタプリタがデバッグ用プログラムを起
動し実行することを特徴とするデバッグモード切り替え
処理を行うものである。 (作用) 本発明によれば、以上のように、運用モードで、特定
キーの押下を検出すると、インタプリタが使用中のメモ
リエリアの内容、すなわちステータス情報等を一時待避
し、退避していないメモリエリアとデバッグ条件を設定
する会話エリアをディスプレイの同一画面上に表示す
る。装置はこれによってデバッグモードへ移行する。そ
して、デバッグモードで、特定キー入力の押下を検出す
ると、退避しておいたメモリエリアの内容を復元すると
共に、会話エリアの設定を解除し、運用モードに移行す
る。その後、装置はデバッグモードで設定されたデバッ
グ条件に応じてインタプリタがデバッグ用プログラムを
起動し実行する。 (実施例) 第2図は本発明の実施例に使用される情報処理装置の
ハードウェアを示すブロック図であり、CPU1にタイマ
2、メモリ3、キーボード4、ディスプレイ5、プリン
タ6、フロッピーディスク装置7、その他の入出力装置
8が接続されていることを示している。 第3図は第2図に示した情報処理装置の論理的階層構
造を示す図であり、9は第2図に示したCPU1、タイマ
2、メモリ3等からなる情報処理装置のハードウェア、
10はインタプリンタ11、インタバルタイマ割込処理12、
キー割込処理13等からなるファームウェア、14はN個の
プログラム15からなるソフトウェアである。前記ファー
ムウェア10はCPU1が解読実行対象とする命令の集合であ
り、ソフトウェア14はインタプリンタ11が解読実行対象
とする命令の集合である。このようにハードウェア9、
ファームウェア10、ソフトウェア14が階層構造を成し
て、情報処理装置が形成される。 なおインタバルタイマ割込処理12はハードウェア9が
ファームウェア10に対し、一定時間周期で割込みを発生
させることにより起動する割込処理である。またキー割
込処理13はキーボードのキー押下を原因とするファーム
ウェア割込みにより起動する割込処理である。 本発明では、インタプリタによるプログラム解読の一
時保留を示すフラグと、デバッグ条件とを格納するパラ
メータエリアを設定するようにしている。そして、イン
タプリタに、パラメータエリアのフラグがセットされて
いる間解読を一時保留する機能と、パラメータエリアに
格納されたデバッグ条件に応じてデバッグ用プログラム
を起動する機能とを付加している。第1図は本発明の一
実施例を示すフローチャートでありインタプリタ及びキ
ー割込処理を示すものである。この実施例では、インタ
プリタは、ステップ34においてパラメータエリア35のフ
ラグを調べデバッグモードか否かを判定する。もしフラ
グがリセットされていれば、インタプリタはデバッグモ
ードではない、すなわち運用モードであると判定する。
運用モードとはインタプリタに対する命令例であるソフ
トウェアを逐次実行するモードである。その結果、イン
タプリタはプログラム15の命令をフェッチし、解読し、
実行するという動作を繰り返すことになる。このように
してプログラム15の最後を示す命令が実行されれば終了
となる。 しかしながらプログラム15の実行中に予定しない動
作、例えばループから脱出できないようになったとする
と、作業者は、まず特殊キー(デバッグモード設定キ
ー)を押下し、パラメータエリア35のフラグをセット
し、デバッグモードを設定する。デバッグモード設定キ
ーが押下、すなわちデバッグモードが設定されたことを
キー割込処理が検出すると、第1図の処理31で示すよう
にデバッグモード中であるのか否かを判定する。デバッ
グモード中であれば、命令をフェチして解読し、実行す
るという動作を繰り返す。デバッグモード中でなけれ
ば、インタプリタの命令を一時保留し(これをステップ
モードとよぶ。)、デバッグモードへ移行する。このと
きこのモードで使用するリソースのうち、運用モードと
重なる部分(メモリの一部、例えばプリンタのモードを
格納しているメモリエリア、ディスプレイの表示内容を
格納しているメモリエリア、ハードウェアのステイタス
情報等)を予じめ退避する。そしてディスプレイ上の一
部の領域には、入力された文字列をデバッグの為のコマ
ンドとして解析、実行する会話エリア(コマンド入力エ
リア及びメッセージ表示エリア)が設定される。作業者
が、デバッグの為に用意されたコマンドである文字列
(文字、数字キー等からなる)を入力するとこの文字列
はコマンド入力エリアに表示され、続いて、作業者が、
リターンキーを入力すると文字列はコマンドとして解析
され、実行される。その結果、処理33に示すようにメモ
リ内容のダンプ、メモリパッチ等の動的なデバッグのた
めの設定が行われる。これによりパラメータエリアにパ
ラメータが格納される。第4図に示す例では、コマンド
入力エリアにメモリダンプコマンド“M"と番地“124A"
が入力され、またその番地以降数バイトの内容及び命令
ポインタである“1234"が表示されている。 作業者は一連の作業終了後、リターンコマンドを実行
させる。第1図の処理32に示す様に、リターンコマンド
によりファームウェアは、退避したステータスを復元
し、インタプリタのステップモードを解除し、運用モー
ドへ移行し、継続してプログラムの実行に入る。この後
インタプリタはパラメータエリアの内容に応じ、ダン
プ、メモリパッチ等の各種デバッグ処理を実行する。 この様に、運用モード−デバッグモードを任意に切替
え可能とし、故意に設定する場合を除いてデバッグモー
ドでのオペレーションがプログラムの実行に影響しない
様にすることにより、動的なデバッグをプログラム自身
を変更することなく容易に行える様にしている。 次に第5図のフローチャートによりファームウェアが
持つデバッグ機能について説明する。 1)インタプリタは、1命令実行毎にパラメータエリア
に設定された次のa)〜e)の項目をチェックし、有効
に指定された項目に対する処理を行う。 なお第5図のステップ20は、通常運用時に、処理速度
が低下しない様、デバッグ機能全てを否定する為の処理
である。 a)ステップモードの処理(ステップ21) 第6図に示すように、ある実行条件が成立するまで次
の命令解読にいかない。実行条件は例えば特定キー押下
により設定できる。このステップモード時は、ディスプ
レイの特定エリアに命令フェッチ用ポインタを表示する
ことにより、作業者に、プログラム停止位置を知らせ
る。なお、前記パラメータエリアのフラグ及びそれによ
るインタプリタの命令解読一次保留機能は、ここで述べ
たステップモード、実行条件、及びステップモードの処
理により実行している。 b)ブレーク処理(ステップ22) 第7図に示すように、任意に設定可能な複数のブレー
クポイントと各種ポインタ(命令フェッチ用、オペラン
ドフェッチ用)とを比較し、対応するコンディション
(“=”または“>”または“<”)が成立するならば
特定アドレスをCALLする命令を実行する。すなわちソフ
トウェアから見ると1種の割込みとなる。コンディショ
ンもブレークポイントと同様に任意に設定可能。 c)スローモーション処理(ステップ23) 第8図に示すように、一定時間次の命令解読にいかな
い。すなわちプログラムをゆっくりと走らせる。プログ
ラムの動きとI/Oの動きとの関係をつかむのに有効であ
る。 d)トレース処理(ステップ24) 命令フェッチ用ポインタ、オペランドフェッチ用ポイ
ンタ、その他メモリの任意のアドレスの内容をメモリの
特定エリアにスタックする。 e)スナップショット処理(ステップ25) ブレークと同様に比較を行い、コンディションを満足
するならば指定された内容を指定されたI/Oに出力す
る。 なおこれらのa)〜e)の項目は重複指定可能であ
り、複数項目を組合せることにより、より有効なデバッ
グ機能となる。 2)メモリ監視は次のように行なう。 インターバルタイマ割込処理は、メモリ監視機能有効
に指定されている場合は、割込により起動する毎に、メ
モリ上の任意のアドレスの内容をリアルタイムでディス
プレイ上の任意な位置へ表示する。 I/Oの動作とメモリ内容との関係をつかむのに有効。 インタプリタのスローモーション機能と組合せること
により、より威力を発揮する。 なお、この機能をインターバルタイマ割込処理で実行
する意義は、もしプログラムが暴走しファームウェアが
正常な動作を行えなくなったとしても、ハードウェアに
よる割込によりインターバルタイマ割込処理が起動し、
この機能の継続実行を可能とする点にある。 3)キー割込処理は次の様に動作する。 キーボード及びディスプレイのモードとして運用モー
ドに対してデバッグモードを持つ。 デバッグモードへの遷移は、特殊キー押下またはイン
タプリタが特定の命令を実行することにより、行なわれ
る。 デバッグモード成立時、ディスプレイの特定エリアの
内容を退避し該エリアをコマンド入力/メッセージ表示
エリアに設定し、カーソルをそのコマンド入力エリアに
表示する。 同時にインタプリタをステップモードとする。 以後リターンコマンド実行までキーボード上のキーは
コマンド入力用またはデバッグ機能用となる。デバッグ
モードのコマンドとして次のa)〜i)がある。 a)メモリパッチ 入力されたアドレスより16バイトのメモリの内容を表
示し、カーソルをその上に表示する。 データキー入力によりその内容を変更し、特定キーを
押下することにより、表示に対応するメモリ内容を変更
する。 カーソル移動用として 表示内容のスクロール用として を使用する。 b)メモリダンプ 入力された、開始アドレスより終了アドレスまでの内
容をプリンタに出力する。 c)ブレークポイント/コンディション表示、設定 インタプリタのブレーク機能設定の為のコマンド。 現在設定されている内容を表示し、カーソルを該位置
とする。設定方法はメモリパッチに同じ。 d)スローモーション設定 インタプリタのスローモーション機能設定の為のコマ
ンド。 e)トレースダンプ インタプリタのトレース機能によりスタックされた内
容をスタック順にプリンタに出力する。 f)トレース表示、設定 インタプリタのトレース機能設定の為のコマンド。 現在設定されている内容を表示し、カーソルを該位置
とする。設定方法はメモリパッチに同じ。 g)スナップポイント表示、設定 インタプリタのスナップショット機能設定の為のコマ
ンド。 現在設定されている内容を表示し、カーソルを該位置
とする。設定方法はメモリパッチに同じ。 h)メモリ監視表示設定 メモリ監視機能設定の為のコマンド。 現在設定されている内容を表示し、カーソルを該位置
とする。設定方法はメモリパッチに同じ。 i)リターン デバッグモニタモード成立時、退避した内容を復元
し、インタプリタのステップモードを解除し、運用モー
ドとする。 またデバッグモニタモード時にデバッグの為に特殊な
機能を発揮するキーとして次のa)〜d)がある。 a)イニシャルキー デバッグモードの処理を中断し、ディスプレイのコマ
ンド/メッセージ内容をクリアし、カーソルをコマンド
入力の先頭位置へ表示する。 b)プリントキー ディスプレイのハードコピーをプリンタに出力する。 c)ステップキー インタプリタがステップモードの場合、インタプリタ
の解読を1ステップ実行する条件を成立させる。すなわ
ち、押下によりプログラムを1ステップ進ませる。命令
フェッチ用ポインタを見ながらプログラムの動きを追う
のに有効。 d)セイブキー メモリパッチ、その他設定変更の為のコマンド実行
時、メモリ格納のトリガとなるキー。 次にこれらのデバッグ機能の使用例をさらに詳細に述
べる。 以下、パソコン等の本発明に係る情報処理装置を用い
て、例えば預金通帳などの印字を行うプリンタのデバッ
グを行う場合を例にして説明する。 まず、情報処理装置とプリンタを接続する。 続いて情報処理装置を立ち上げ、運用モードにする。
このとき、情報処理装置のディスプレイ5の画面には、
例えば第4図に示すように、情報を入力する入力エリア
(入力1〜入力4)が表示されている。なお、図中の入
力2の■はカーソルを示しており、入力4の下の枠線は
装置の様々な状態や作業者へのメッセージを表示するス
テータス表示エリアを示している。また、ステータス表
示エリアの「操作可オンライン」はプリンタが操作可能
な状態にあり、かつ上位装置とオンラインで接続されて
いることを示している。 いま、1万円の預金がスズキ氏からなされたものとし
て、作業者が、入力1に「10,000」と入力し、入力2に
「スズキ」と入力して、プログラムを走らせる。このと
き、プログラムが原因不明のループに陥り、外部に対し
て何も動作しなくなった(いわゆる、だんまりになっ
た)と仮定する。第4図の上段の図(「運用モード」)
は、プリンタがだんまりになったときのディスプレイ5
の画面を示している。 このような場合、デバッグ作業者は、まず特殊キーを
押下してパラメータエリアにフラグをセットすることに
より、ファームウェアを運用モードからデバッグモード
に移行させる。このとき、情報処理装置は、運用モード
で入力していた画面の一部(主に情報が入力されたエリ
ア)を残して所定の部分を退避させ、退避した部分にデ
バッグ用の会話エリアを割り込ませるように表示する。 会話エリアには、例えばプログラム停止位置である命
令ポインタやデバッグ条件等が表示あるいは入力される
コマンドエリアとプログラム停止位置前後のメモリ内容
やループを抜ぬる条件と考えられる情報等を表示される
メッセージエリアが設けられている。会話エリアは、例
えばデバッグモードに移行した直後には、プログラム停
止位置である命令ポインタとプログラム停止位置前後の
メモリ内容等が表示される。これにより作業者はプログ
ラムの実行位置やメモリ内容等を知ることができ、この
後、作業者はデバッグ条件をコマンドエリアに設定する
ことになる。 第4図の中段の右側の図はディスプレイ5の画面の退
避された部分を示している。また、第4図の中段の左側
の図(「デバッグモード」)は、デバッグモードに移行
した直後の画面に、作業者によってデバッグ条件である
Mと124Aが入力された状態のディスプレイ5の画面を示
している。なお、図中の1234はプログラム停止位置であ
る命令ポインタを示し、Mはメモリダンプコマンドを示
し、124Aはメモリダンプコマンドにより設定された番地
を示し、XXXX−−−−−−−XXはプログラム停止位置前
後のメモリ内容等を示している。作業者は、Mや124Aの
ようなデバッグ条件を設定した後、情報処理装置をデバ
ッグモードから運用モードに復帰させる。このとき、デ
ィスプレイ5の画面は、会話エリアが退避され、代わり
に運用モードの退避していた部分が復元される。なお、
デバッグ条件は前述したような様々なコマンドの中から
作業者が適宜選択し設定することができる。 情報処理装置はデバッグモードから運用モードに復帰
するとデバッグ条件に応じてインタプリタがデバッグ用
プログラムを起動し実行する。第4図の下段の図(「運
用モード」)は、ステータス表示エリアにメモリの情報
が表示された状態の画面を示している。なお、図中の12
34はプログラム停止位置である命令ポインタを示してお
り、2127はデバッグ条件で表示すべき設定がなされたア
ドレスのメモリ内容を示している。 なお、表示すべきアドレスのメモリ内容は、例えばデ
バッグ条件の一部に前述のメモリ監視表示設定コマンド
と表示すべきアドレスを設定しておくと、ステータス表
示エリアにそのアドレスのメモリ内容が表示される。こ
のメモリ監視表示設定コマンドに、前述のインタプリタ
のスローモーション設定コマンドやトレースダンプコマ
ンド等を組み合わせることにより、任意のアドレスまで
は通常の速度で表示させ、任意のアドレス以降からはス
ローに表示させたり、スタックされたメモリ内容をスタ
ック順にプリンタに出力すること等ができる。作業者は
これらのデバッグ条件を適宜選択し設定することによ
り、デバッグ用プログラムを実行させたときに、例え
ば、任意のアドレスのメモリ内容が妥当な値になってい
るかや、スタックポインタ(CALL命令によるサブルーチ
ンからの戻りアドレスのスタック位置)が妥当な動きを
するのか等をチェックすることができる。 ループしているプログラムの実行ルートを解析する方
法としては、次の1)〜3)、またはその組合せ等があ
る。 1)ステップキー押下により、プログラムを1ステップ
ずつ走らせながら表示されている命令ポインタを追う。
または同時に、メモリ監視機能により、ループを抜ける
条件と考えられる情報をいくつか表示し、その情報の動
きも同じく追う。 2)または、メモリ監視設定コマンドにより命令ポイン
タ及びループを抜ける条件と考えられる情報をいくつか
表示する様に設定し、リターンコマンドにより運用モー
ドに戻る。以後プログラムを走らせながらメモリ監視機
能により表示される情報を監視することにより、プログ
ラムの走行ルート、他の概要を知る。もしプログラムの
走行が多岐に渡っていて、作業者の監視が追いつかない
ときは、デバッグモードによりインタプリタをスローモ
ーションに設定し、作業者の追い易い速度で監視する。 3)または、トレース表示設定コマンドにより、命令ポ
インタその他、ループを抜ける条件と考えられる情報を
トレースする様設定し、リターンコマンドにより運用モ
ードに戻る。暫らく運用モードで走らした後、再びキー
押下によりデバッグモニタモードとし、トレースダンプ
コマンドによりトレース内容をダンプする。 このダンプ内容を解析することによりプログラムの流
れを知る。トレースの代りにスナップショット機能を用
いても良い。メモリ監視機能の応用例としては、スタッ
クポインタ(CALL命令によるサブルーチンからの戻りア
ドレスのスタック−のスタック位置を示す。)が妥当な
動きをするかのチェックがある。 すなわち、予めスタックポインタを監視できる様、デ
バッグモードにより設定しておき、まずアイドル中の値
を確認する。 次に何回か、各種オペレーション、運用、を行い、最
も深い値を確認する。その値がスタックエリアに対し余
裕ある値がどうかチェックする。 再びアイドルに戻ったとき、最初のアイドルの値に戻
っているかどうかチェックする。 スタックポインタはいつどの様な値になるか不明の
為、特別な操作が必要なく、常にリアルタイムで、オペ
レータが注目しているディスプレイに表示するこのメモ
リ監視機能は、この様な場合に大変有効である。 (発明の効果) 以上説明したように本発明によれば、インタプリタ、
インタバルタイマ割込処理、キー割込処理等のファーム
ウェアにデバッグ用プログラムを備えた。しかもデバッ
グモードでは、装置のディスプレイ画面は、デバッグ用
プログラムと共用されるメモリエリアの内容を退避する
と共に、退避していないメモリエリアとデバッグ条件を
設定する会話エリアを同一画面上に表示するようにして
いる。そのため、インタプリタの次に行うべきプログラ
ム解読、実行を取り消すことなく、デバッグモードに移
行できると共に、デバッグモードにおいて運用モードで
どのような入力がなされたのか等を確認しながらデバッ
グ条件の設定ができる。しかもデバッグ条件は様々なコ
マンドの中から作業者が適宜選択し設定することができ
る。そして再度運用モードに移行することによって、デ
バッグ条件に応じてインタプリタがデバッグ用プログラ
ムを起動し実行することができる。その結果、プログラ
ムの正しい部分を何度も繰り返し実行せずともデバッグ
ができるようになり、デバッグの能率が向上する。また
チェックすべきプログラムが変わっても新たにデバッグ
用プログラムを用意したり、組み込む必要がなくなる。
またデバッグ用プログラムを内蔵しているので、フィー
ルドでのデバッグが容易となる。
Description: TECHNICAL FIELD The present invention relates to a method for switching between a debug mode and an operation mode when executing a debug processing program in an information processing apparatus that executes instructions by decoding instructions using an interpreter. (Prior Art) Conventionally, in this type of information processing apparatus, a program is debugged by interrupting an interpreter when a problem occurs during execution of a program, setting a console to a monitor mode, analyzing the contents by a memory dump or the like, and analyzing the program. Was corrected, the interpreter was restarted, and the program was executed from the beginning. (Problems to be Solved by the Invention) However, in the conventional method, since the program is executed from the head every time debugging is performed, there is a disadvantage that a large amount of useless processing time is required every time the corrected portion is executed. In addition, in order to see how the contents of the memory change during execution, there is a disadvantage that a program for reading, displaying or printing the contents of the memory must be incorporated in the executed program in advance, and input is troublesome. In addition, since the program to be checked has to be changed, the changed part must be corrected after debugging, which places a heavy burden on the operator. (Means for Solving the Problems) The present invention relates to a debugging mode switching processing method for interpreting and executing a target program by an interpreter and performing a transition to a debug mode and a transition to an operation mode according to a specific key input. In the mode, when the specific key input is detected, the interpretation and execution of the target program by the interpreter are temporarily suspended, the contents of the memory area shared with the debug program are saved, and the memory not saved is saved. By displaying the conversation area for setting the area and the debugging condition on the same screen of the display, the mode shifts to the debug mode. When the specific key input is detected in the debug mode, the saved memory area is displayed. By restoring the contents of Then, the operation mode is shifted to the operation mode, and the interpreter starts and executes a debugging program in accordance with the debugging condition set in the debugging mode, thereby performing a debugging mode switching process. (Operation) According to the present invention, as described above, when the pressing of a specific key is detected in the operation mode, the contents of the memory area being used by the interpreter, that is, the status information and the like are temporarily saved, and the memory not saved is used. The conversation area for setting the area and the debug condition is displayed on the same screen of the display. This causes the device to enter debug mode. Then, when the pressing of a specific key input is detected in the debug mode, the contents of the saved memory area are restored, the setting of the conversation area is released, and the operation mode is shifted to the operation mode. Thereafter, in the device, the interpreter activates and executes the debugging program in accordance with the debugging conditions set in the debugging mode. (Embodiment) FIG. 2 is a block diagram showing hardware of an information processing apparatus used in an embodiment of the present invention. The CPU 1 includes a timer 2, a memory 3, a keyboard 4, a display 5, a printer 6, a floppy disk drive. 7, the other input / output device 8 is connected. FIG. 3 is a diagram showing a logical hierarchical structure of the information processing apparatus shown in FIG. 2, and 9 is a hardware diagram of the information processing apparatus including the CPU 1, the timer 2, the memory 3, etc. shown in FIG.
10 is an interprinter 11, interval timer interrupt processing 12,
The firmware 14 includes a key interruption process 13 and the like, and the software 14 includes N programs 15. The firmware 10 is a set of instructions to be executed by the CPU 1 for decoding, and the software 14 is a set of instructions to be executed by the interprinter 11 for decoding. Thus, hardware 9,
The firmware 10 and the software 14 form a hierarchical structure, and an information processing device is formed. The interval timer interrupt process 12 is an interrupt process that is started when the hardware 9 generates an interrupt to the firmware 10 at a fixed time period. The key interrupt process 13 is an interrupt process started by a firmware interrupt caused by pressing a key on the keyboard. According to the present invention, a parameter indicating a flag indicating temporary suspension of program decoding by the interpreter and a debugging condition are set. The interpreter is provided with a function of temporarily suspending decoding while the flag of the parameter area is set, and a function of activating a debugging program in accordance with debugging conditions stored in the parameter area. FIG. 1 is a flowchart showing an embodiment of the present invention, and shows an interpreter and a key interruption process. In this embodiment, the interpreter checks the flag in the parameter area 35 in step 34 to determine whether or not the mode is the debug mode. If the flag has been reset, the interpreter determines that it is not in debug mode, ie, it is in operational mode.
The operation mode is a mode in which software that is an example of an instruction to the interpreter is sequentially executed. As a result, the interpreter fetches and decodes the instructions in program 15,
The operation of executing is repeated. When the instruction indicating the end of the program 15 is executed in this way, the process ends. However, if it becomes impossible to escape from the loop during the execution of the program 15, for example, it is impossible to escape from the loop, the operator first presses a special key (debug mode setting key), sets a flag in the parameter area 35, and sets the debug mode. Set. When the key interrupt process detects that the debug mode setting key has been pressed, that is, that the debug mode has been set, it is determined whether or not the debug mode is in progress, as indicated by process 31 in FIG. During the debug mode, the operation of fetish decoding and executing the instruction is repeated. If not in the debug mode, the instruction of the interpreter is temporarily suspended (this is called a step mode), and the mode shifts to the debug mode. At this time, of the resources used in this mode, a part that overlaps with the operation mode (a part of the memory, for example, a memory area storing the mode of the printer, a memory area storing the display contents of the display, a status of the hardware). Information, etc.) in advance. In a partial area on the display, a conversation area (command input area and message display area) for analyzing and executing an input character string as a command for debugging is set. When the operator inputs a character string (consisting of characters, numeric keys, etc.) which is a command prepared for debugging, this character string is displayed in the command input area, and then, the operator
When the return key is pressed, the character string is parsed as a command and executed. As a result, as shown in process 33, settings for dynamic debugging such as dumping of memory contents and memory patches are performed. Thereby, the parameters are stored in the parameter area. In the example shown in FIG. 4, the memory dump command “M” and the address “124A” are entered in the command input area.
Is input, and the contents of several bytes after the address and "1234" which is the instruction pointer are displayed. After a series of operations, the operator executes a return command. As shown in the process 32 in FIG. 1, the firmware restores the saved status by the return command, cancels the step mode of the interpreter, shifts to the operation mode, and continuously executes the program. After that, the interpreter executes various debugging processes such as dump and memory patch according to the contents of the parameter area. In this way, the operation mode and the debug mode can be arbitrarily switched, and the operation in the debug mode does not affect the execution of the program except when intentionally set. It is easy to do without any changes. Next, the debug function of the firmware will be described with reference to the flowchart of FIG. 1) The interpreter checks the following items a) to e) set in the parameter area every time one instruction is executed, and performs a process for an item designated as valid. Step 20 in FIG. 5 is a process for negating all debugging functions so that the processing speed does not decrease during normal operation. a) Step Mode Processing (Step 21) As shown in FIG. 6, the next instruction is not decoded until a certain execution condition is satisfied. The execution condition can be set, for example, by pressing a specific key. In this step mode, an instruction fetch pointer is displayed in a specific area of the display to inform the operator of the program stop position. The flag in the parameter area and the command interpretation primary suspension function of the interpreter are executed by the step mode, execution condition, and step mode processing described herein. b) Break processing (step 22) As shown in FIG. 7, a plurality of breakpoints that can be set arbitrarily and various pointers (for instruction fetch and operand fetch) are compared, and the corresponding condition (“=” or If “>” or “<” is satisfied, execute an instruction to call a specific address. That is, it is a kind of interrupt from the viewpoint of software. The condition can be set arbitrarily as well as the breakpoint. c) Slow motion processing (step 23) As shown in FIG. 8, the next instruction cannot be decoded for a certain period of time. That is, run the program slowly. This is useful for understanding the relationship between program movement and I / O movement. d) Trace processing (step 24) The instruction fetch pointer, the operand fetch pointer, and the contents of any other address of the memory are stacked in a specific area of the memory. e) Snapshot processing (step 25) The comparison is performed in the same manner as for the break, and if the condition is satisfied, the specified contents are output to the specified I / O. Note that these items a) to e) can be specified repeatedly, and by combining a plurality of items, a more effective debugging function can be obtained. 2) Memory monitoring is performed as follows. If the memory monitoring function is specified to be valid, the interval timer interrupt processing displays the contents of an arbitrary address in the memory at an arbitrary position on the display in real time each time the memory is activated by the interrupt. Useful for understanding the relationship between I / O operations and memory contents. Combine with the slow motion function of the interpreter to show more power. The meaning of executing this function in the interval timer interrupt processing is that even if the program goes out of control and the firmware cannot operate normally, the interval timer interrupt processing is started by the hardware interrupt,
The point is that this function can be continuously executed. 3) The key interruption process operates as follows. It has a debug mode for the operation mode as a keyboard and display mode. The transition to the debug mode is performed by pressing a special key or when the interpreter executes a specific instruction. When the debug mode is established, the contents of a specific area of the display are saved, the area is set as a command input / message display area, and a cursor is displayed in the command input area. At the same time, the interpreter is set to the step mode. Thereafter, the keys on the keyboard are used for command input or debug function until the execution of the return command. Commands in the debug mode include the following a) to i). a) Memory patch The contents of the memory of 16 bytes from the input address are displayed, and the cursor is displayed thereon. The contents are changed by the data key input, and the memory contents corresponding to the display are changed by pressing the specific key. For cursor movement For scrolling display contents Use b) Memory dump Outputs the contents of the input from the start address to the end address to the printer. c) Breakpoint / condition display and setting Commands for setting the break function of the interpreter. The currently set contents are displayed, and the cursor is set at the position. The setting method is the same as the memory patch. d) Slow motion setting Command for setting the slow motion function of the interpreter. e) Trace dump The contents stacked by the trace function of the interpreter are output to the printer in the stacking order. f) Trace display and setting Commands for setting the trace function of the interpreter. The currently set contents are displayed, and the cursor is set at the position. The setting method is the same as the memory patch. g) Snap point display and setting Commands for setting the snapshot function of the interpreter. The currently set contents are displayed, and the cursor is set at the position. The setting method is the same as the memory patch. h) Memory monitoring display setting Command for setting the memory monitoring function. The currently set contents are displayed, and the cursor is set at the position. The setting method is the same as the memory patch. i) Return When the debug monitor mode is established, the saved contents are restored, the step mode of the interpreter is released, and the operation mode is set. Also, there are the following a) to d) as keys that exhibit special functions for debugging in the debug monitor mode. a) Initial key The processing in the debug mode is interrupted, the contents of the command / message on the display are cleared, and the cursor is displayed at the head position of the command input. b) Print key Outputs a hard copy of the display to the printer. c) Step key When the interpreter is in the step mode, a condition for executing one step of decoding the interpreter is established. That is, the program advances by one step when pressed. It is effective to follow the program movement while looking at the instruction fetch pointer. d) Save key This key triggers memory storage when executing commands for changing memory patches and other settings. Next, examples of using these debug functions will be described in further detail. Hereinafter, a case will be described as an example in which a printer that prints, for example, a bankbook is debugged using an information processing apparatus according to the present invention such as a personal computer. First, the information processing device and the printer are connected. Subsequently, the information processing apparatus is started up and set to the operation mode.
At this time, the screen of the display 5 of the information processing device
For example, as shown in FIG. 4, input areas (input 1 to input 4) for inputting information are displayed. In the drawing, the symbol of the input 2 indicates a cursor, and the frame below the input 4 indicates various statuses of the apparatus and a status display area for displaying a message to an operator. Further, “operable online” in the status display area indicates that the printer is in an operable state and is onlinely connected to a higher-level device. Now, assuming that the deposit of 10,000 yen has been made by Suzuki, the operator inputs "10,000" in input 1 and inputs "Suzuki" in input 2, and runs the program. At this time, it is assumed that the program has fallen into a loop of unknown cause and has stopped operating to anything outside (so-called, it has become a lot). The upper part of Fig. 4 ("Operation mode")
Is the display 5 when the printer is overloaded
The screen of FIG. In such a case, the debug worker first shifts the firmware from the operation mode to the debug mode by pressing a special key and setting a flag in the parameter area. At this time, the information processing apparatus saves a predetermined portion while leaving a part of the screen input in the operation mode (mainly an area into which information is input), and interrupts the conversation area for debugging in the saved portion. To display The conversation area includes, for example, a command area in which an instruction pointer, which is a program stop position, debugging conditions, and the like are displayed or input, and a message area in which memory contents around the program stop position, information considered as a condition for exiting a loop, and the like are displayed. Is provided. In the conversation area, for example, immediately after shifting to the debug mode, an instruction pointer, which is a program stop position, and memory contents before and after the program stop position are displayed. This allows the operator to know the execution position of the program, the contents of the memory, and the like. After that, the operator sets the debugging conditions in the command area. The right part of the middle part of FIG. 4 shows the retreated part of the screen of the display 5. In addition, the middle left diagram in FIG. 4 (“debug mode”) shows the screen of the display 5 in a state in which M and 124A, which are the debug conditions, are input by the operator on the screen immediately after the shift to the debug mode. Is shown. In the figure, 1234 indicates an instruction pointer which is a program stop position, M indicates a memory dump command, 124A indicates an address set by the memory dump command, and XXXX ------------- XX The memory contents before and after the position are shown. After setting debug conditions such as M and 124A, the operator returns the information processing apparatus from the debug mode to the operation mode. At this time, on the screen of the display 5, the conversation area is saved, and the saved portion of the operation mode is restored instead. In addition,
The operator can appropriately select and set the debugging conditions from the various commands described above. When the information processing apparatus returns from the debug mode to the operation mode, the interpreter activates and executes the debug program according to the debug conditions. The lower diagram of FIG. 4 (“operation mode”) shows a screen in a state in which memory information is displayed in the status display area. Note that 12 in the figure
Numeral 34 indicates an instruction pointer which is a program stop position, and numeral 2127 indicates memory contents of an address set to be displayed under debug conditions. The memory content of the address to be displayed is set, for example, by setting the above-mentioned memory monitoring display setting command and the address to be displayed as a part of the debug condition, and the memory content of the address is displayed in the status display area. . By combining this memory monitoring display setting command with the slow motion setting command or trace dump command of the interpreter described above, an arbitrary address can be displayed at a normal speed, and from an arbitrary address onward, a slow display can be performed. The contents of the stacked memory can be output to a printer in the order of stacking. The operator selects and sets these debugging conditions as appropriate so that when the debugging program is executed, for example, whether the memory content at an arbitrary address has an appropriate value or the stack pointer (by the CALL instruction) It is possible to check whether or not the stack position of the return address from the subroutine moves appropriately. Methods for analyzing the execution route of the looping program include the following 1) to 3) or a combination thereof. 1) Follow the displayed instruction pointer while running the program one step at a time by pressing the step key.
Or at the same time, the memory monitoring function displays some information considered as a condition for exiting the loop, and follows the movement of the information. 2) Alternatively, the instruction is set to display some information that is considered as a condition for exiting the instruction pointer and the loop by the memory monitoring setting command, and the operation mode is returned to the operation mode by the return command. Thereafter, the information displayed by the memory monitoring function is monitored while the program is running, so that the running route of the program and other outlines are known. If the running of the program is diversified and the monitoring of the operator cannot keep up, the interpreter is set to slow motion in the debug mode, and the monitoring is performed at a speed that is easy for the operator to follow. 3) Alternatively, a trace display setting command is used to trace the instruction pointer and other information that may be a condition for exiting the loop, and the operation returns to the operation mode by a return command. After running in the operation mode for a while, the debug monitor mode is set by pressing the key again, and the trace contents are dumped by the trace dump command. The flow of the program is known by analyzing the contents of the dump. A snapshot function may be used instead of the trace. As an application example of the memory monitoring function, there is a check as to whether the stack pointer (indicating the stack position of the stack at the return address from the subroutine by the CALL instruction) performs an appropriate movement. That is, the stack pointer is set in advance in the debug mode so that the stack pointer can be monitored, and the value during idle is checked first. Next, various operations and operations are performed several times, and the deepest value is confirmed. Check if the value has a margin for the stack area. When returning to idle again, check to see if it has returned to the original idle value. Because it is unknown when and what value the stack pointer will have, no special operation is required, and this memory monitoring function, which always displays in real time on the display that the operator is watching, is very effective in such cases. is there. (Effects of the Invention) As described above, according to the present invention, an interpreter,
A firmware program for interval timer interrupt processing and key interrupt processing is provided with a debugging program. Moreover, in the debug mode, the display screen of the device saves the contents of the memory area shared with the debug program, and displays the memory area that has not been saved and the conversation area for setting the debug conditions on the same screen. ing. Therefore, it is possible to shift to the debug mode without canceling the decoding and execution of the program to be performed next to the interpreter, and it is possible to set the debug conditions while confirming what kind of input was made in the operation mode in the debug mode. In addition, the operator can appropriately select and set the debugging conditions from various commands. Then, by switching to the operation mode again, the interpreter can start and execute the debugging program according to the debugging conditions. As a result, debugging can be performed without executing the correct part of the program over and over again, and debugging efficiency is improved. Further, even if the program to be checked changes, there is no need to prepare a new debugging program or incorporate it.
Also, since a debugging program is built in, debugging in the field becomes easy.

【図面の簡単な説明】 第1図は本発明の一実施例を示すフローチャート、第2
図は前記実施例のハードウェアを示すブロック図、第3
図は前記実施例の論理的階層構造を示す図、第4図は前
記実施例の動作を説明する図、第5図はデバッグ用プロ
グラムのフローチャート、第6図から第8図はデバッグ
用プログラムの各機能を示すフローチャートであり、第
6図はステップモード処理、第7図はブレーク処理、第
8図はスローモーション処理を示すものである。 1……CPU、2……タイマ、3……メモリ、4……キー
ボード、5……ディスプレイ、6……プリンタ、7……
フロッピーディスク装置、8……その他の入出力装置、
9……ハードウェア、10……ファームウェア、11……イ
ンタプリタ、12……インタバルタイマ割込処理、13……
キー割込処理、14……ソフトウェア、15……プログラ
ム、20〜25,31〜34……ステップ。
BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a flowchart showing one embodiment of the present invention, FIG.
FIG. 3 is a block diagram showing hardware of the embodiment, and FIG.
FIG. 4 is a diagram showing a logical hierarchical structure of the embodiment, FIG. 4 is a diagram for explaining the operation of the embodiment, FIG. 5 is a flowchart of a debugging program, and FIGS. 6 is a flowchart showing each function, FIG. 6 shows a step mode process, FIG. 7 shows a break process, and FIG. 8 shows a slow motion process. 1 ... CPU, 2 ... Timer, 3 ... Memory, 4 ... Keyboard, 5 ... Display, 6 ... Printer, 7 ...
Floppy disk drive, 8 other input / output devices,
9: Hardware, 10: Firmware, 11: Interpreter, 12: Interval timer interrupt processing, 13:
Key interrupt processing, 14 software, 15 programs, 20 to 25, 31 to 34 steps.

フロントページの続き (56)参考文献 特開 昭57−111756(JP,A) 特開 昭58−158741(JP,A) 特開 昭52−120638(JP,A) 特開 昭60−229141(JP,A) 特開 昭53−104133(JP,A) 実開 昭56−67548(JP,U) 特公 昭58−26585(JP,B2) 横山淳 「NEC PC−8001 N− BASICプロプラニング教本 (昭 55.5.20) 廣済堂出版 (P.68− 70) 朝日新聞社 電子計算室編 「パソコ ンPCシリーズ 9801・8801ハンドブッ ク (昭58.7.1) 朝日新聞社 (P.18.19.36)Continuation of front page    (56) References JP-A-57-111756 (JP, A)                 JP-A-58-158741 (JP, A)                 JP-A-52-120638 (JP, A)                 JP-A-60-229141 (JP, A)                 JP-A-53-104133 (JP, A)                 Shokai 56-67548 (JP, U)                 Japanese Patent Publication No. 58-26585 (JP, B2)                 Jun Yokoyama "NEC PC-8001 N-               BASIC Proplanning Textbook (Akira               55.5.20) Kosaido Publishing (P.68-)               70)                 Asahi Shimbun Electronic Computer Room "Pasoko               PC Series 9801/8801 Handbook               Ku (58.7.1) The Asahi Shimbun               (P.18.19.36)

Claims (1)

(57)【特許請求の範囲】 1.インタプリタにより対象プログラムを解読、実行す
ると共に、特定キー入力に従ってデバッグモードへの移
行及び運用モードへの移行を行うデバッグモード切り替
え処理方法において、 運用モードで、前記特定キー入力を検出した場合には、
前記インタプリタによる対象プログラムの解読、実行を
一時保留して、デバッグ用プログラムと共用されるメモ
リエリアの内容を退避すると共に、退避していないメモ
リエリアとデバッグ条件を設定する会話エリアをディス
プレイの同一画面上に表示することにより、デバッグモ
ードへ移行し、 デバッグモードで、前記特定キー入力を検出した場合に
は、前記退避しておいたメモリエリアの内容を復元する
と共に、前記会話エリアの設定を解除することにより、
運用モードに移行し、デバッグモードで設定されたデバ
ッグ条件に応じてインタプリタがデバッグ用プログラム
を起動し実行することを特徴とするデバッグモード切り
替え処理方法。
(57) [Claims] In a debug mode switching processing method of interpreting and executing a target program by an interpreter and performing a transition to a debug mode and a transition to an operation mode according to a specific key input, when the specific key input is detected in the operation mode,
The interpretation and execution of the target program by the interpreter are temporarily suspended, the contents of the memory area shared with the debugging program are saved, and the unsaved memory area and the conversation area for setting the debugging conditions are displayed on the same screen. By displaying the above, the mode shifts to the debug mode. When the specific key input is detected in the debug mode, the content of the saved memory area is restored, and the setting of the conversation area is released. By doing
A debug mode switching method, wherein the debugger switches to an operation mode, and an interpreter activates and executes a debug program in accordance with debugging conditions set in the debug mode.
JP59177484A 1984-08-28 1984-08-28 Debug mode switching processing method Expired - Fee Related JP2754528B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP59177484A JP2754528B2 (en) 1984-08-28 1984-08-28 Debug mode switching processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP59177484A JP2754528B2 (en) 1984-08-28 1984-08-28 Debug mode switching processing method

Publications (2)

Publication Number Publication Date
JPS6155749A JPS6155749A (en) 1986-03-20
JP2754528B2 true JP2754528B2 (en) 1998-05-20

Family

ID=16031710

Family Applications (1)

Application Number Title Priority Date Filing Date
JP59177484A Expired - Fee Related JP2754528B2 (en) 1984-08-28 1984-08-28 Debug mode switching processing method

Country Status (1)

Country Link
JP (1) JP2754528B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0719170B2 (en) * 1987-10-27 1995-03-06 三菱電機株式会社 Method of debugging sequence program in programmable controller
JPH01255938A (en) * 1988-04-05 1989-10-12 Meidensha Corp Interrupting processing system
US5389340A (en) * 1989-12-28 1995-02-14 Tokuyama Corporation Module and device for detecting NOX gas

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
朝日新聞社 電子計算室編 「パソコンPCシリーズ 9801・8801ハンドブック (昭58.7.1) 朝日新聞社 (P.18.19.36)
横山淳 「NEC PC−8001 N−BASICプロプラニング教本 (昭55.5.20) 廣済堂出版 (P.68−70)

Also Published As

Publication number Publication date
JPS6155749A (en) 1986-03-20

Similar Documents

Publication Publication Date Title
US6026362A (en) Tool and method for diagnosing and correcting errors in a computer program
EP0652518B1 (en) Operating system based performance monitoring of programs
US8032868B2 (en) Storing and restoring snapshots of a computer process
US5404321A (en) Computer system and method for modifying and enhancing the built-in programs of a computer
JP2000200180A (en) Display widget interaction using slave graphics context inside incorporation system
JP2754528B2 (en) Debug mode switching processing method
JP2000200179A (en) Method for displaying applet and application using bufferless slave graphics context inside incorporation system
JP5119047B2 (en) Operation display device and image forming apparatus
JPS61255432A (en) Error message display system
CN111930425B (en) Data control method and device and computer readable storage medium
JPH06259221A (en) Information processor with screen display
JPH05324416A (en) System error history saving system
JPH10260782A (en) Graphical user interface and information reporting method therefor
Pavlidis Event Handling in the X Toolkit
JPH01159739A (en) Error processing system
JPH0863116A (en) Display controller and display control method
JPH03268033A (en) Remote debugging system
JPH05134888A (en) Information processor
JP3416171B2 (en) Graph processing apparatus and method
JP2002342699A (en) Device/method for displaying tabular format attribute, device/method for displaying message window, storage medium and program
JP2817473B2 (en) Debug system
JPS61241843A (en) Information processor
JP2005234873A (en) Computer, system restoration method, program and information storage medium
JPH03278243A (en) Debugging device
JPH02260049A (en) Program start checking method

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees