JPH0667942A - Log extraction system - Google Patents

Log extraction system

Info

Publication number
JPH0667942A
JPH0667942A JP4217750A JP21775092A JPH0667942A JP H0667942 A JPH0667942 A JP H0667942A JP 4217750 A JP4217750 A JP 4217750A JP 21775092 A JP21775092 A JP 21775092A JP H0667942 A JPH0667942 A JP H0667942A
Authority
JP
Japan
Prior art keywords
log
function
address
called
information
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
Application number
JP4217750A
Other languages
Japanese (ja)
Inventor
Tokushi Ito
徳嗣 伊藤
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP4217750A priority Critical patent/JPH0667942A/en
Publication of JPH0667942A publication Critical patent/JPH0667942A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To obtain a log extraction system by which log can efficiently be extracted. CONSTITUTION:An argument 1 transferred from a function on a calling-side to a function on a called-side, a return address 2 storing the address of the function on the calling-side and the individual local variable 3 of the function on the called-side are stored in a stack by a stack means. When the function is called, a log means records the return address 2 in a log buffer based on a pointer to a first argument (4). At the same time, the address 5 of the function itself on the called-side and the argument 1 are recorded in the log buffer by the log means (6). A function identification means identifies the function on the calling-side based on the return address 2.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】この発明は、例えば、スタックを
用いて関数及び手続きなどの呼び出しを行うプログラミ
ング言語において、関数及び手続きの呼び出しのログデ
ータを採取するための方式に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for collecting log data of function and procedure calls in a programming language for calling functions and procedures using a stack.

【0002】[0002]

【従来の技術】一般に、プログラム中での関数の呼び出
しにおいては、呼び出す側の関数(どこから呼び出され
ているか)の情報を含めてログバッファに記録しようと
した場合、全ての関数に一意の番号を割り付け、この番
号を呼び出す側の関数の引数に追加し、呼び出される側
の関数でこれを記録する方法がとられる。この方法で
は、呼び出される側の関数と呼び出す側の関数の全てに
おいて、プログラムコードの変更が必要になる。
2. Description of the Related Art Generally, when calling a function in a program, if an attempt is made to record the function of the calling side (where it is called) in a log buffer, a unique number is assigned to all functions. Allocating, adding this number to the argument of the calling function, and recording this in the called function. In this method, it is necessary to change the program code in both the called function and the calling function.

【0003】また、関数の呼び出しにおいて、ログバッ
ファに記録する情報としては、呼び出される側の関数、
引数、戻り値、呼び出す側の関数などが挙げられる。こ
れらの情報のうち、特にに引数は、呼び出される側の関
数に依存しており、その数、長さが変わる。この引数の
ような可変長のデータを記録するための方法として以下
の2つの方法がとられる。 (1)データの最大長に合わせて、固定サイズにログバ
ッファを区切る。 (2)そのデータに必要なサイズのログバッファを動的
に割り当てる。
Further, in the function call, the information to be recorded in the log buffer is the called function,
Arguments, return values, calling functions, etc. Of these pieces of information, the arguments in particular depend on the called function, and the number and length thereof change. The following two methods are used to record variable-length data such as this argument. (1) Divide the log buffer into fixed sizes according to the maximum length of data. (2) Dynamically allocate a log buffer of the required size for the data.

【0004】[0004]

【発明が解決しようとする課題】従来のログ採取方式で
は、関数の呼び出しにおいてはプログラムコードの変更
が行われるため、一つでも改修ミスがあれば、誤動作
や、ログ結果が正しくないなどの障害を引き起こす。特
にこのようなログデータが必要になる大規模プログラム
では改修箇所も増え、それに伴って改修ミスの可能性が
増大する。改修ミスの種類によっては、そのプログラム
に致命的な障害を引き起こすこともある。この改修をプ
ログラムにより自動化させようとした場合、マクロを記
述できるプログラム言語(例えば、C言語)で、マクロ
と関数呼び出しとが同様の形式で記述されている場合、
マクロか関数呼び出しかを即座に判断することは難し
く、コンパイラと同レベルの構文解析ルーチンが必要と
なる。
In the conventional log collection method, since the program code is changed when the function is called, if there is even one modification error, a malfunction or an incorrect log result will occur. cause. Particularly in a large-scale program that requires such log data, the number of repair points increases, and the possibility of repair errors increases accordingly. Depending on the type of repair error, the program may cause a fatal failure. If this modification is to be automated by a program, and if the macro and the function call are described in the same format in a programming language (for example, C language) that can describe the macro
It is difficult to judge immediately whether it is a macro or a function call, and a parsing routine at the same level as the compiler is required.

【0005】また、可変長のログデータをログバッファ
に記録する方法では、次のような問題がある。 (1)固定サイズでログバッファを区切る方式では、最
大長よりも短いログデータについては、使用しないログ
領域(メモリ)が発生し、大きなログ領域を必要とする
関数が少数しかないような場合は、利用しない領域が増
え、領域の利用効率が悪くなる。 (2)動的にログバッファを割り当てる方式では、動的
なメモリ管理機構が必要となり、ログを取るための機構
が複雑化するため、その関数本来の処理ではないログ採
取の処理自体に多くの時間が費やされてしまう。
The method of recording variable-length log data in the log buffer has the following problems. (1) With the method of dividing the log buffer with a fixed size, for log data shorter than the maximum length, an unused log area (memory) occurs, and if there are only a few functions that require a large log area, The area that is not used increases, and the efficiency of using the area deteriorates. (2) In the method of dynamically allocating the log buffer, a dynamic memory management mechanism is required, and the mechanism for logging becomes complicated. Time is spent.

【0006】このように、従来のログ採取方式は、ログ
採取のためのプログラムコードの改修でバグを作る可能
性が高く、自動的にログコードを作るプログラムの作成
が困難であり、また、採取したログを記録するための方
法も効率的ではない、などの問題点があった。
As described above, the conventional log collecting method has a high possibility of making a bug by modifying the program code for collecting the log, and it is difficult to make a program for automatically making the log code. There was a problem that the method for recording the log was not efficient.

【0007】この発明は、上記のような問題点を解消す
るためになされたもので、効率的にログの採取が出来る
ログ採取方式を得ることを目的とする。
The present invention has been made to solve the above problems, and an object of the present invention is to obtain a log collecting method capable of collecting logs efficiently.

【0008】[0008]

【課題を解決するための手段】この発明に係る請求項1
におけるログ採取方式は、ある関数において、他の関数
の呼び出しを行った場合に、呼び出される側の関数がそ
の実行終了後に、呼び出す側の関数のどの場所に戻るか
というアドレスを示す戻り情報をスタックに記憶してお
くスタック手段と、スタック手段に記憶されている戻り
情報を、ログを採取するための領域であるログバッファ
へ記録するログ手段と、ログ手段によりログとして採取
される戻り情報をもとにして、呼び出す側の関数がどの
関数であったのかを識別できる関数識別手段を設けたも
のである。
[Means for Solving the Problems] Claim 1 according to the present invention
In the log collection method in, when a function is called with another function, stacking return information indicating the address where the called function returns to after the execution ends A log unit for storing the return information stored in the stack unit, the return information stored in the stack unit in a log buffer that is an area for collecting a log, and the return information collected as a log by the log unit. Then, the function identifying means for identifying which function the calling function was was provided.

【0009】この発明に係る請求項2におけるログ採取
方式は、ある関数において、他の関数の呼び出しを行っ
た場合に、呼び出す側の関数から呼び出される側の関数
へ受け渡される可変長の引数をログバッファへ記録する
呼び出し情報記憶手段と、例えば、受け渡された引数の
まとまり毎に、そのまとまりの終端に区切りとしてバッ
クワードポインタを付加し、前に呼び出された関数の引
数がログバッファのどの場所まで記録されているかとい
うアドレスを、そのバックワードポインタとして記憶す
る識別情報記憶手段と、バックワードポインタに記憶さ
れているアドレスに基づいて、呼び出される側の関数毎
のログを利用することが出来る呼び出し情報利用手段を
設けたものである。
According to a second aspect of the present invention, in a log collection method, when a function is called by another function, a variable length argument passed from the calling function to the called function is passed. For example, a backward pointer is added as a delimiter at the end of each group of passed arguments, and the argument of the function called before is stored in the log buffer. It is possible to use a log for each function on the called side based on the identification information storage means that stores the address indicating whether the location is recorded as the backward pointer and the address stored in the backward pointer. A means for utilizing call information is provided.

【0010】[0010]

【作用】この発明の請求項1におけるログ採取方式は、
呼び出す側の関数のアドレスをスタックに記憶するスタ
ック手段と、呼び出す側の関数のアドレスをログバッフ
ァへ記録するログ手段と、ログとして採取された呼び出
す側の関数のアドレスをもとにして、呼び出す側の関数
を識別することができる関数識別手段とを備えたことに
より、呼び出す側の関数のアドレスをログ採取するため
のプログラムコードを、呼び出される側の関数に追加す
るだけで、呼び出す側の関数を識別することができる。
The log collecting method according to claim 1 of the present invention is as follows.
Stack means for storing the address of the calling function in the stack, log means for recording the address of the calling function in the log buffer, and the calling side based on the address of the calling function collected as a log With the function identification means that can identify the function of, the function of the calling side can be identified by adding the program code for logging the address of the function of the calling side to the function of the called side. Can be identified.

【0011】また、この発明の請求項2におけるログ採
取方式は、可変長の引数をログバッファへ記録する呼び
出し情報記憶手段と、呼び出される関数ごとの引数の記
録場所をバックワードポインタとして示す識別情報記憶
手段と、呼び出される側の関数のログを利用できる呼び
出し情報利用手段とを備えたことにより、バックワード
ポインタ等の識別情報に基づき、呼び出される側の関数
毎の情報の記録場所を効率良く管理できる。
According to the second aspect of the present invention, the log collection method includes call information storage means for recording a variable length argument in the log buffer, and identification information indicating a recording location of the argument for each called function as a backward pointer. Equipped with a storage unit and a call information utilization unit that can use the log of the called function, the recording location of the information for each called function is efficiently managed based on the identification information such as the backward pointer. it can.

【0012】[0012]

【実施例】【Example】

実施例1.以下、この発明の一実施例を図について説明
する。図1は、例えば、C言語においてある関数から他
の関数の呼び出しを行ったときのスタックの状態と、ス
タックからログバッファへ転送されるデータを示す図で
ある。本実施例では、スタックとは後入れ先出しの動作
を行うものであり、後にセットしたデータほど取り出し
は先に行えるものである。1は、呼び出す側の関数から
呼び出される側の関数へ引き渡される引数、2は、呼び
出す側の関数のアドレスを記憶する戻り番地、3は、呼
び出される側の関数の独自のローカル変数である。関数
の呼び出しがあった場合には、呼び出す側の関数から呼
び出される側の関数に制御が移る前に、スタック手段に
よりスタックに引数1がセットされ、その後、呼び出さ
れる側の関数に制御が移る。この時、呼び出す側の関数
に制御を戻すための戻り番地2が、スタックにセットさ
れる。そして、ローカル変数3がスタックにセットされ
る。
Example 1. An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a diagram showing a state of a stack when a function is called from another function in C language and data transferred from the stack to a log buffer, for example. In the present embodiment, the stack is used to perform the last-in first-out operation, and the data set later can be taken out earlier. 1 is an argument passed from the calling function to the called function, 2 is a return address for storing the address of the calling function, and 3 is a unique local variable of the called function. When a function is called, the stack unit sets the argument 1 to the stack before the control is transferred from the calling function to the called function, and then the control is transferred to the called function. At this time, the return address 2 for returning control to the calling function is set in the stack. Then, the local variable 3 is set on the stack.

【0013】関数の呼び出しが行われると、まず最初
に、スタックの第1引数へのポインタを元に、ログ手段
により戻り番地2をログバッファに記録する4。このと
き、呼び出される側の関数に引数が存在しない場合に
は、ダミーの引数を設定し、これを利用して戻り番地を
得る。同時に、呼び出される側の関数自体のアドレス5
や、引数1も、ログ手段によりログバッファに記録され
る6。このログバッファには、ログを採取するためのオ
ーバーヘッドを最小にするために、戻り番地2や、関数
のアドレスのみを記録する。このようなログを採取した
ことにより、戻り番地2に記憶される呼び出す側の関数
のアドレスに従い、関数識別手段により、呼び出す側の
関数がどれであったかを識別することが可能となる。す
なわち、戻り番地2や、関数のアドレスは、ログデータ
の採取後の解析時に、プログラムのシンボルテーブルと
比較することで、対応する関数名などを捜し出すことが
できる。
When the function is called, first, based on the pointer to the first argument of the stack, the return address 2 is recorded in the log buffer by the log means 4. At this time, if there is no argument in the called function, a dummy argument is set and the return address is obtained using this. At the same time, the address 5 of the called function itself
The argument 1 is also recorded in the log buffer by the log unit 6. In this log buffer, only the return address 2 and the address of the function are recorded in order to minimize the overhead for collecting the log. By collecting such a log, it becomes possible to identify which function was the calling side by the function identification means according to the address of the calling function stored in the return address 2. That is, the return address 2 and the function address can be searched for the corresponding function name by comparing with the symbol table of the program at the time of analysis after collecting the log data.

【0014】ログバッファでは、呼び出される関数ごと
に記録する可変長の引数の情報の終端に区切りとして、
バックワードポインタを設ける。バックワードポインタ
は、そのバックワードポインタが終端として付加されて
いるある関数の情報より、1つ前に呼び出されて記録さ
れている関数の情報の区切れがどこであるかのアドレス
を記憶するものである。これにより、ログを採取すべき
情報がどのアドレスから始まっているかがわかる。そし
て、現在のバックワードポインタがどの位置であるかと
いう情報は、カレントポインタにより記憶されている。
例えば、図1において、ログバッファで、ある関数の情
報の記録が行われた場合、呼び出し情報記憶手段により
記憶される可変長の引数の終端には、識別情報記憶手段
の一例であるバックワードポインタ21が付加される。
このバックワードポインタ21は、1つ前に記録された
関数の引数がどの位置で区切れているかというアドレ
ス、即ち、1つ前に記録された関数の引数に付加されて
いるバックワードポインタの存在するアドレスを記憶し
ており、そのアドレスを指し示す7。なお。この時、カ
レントポインタ20は、常に現在どこまでログを記録し
たかという、最後のバックワードポインタの位置をアド
レスとして記憶する。新しく関数の呼び出しが行われる
度に、ログバッファには情報が記録され、その都度、付
加される新しいバックワードポインタには、1つ前の関
数の引数の終端に付加されているバックワードポインタ
のアドレスが記憶され、そのアドレスを指し示す。そし
て、カレントポインタの内容は、その時点で、新しいバ
ックワードポインタのアドレスに書き変わる。これによ
り、呼び出し情報利用手段により、識別情報記憶手段で
あるバックワードポインタを用いることで、可変長であ
る引数を効率よくログとして採取することができる。
In the log buffer, a variable length argument information recorded for each called function is delimited at the end.
Provide backward pointer. The backward pointer stores the address where the break of the information of the function which is called and recorded one before the information of the function to which the backward pointer is added as the end is stored. is there. This makes it possible to know from which address the information for which the log should be collected starts. The information indicating the position of the current backward pointer is stored by the current pointer.
For example, in FIG. 1, when the information of a certain function is recorded in the log buffer, the backward pointer, which is an example of the identification information storage unit, is provided at the end of the variable-length argument stored by the call information storage unit. 21 is added.
The backward pointer 21 is an address indicating at which position the argument of the previously recorded function is divided, that is, the existence of the backward pointer added to the argument of the previously recorded function. The address to be stored is stored, and the address is pointed to 7. Incidentally. At this time, the current pointer 20 always stores, as an address, the position of the last backward pointer, which is how far the log is currently recorded. Each time a new function is called, information is recorded in the log buffer, and each time a new backward pointer is added, the backward pointer added to the end of the argument of the previous function is written. The address is stored and points to that address. Then, the contents of the current pointer are rewritten at that time to the address of the new backward pointer. Thus, by using the backward pointer that is the identification information storage unit, the call information utilization unit can efficiently collect the variable-length argument as a log.

【0015】図2に示すログ採取のためのプログラムコ
ード例について説明する。メモリ上の固定サイズのログ
バッファ8と、現在のログデータの終端を示すカレント
ポインタ9が、グローバル変数として用意される。ま
た、各関数内では、ログバッファを指すポインタ10を
ローカルに持ち、このポインタを元にして、ログバッフ
ァへデータを書き込んで行く。
An example of program code for log collection shown in FIG. 2 will be described. A fixed-size log buffer 8 on the memory and a current pointer 9 indicating the end of the current log data are prepared as global variables. Further, in each function, the pointer 10 pointing to the log buffer is locally held, and data is written into the log buffer based on this pointer.

【0016】関数が呼び出されると、その先頭で図3に
示すフローチャートのように処理を行い、ログバッファ
へログデータを記録する。この場合、ログバッファの終
端を超えるような場合には、ログバッファの先頭から再
利用する。なお、図3のフローチャートにおける番号
は、図2のプログラムコードの番号に対応する。図3に
おいて、まず、呼び出される側の関数のアドレスを記録
する11。そして、第1引数へのポインタを元にして、
戻り番地2を求めて、ログバッファへ記録する12。次
に、引数を格納しているアドレスを求め13、ログバッ
ファへ引数を書き込む14。続いて、ログバッファへカ
レントポインタの内容をコピーし、カレントポインタの
内容を終端のアドレスの値に変更する15。このよう
に、ログ採取のプログラムコードを呼び出される側の関
数に設定するだけで、関数の呼び出しを行う場合のログ
の採取が可能となる。
When the function is called, processing is performed at the head of the function as shown in the flowchart of FIG. 3, and the log data is recorded in the log buffer. In this case, if it exceeds the end of the log buffer, it is reused from the beginning of the log buffer. The numbers in the flowchart of FIG. 3 correspond to the program code numbers of FIG. In FIG. 3, first, the address of the called function is recorded 11. Then, based on the pointer to the first argument,
The return address 2 is obtained and recorded in the log buffer 12. Next, the address storing the argument is obtained 13, and the argument is written 14 in the log buffer. Then, the contents of the current pointer are copied to the log buffer, and the contents of the current pointer are changed to the value of the end address 15. In this way, the log can be collected when the function is called by simply setting the log collection program code in the called function.

【0017】次に、採取したログデータの解析について
説明する。採取したログデータは、図4、または図5の
ようになる。図4において、カレントポインタから、N
ULLポインタ41に行き当るまで、最後のバックワー
ドポインタ42から、関数ごとのログ情報を順に辿って
いくことができる。また、ログバッファは、その領域の
最終端まで記録を終了すると、再び領域の先頭から継続
的に領域に記録するという性質を持っている。このよう
に、ログバッファ領域のデータが、領域の最後のデータ
と先頭のデータが継続するような場合には、カレントポ
インタが指すアドレスを跨ぐバックワードポインタが見
つかるまで、関数ごとの情報を順に辿っていき、ログデ
ータを取り出すことができる。図5のように、関数Fの
情報は、ログバッファの最後と先頭に継続されている。
この時、関数Gの情報の終端がログの終りとなる。ここ
では、カレントポインタ20のアドレスに基づき、バッ
クワードポインタ51から順にアドレスを辿り、カレン
トポインタ20で示されるアドレスをバックワードポイ
ンタ55の示すアドレスが跨いでいる時点56まで、情
報を辿っていき、ログデータを取り出すことができる。
以上に示すように、各ログデータの記録範囲は、バック
ワードポインタが指すアドレス以降、且つ、バックワー
ドポインタの直前までということになる。
Next, the analysis of the collected log data will be described. The collected log data is as shown in FIG. 4 or FIG. In FIG. 4, from the current pointer, N
Log information for each function can be sequentially traced from the last backward pointer 42 until the ULL pointer 41 is reached. Further, the log buffer has a property that when the recording is completed up to the end of the area, the log buffer continuously records again from the head of the area. In this way, when the data in the log buffer area continues at the last data and the first data in the area, the information for each function is traced in order until the backward pointer straddling the address pointed to by the current pointer is found. Then, you can retrieve the log data. As shown in FIG. 5, the information of the function F is continued at the end and the beginning of the log buffer.
At this time, the end of the information of the function G is the end of the log. Here, based on the address of the current pointer 20, the address is sequentially traced from the backward pointer 51, and the information is traced until the point 56 where the address indicated by the backward pointer 55 crosses the address indicated by the current pointer 20, You can retrieve log data.
As described above, the recording range of each log data is from the address pointed to by the backward pointer to immediately before the backward pointer.

【0018】なお、各データの固定長部分(呼び出す側
の関数のアドレス、呼び出される側の関数のアドレス)
は共通の位置(各ログデータの先頭部分か、最後部)に
置き、可変長部分(引数)と区別できるようにする。
The fixed length portion of each data (address of the calling function, address of the called function)
Is placed at a common position (the beginning or the end of each log data) so that it can be distinguished from the variable length part (argument).

【0019】実施例2.実施例1において、識別情報記
憶手段であるバックワードポインタは、1つ前に呼び出
された関数の情報の終端に付加されるとしたが、例え
ば、情報の先頭、または、決められた相対的なアドレス
位置に、関数の情報の区切れがどこであるかというアド
レスを記憶するものであってもよい。また、バックワー
ドポインタは、関数の情報の先頭アドレスを記録した
り、あるいは、1つ前の関数の終端アドレスを記憶する
以外に、記録している関数の情報量(バイト数)などを
記憶して、その量を目安に、順次、ログ情報を辿るもの
であってもよい。
Example 2. In the first embodiment, the backward pointer, which is the identification information storage means, is added to the end of the information of the function called immediately before, but, for example, the head of the information or a determined relative position. An address indicating where the function information is divided may be stored in the address position. The backward pointer stores the start address of the function information, or stores the information amount (number of bytes) of the recorded function in addition to storing the end address of the immediately preceding function. Then, the log information may be sequentially traced based on the amount.

【0020】実施例3.実施例1において、スタック、
及び、ログバッファへのデータのセットの順序は、図1
に示すものとしたが、順序は特にこれに限るものでなく
てもよい。
Example 3. In Example 1, the stack,
Also, the order of setting the data in the log buffer is as shown in FIG.
However, the order is not particularly limited to this.

【0021】実施例4.実施例1において、ログバッフ
ァでは図4、図5に示すように、NULLポインタに行
き当たるまで、あるいは、カレントポインタが指すアド
レスを跨ぐバックワードポインタが見つかるまで、ログ
の情報を辿れるとしたが、例えば、特別なアドレスなど
の条件を設定して、その条件に合うまで(アドレスにな
るまで)はログの情報を辿れるものとしてもよい。
Example 4. In the first embodiment, as shown in FIGS. 4 and 5, in the log buffer, the log information can be traced until the NULL pointer is reached or the backward pointer straddling the address pointed to by the current pointer is found. For example, a condition such as a special address may be set, and the log information may be traced until the condition is met (until the address is reached).

【0022】実施例5.実施例1においては、本発明は
C言語において実施される例を挙げたが、例えば、その
他のプログラミング言語においても本発明は有効であ
る。
Embodiment 5. In the first embodiment, the example in which the present invention is implemented in the C language has been described, but the present invention is also effective in other programming languages, for example.

【0023】実施例6.本発明において、関数とは、サ
ブルーチン、手続き名等の総称を示すものである。
Example 6. In the present invention, a function is a generic term for a subroutine, a procedure name and the like.

【0024】[0024]

【発明の効果】以上のように、請求項1の発明によるロ
グ採取方式は、呼び出される側の関数から呼び出す側の
関数へ戻るための戻り情報をスタックに記憶するスタッ
ク手段と、スタック手段に記憶される戻り情報をログ採
取用の領域へログとして転送するログ手段と、ログ手段
によりログとして採取される戻り情報から、呼び出す側
の関数を識別する関数識別手段とを設けたことにより、
呼び出す側の関数の情報をアドレスとして記憶でき、呼
び出される側の関数にログ採取のためのプログラムコー
ドを追加するので、ログの採取時に、呼び出す側の関数
を識別でき、また、プログラムコードの改修によるバグ
の発生を減らすことができる。
As described above, in the log collecting system according to the first aspect of the present invention, the return information for returning from the called function to the calling function is stored in the stack and the stack means is stored in the stack means. By providing the log means for transferring the returned information to the area for log collection as a log, and the function identification means for identifying the calling function from the return information collected as a log by the log means,
The function information of the calling side can be stored as an address, and the program code for log collection is added to the called function, so the function of the calling side can be identified when the log is collected, and the program code can be modified. The number of bugs can be reduced.

【0025】以上のように、請求項2の発明によるログ
採取方式は、任意の長さの呼び出し情報をログとして記
憶する呼び出し情報記憶手段、呼び出し情報記憶手段に
より記憶される呼び出し情報に付加し、呼び出し情報を
識別する識別情報を記憶する識別情報記憶手段、識別情
報記憶手段により記憶される識別情報に基づいて、任意
の長さの呼び出し情報をログとして利用する呼び出し情
報利用手段を設けたことで、バックポインタなどの識別
情報により、呼び出される側の関数毎の情報の記録場所
を管理できるので、ログバッファに空きを作らずに可変
長のデータである引数を効率よく、順次、記憶すること
ができ、ログデータを関数ごとに効率よく採取すること
ができる。
As described above, in the log collecting method according to the second aspect of the present invention, call information of any length is added to the call information storage means for storing as a log, and the call information stored by the call information storage means, By providing the identification information storage means for storing the identification information for identifying the call information and the call information utilization means for utilizing the call information of an arbitrary length as a log based on the identification information stored by the identification information storage means. Since the recording location of the information for each called function can be managed by the identification information such as the back pointer, it is possible to efficiently and sequentially store the arguments of variable length data without making space in the log buffer. Therefore, log data can be efficiently collected for each function.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の実施例1における、ある関数から他の
関数の呼び出しを行ったときのスタックの状態と、スタ
ックからログバッファへ転送されるデータを示す図であ
る。
FIG. 1 is a diagram showing a stack state when a function calls another function and data transferred from the stack to a log buffer according to a first embodiment of the present invention.

【図2】本発明の実施例1における、ログ採取のための
プログラムコード例を示す図である。
FIG. 2 is a diagram showing an example of a program code for log collection according to the first embodiment of the present invention.

【図3】本発明の実施例1における、ログ採取のための
プログラムコード例に対応するフローチャートを示す図
である。
FIG. 3 is a diagram showing a flowchart corresponding to a program code example for log collection in the first embodiment of the present invention.

【図4】本発明の実施例1における、ログ採取がNUL
Lポインタで終了するログバッファの例を示す図であ
る。
FIG. 4 is NUL for log collection in the first embodiment of the present invention.
It is a figure which shows the example of the log buffer which ends with an L pointer.

【図5】本発明の実施例1における、ログ採取がカレン
トポインタを跨ぐバックポインタで終了するログバッフ
ァの例を示す図である。
FIG. 5 is a diagram showing an example of a log buffer in which log collection ends with a back pointer that straddles a current pointer according to the first embodiment of the present invention.

【符号の説明】[Explanation of symbols]

1 引数 2 呼び出す側の関数のアドレス(戻り番地) 3 ローカル変数の領域 4 ログ手段 5 呼び出される側の関数のアドレス 6 ログ手段 7 識別情報記憶手段 20 カレントポインタ 21 バックワードポインタ 1 Argument 2 Address of Function to Call (Return Address) 3 Area of Local Variable 4 Log Means 5 Address of Function to be Called 6 Log Means 7 Identification Information Storage Means 20 Current Pointer 21 Backward Pointer

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 任意の関数から他の関数を、データを後
入れ先出しするスタックを介して呼び出し、その呼び出
し情報をログ採取用の領域へ取り出すログ採取方式にお
いて、以下の要素を有するログ採取方式 (a)呼び出される側の関数から呼び出す側の関数へ戻
るための戻り情報をスタックに記憶するスタック手段、 (b)スタック手段に記憶される戻り情報をログ採取用
の領域へログとして転送するログ手段、 (c)ログ手段によりログとして採取される戻り情報か
ら、呼び出す側の関数を識別する関数識別手段。
1. A log collection method having the following elements in a log collection method for calling another function from an arbitrary function through a stack that puts data in last in first out and fetches the call information to a log collection area. (A) Stack means for storing return information for returning from the called function to the calling function in the stack, (b) Log for transferring the return information stored in the stack means to the area for log collection as a log Means, (c) function identifying means for identifying the function to be called from the return information collected as a log by the log means.
【請求項2】 任意の関数から他の関数を呼び出し、そ
の呼び出し情報をログ採取用の領域へ取り出すログ採取
方式において、以下の要素を有するログ採取方式 (a)任意の長さの呼び出し情報をログとして記憶する
呼び出し情報記憶手段、 (b)呼び出し情報記憶手段により記憶される呼び出し
情報に付加し、呼び出し情報を識別する識別情報を記憶
する識別情報記憶手段、 (c)識別情報記憶手段により記憶される識別情報に基
づいて、任意の長さの呼び出し情報をログとして利用す
る呼び出し情報利用手段。
2. A log collection method for calling another function from an arbitrary function and extracting the call information to a log collection area, the log collection method having the following elements: (a) call information of an arbitrary length Call information storage means for storing as a log, (b) identification information storage means for storing identification information for identifying the call information, which is added to the call information stored by the call information storage means, (c) stored by the identification information storage means Call information utilizing means for utilizing the call information of an arbitrary length as a log based on the identified information.
JP4217750A 1992-08-17 1992-08-17 Log extraction system Pending JPH0667942A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4217750A JPH0667942A (en) 1992-08-17 1992-08-17 Log extraction system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4217750A JPH0667942A (en) 1992-08-17 1992-08-17 Log extraction system

Publications (1)

Publication Number Publication Date
JPH0667942A true JPH0667942A (en) 1994-03-11

Family

ID=16709167

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4217750A Pending JPH0667942A (en) 1992-08-17 1992-08-17 Log extraction system

Country Status (1)

Country Link
JP (1) JPH0667942A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09179753A (en) * 1995-12-26 1997-07-11 Nec Software Ltd Stack information collecting system using timing of return processing
CN100334559C (en) * 2003-04-02 2007-08-29 佳能株式会社 Journal obtaining method and controlling program and storage medium thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09179753A (en) * 1995-12-26 1997-07-11 Nec Software Ltd Stack information collecting system using timing of return processing
CN100334559C (en) * 2003-04-02 2007-08-29 佳能株式会社 Journal obtaining method and controlling program and storage medium thereof

Similar Documents

Publication Publication Date Title
US5623661A (en) System for and method of providing delta-versioning of the contents of PCTE file objects
US5732272A (en) Subroutine execution time tracer
EP0371941A2 (en) Generic application programming interface system and method
EP0933706B1 (en) Language processing system and language processing method enabling reduction of memory region and overhead in profile information collection of computer
CN1275155C (en) Abnormal failure location method in embedded operationi system
CN114546795A (en) Memory leak detection method, electronic device, and computer-readable storage medium
CN114860654A (en) Method and system for dynamically changing Iceberg table Schema based on Flink data stream
US5379407A (en) Error handling in a state-free system
JPH0667942A (en) Log extraction system
US9032372B2 (en) Runtime environment and method for non-invasive monitoring of software applications
CN115705294B (en) Method, device, electronic equipment and medium for acquiring function call information
CN114328747A (en) Data synchronization method, data synchronization device, computer equipment and medium
JPH0731617B2 (en) Program runaway detection method
JPH05197597A (en) Error logging system in processor device incorporating program
JPS583042A (en) Program execution system
CN114265906A (en) Data synchronization method, data synchronization device, computer equipment and medium
KR100403747B1 (en) Method for correcting program of memory
JPH08331248A (en) Device and method for analyzing and recovering fault for private branch exchange
JPH04352242A (en) Data history recording system for information processor
JP3006499B2 (en) Function trace method of symbolic debugger
JP2001356906A (en) Stack management system
JPH01142936A (en) Information connecting method
JPS61272834A (en) Retrieval execution system for backup program
EP0243084A2 (en) Computer system having delayed save on procedure calls
JPH03246643A (en) Processing for editing dump summary