JP4966904B2 - Program diagnostic apparatus, program diagnostic method and program thereof - Google Patents

Program diagnostic apparatus, program diagnostic method and program thereof Download PDF

Info

Publication number
JP4966904B2
JP4966904B2 JP2008091323A JP2008091323A JP4966904B2 JP 4966904 B2 JP4966904 B2 JP 4966904B2 JP 2008091323 A JP2008091323 A JP 2008091323A JP 2008091323 A JP2008091323 A JP 2008091323A JP 4966904 B2 JP4966904 B2 JP 4966904B2
Authority
JP
Japan
Prior art keywords
code
program
instruction
instruction code
history table
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.)
Active
Application number
JP2008091323A
Other languages
Japanese (ja)
Other versions
JP2009245184A (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.)
NTT Data Corp
Original Assignee
NTT Data 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 NTT Data Corp filed Critical NTT Data Corp
Priority to JP2008091323A priority Critical patent/JP4966904B2/en
Publication of JP2009245184A publication Critical patent/JP2009245184A/en
Application granted granted Critical
Publication of JP4966904B2 publication Critical patent/JP4966904B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Description

本発明は、並列実行されるプログラムの共通資源へのアクセス競合状態を、プログラムソースコード中から検出するプログラム診断装置及びプログラム診断方法ならびにそのプログラムに関する。   The present invention relates to a program diagnosis apparatus, a program diagnosis method, and a program for detecting a race condition of access to a common resource of a program executed in parallel from program source code.

従来、コンピュータシステムにおいては排他制御という技術が利用されている。ここで、排他制御を行わない場合の預金管理システムと、排他制御を行う場合の預金管理システムとについて、具体例を用いて説明する。まず、排他制御を行わない預金管理システムにおいて、入金プログラムが、50,000円(共有変数)の預金残高へ、30,000円を入金処理し、80,000円を預金金額として登録する場合を例に説明する。ここで、入金プログラムと出金プログラムとが同タイミングに実行された場合、出金プログラムは、入金プログラムが処理を行っている間に、預金残高50,000円を読み取り、その預金残高から10,000円を出金処理した40,000円を計算し、入金プログラムの処理完了後に、40,000円の金額の情報を預金金額へ登録する可能性がある。このような場合、預金残高は入金プログラムの処理を反映していない40,000円と記録されてしまい、50,000円(預金残高)+30,000(入金金額)−10,000(出金金額)=70,000円で算出されるような正確な金額とならない。このようなプログラムの競合状態を回避するためには、排他制御を行う必要がある。つまり、共有変数に対して入金プログラムが実行されている間は共有変数をロックし、共有変数に対する出金プログラムの処理をロック(実行させないよう処理)し、これにより、預金残高が正確な値の70,000円となるよう制御する必要がある。   Conventionally, a technology called exclusive control has been used in computer systems. Here, the deposit management system when the exclusive control is not performed and the deposit management system when the exclusive control is performed will be described using specific examples. First, in a deposit management system that does not perform exclusive control, the deposit program deposits 30,000 yen into a deposit balance of 50,000 yen (shared variable) and registers 80,000 yen as the deposit amount. Explained as an example. Here, when the deposit program and the withdrawal program are executed at the same timing, the withdrawal program reads the deposit balance of 50,000 yen while the deposit program is processing, There is a possibility of calculating 40,000 yen, which is a withdrawal process of 000 yen, and registering information on the amount of 40,000 yen in the deposit amount after the completion of the deposit program. In such a case, the deposit balance is recorded as 40,000 yen that does not reflect the processing of the deposit program, and 50,000 yen (deposit balance) +30,000 (deposit amount) -10,000 (withdrawal amount) ) = It is not an accurate amount as calculated at 70,000 yen. In order to avoid such a program race condition, it is necessary to perform exclusive control. In other words, while the deposit program is being executed for the shared variable, the shared variable is locked, and the processing of the withdrawal program for the shared variable is locked (so as not to be executed). It is necessary to control to be 70,000 yen.

同様に、インターネットに接続されたウェブサーバの処理でも競合状態が発生する。図19で示す図はウェブサーバにおける競合状態を示す図である。この図が示すように、クライアント端末Aを利用するユーザAと、クライアント端末Bを利用するユーザBが同時にウェブサーバにアクセスしている状態において、クライアントAからの処理を制御するプログラムとクライアントBからの処理を制御するプログラムが競合した場合、クライアント端末Aに対して、クライアント端末Bへ送信するウェブページを送信してしまう可能性がある。そして、これらの競合状態がウェブサーバのプログラムで発生しないかどうかのプログラム診断を行なう技術が特許文献1に開示されている。
特開2007−257397号公報
Similarly, a race condition occurs in processing of a web server connected to the Internet. The figure shown in FIG. 19 is a figure which shows the competition state in a web server. As shown in the figure, in the state where the user A who uses the client terminal A and the user B who uses the client terminal B are accessing the web server at the same time, the program that controls the processing from the client A and the client B When the program for controlling the above process conflicts, there is a possibility that the web page to be transmitted to the client terminal B is transmitted to the client terminal A. Patent Document 1 discloses a technique for performing a program diagnosis as to whether these race conditions occur in a web server program.
JP 2007-257397 A

ここで、上述の特許文献1の技術では、平行・並列動作を行なうプログラム中で共有変数の読み込み処理と、共有変数の書き込み処理とを検出し、共有変数の読み込み処理における当該共有変数の値と、共有変数の書き込み処理の直前における共有変数の値を比較する。そしてその比較において値が一致しない場合に競合状態であると検出して、その競合状態が発生するプログラム中の箇所にassert文を追加したソースコードを出力している。しかしながら、特許文献1の技術では、仮想マシンの動的解析によって、競合状態が発生したかどうかを検出できるものの、プログラムにおいて競合状態が発生しないように修正しなければならない場合、そのプログラムの記述位置を特定することができない。またプログラムのソースコードにassert文を追加するため、プログラム自体を改変してしまうこととなる。さらに、特許文献1の技術では、仮想マシンの動的解析中に競合状態が発生しなければ、それを検出することができないという問題がある。   Here, in the technique of the above-described Patent Document 1, a shared variable reading process and a shared variable writing process are detected in a program that performs parallel / parallel operations, and the value of the shared variable in the shared variable reading process is detected. Compare the values of the shared variables immediately before the shared variable write process. If the values do not match in the comparison, it is detected that there is a race condition, and the source code with the assert statement added at the location in the program where the race condition occurs is output. However, in the technique of Patent Document 1, although it is possible to detect whether or not a race condition has occurred by dynamic analysis of a virtual machine, if the program needs to be corrected so as not to cause a race condition, the description position of the program Cannot be specified. Further, since the assert statement is added to the source code of the program, the program itself is modified. Furthermore, the technique of Patent Document 1 has a problem that if a race condition does not occur during dynamic analysis of a virtual machine, it cannot be detected.

そこでこの発明は、プログラムのソースコードの記述を改変することなく、また精度良く、競合状態を発生させる命令コードの検出および修正をプログラムの製作者が容易に行うことが可能となるプログラム診断装置及びプログラム診断方法ならびにそのプログラムを提供することを目的としている。   Therefore, the present invention provides a program diagnostic apparatus that enables a program producer to easily detect and correct an instruction code that causes a race condition without altering the description of the source code of the program and with high accuracy. It is an object to provide a program diagnosis method and a program thereof.

上記目的を達成するために、本発明は、並列実行されるプログラムの共通資源へのアクセス競合状態を検出するプログラム診断装置であって、前記プログラムの入力を受け付けるプログラム入力受付手段と、前記プログラムの中間コードを生成する中間コード生成手段と、前記中間コードに記述されている命令コードを仮実行する命令コード仮実行手段と、前記仮実行の結果に基づいて、当該仮実行した命令コードと、該命令コードが読み書きを行なうオブジェクト変数の識別情報と、該命令コードの前記中間コードにおける記載位置と、他の命令コードの並列実行を許可することを示す識別子と、を関連付けた履歴テーブルを作成する履歴テーブル作成手段と、前記中間コードに基づいて、オブジェクト変数の読み書きを行なう命令コードのうち、他の命令コードの並列実行を許可することを示す識別子に関連付けられて前記履歴テーブルに記載されている命令コードを検出する命令コード検出手段と、を備えることを特徴とするプログラム診断装置である。 In order to achieve the above object, the present invention provides a program diagnostic apparatus for detecting a race condition for access to a common resource of a program executed in parallel, the program input receiving means for receiving the program input, Intermediate code generating means for generating intermediate code ; instruction code temporary execution means for temporarily executing the instruction code described in the intermediate code; based on the result of the temporary execution, the temporarily executed instruction code; and History that creates a history table that associates identification information of an object variable that an instruction code reads and writes, a description position in the intermediate code of the instruction code, and an identifier that indicates that parallel execution of other instruction codes is permitted and table creation means, instruction codes on the basis of the intermediate code, to read and write object variable Among them, the program diagnostic apparatus characterized by comprising: a command code detecting means for detecting an instruction code that is described in the history table associated with the identifier indicating the permission of the parallel execution of other instruction code, the is there.

また本発明は、上述のプログラム診断装置において、前記検出した命令コードが記述されているプログラムソースコード中の行を、当該プログラムソースコードの表示画面に表示する検出命令コード位置表示手段と、を備えることを特徴とする。 The present invention, in the above-described program analysis device, a row in the Help program source code instructions code the detection is written, the detection instruction code position display means for displaying on the display screen of the program source code, the It is characterized by providing.

また本発明は、上述のプログラム診断装置において、前記検出した命令コードに関連付けて前記履歴テーブルに記録されている中間コードの記載位置に基づいて、当該命令コードが記述されているプログラムソースコード中の行を特定する命令コード位置特定手段と、を備えることを特徴とする。 According to the present invention, in the above program analysis apparatus, the detected instruction in association with the code on the basis of the description position of the intermediate code recorded in the history table, the instruction code in the Help program source code is written And an instruction code position specifying means for specifying the line.

また本発明は、上述のプログラム診断装置において、前記履歴テーブル作成手段は、前記履歴テーブルにおいて、前記共通資源へのアクセスが出来ないよう制御する命令コードと、当該命令コードに対応する命令コードであって前記共通資源へのアクセスが出来ない制御の解除を行う命令コードの、中間コードにおける記載位置の間に記録されている命令コードについては、他の命令コードの並列実行を許可しないことを示す識別子に対応付に関連付けて記録することを特徴とするFurther, the present invention is the above-described program diagnosis apparatus, wherein the history table creation means includes an instruction code for controlling the access to the common resource in the history table and an instruction code corresponding to the instruction code. An identifier indicating that parallel execution of other instruction codes is not permitted for instruction codes recorded between the description positions in the intermediate code of the instruction codes for releasing the control that cannot access the common resource It is characterized by recording in association with correspondence .

また本発明は、並列実行されるプログラムの共通資源へのアクセス競合状態を検出するプログラム診断装置におけるプログラム診断方法であって、前記プログラムの入力を受け付け、前記プログラムの中間コードを生成し、前記中間コードに記述されている命令コードを仮実行し、前記仮実行の結果に基づいて、当該仮実行した命令コードと、該命令コードが読み書きを行なうオブジェクト変数の識別情報と、該命令コードの前記中間コードにおける記載位置と、他の命令コードの並列実行を許可することを示す識別子と、を関連付けた履歴テーブルを作成し、前記中間コードに基づいて、オブジェクト変数の読み書きを行なう命令コードのうち、他の命令コードの並列実行を許可することを示す識別子に関連付けられて前記履歴テーブルに記載されている命令コードを検出することを特徴とするプログラム診断方法である。 The present invention is a program analysis method in the program diagnosing apparatus for detecting an access conflict state to a common resource of a program to be executed in parallel, receiving the input of said program, and generates an intermediate code of said program, said intermediate An instruction code described in the code is provisionally executed, and based on the result of the provisional execution, the provisionally executed instruction code, identification information of an object variable that the instruction code reads and writes, and the intermediate of the instruction code Create a history table that associates the description position in the code with an identifier indicating that parallel execution of other instruction codes is permitted, and among other instruction codes that read and write object variables based on the intermediate code associated with the identifier indicating the permission of the parallel execution of the instruction code to the history table Is a program analysis method characterized by detecting an instruction code that is mounting.

また本発明は、並列実行されるプログラムの共通資源へのアクセス競合状態を検出するプログラム診断装置のコンピュータを、前記プログラムの入力を受け付けるプログラム入力受付手段、前記プログラムの中間コードを生成する中間コード生成手段、前記中間コードに記述されている命令コードを仮実行する命令コード仮実行手段、前記仮実行の結果に基づいて、当該仮実行した命令コードと、該命令コードが読み書きを行なうオブジェクト変数の識別情報と、該命令コードの前記中間コードにおける記載位置と、他の命令コードの並列実行を許可することを示す識別子と、を関連付けた履歴テーブルを作成する履歴テーブル作成手段、前記中間コードに基づいて、オブジェクト変数の読み書きを行なう命令コードのうち、他の命令コードの並列実行を許可することを示す識別子に関連付けられて前記履歴テーブルに記載されている命令コードを検出する命令コード検出手段、として機能させるためのプログラムである。 Further, the present invention provides a computer of a program diagnostic apparatus for detecting a race condition for access to a common resource of a program executed in parallel, program input receiving means for receiving the program input, and intermediate code generation for generating the intermediate code of the program Means for provisionally executing an instruction code described in the intermediate code, based on the result of the provisional execution, identification of the provisionally executed instruction code and an object variable to be read and written by the instruction code A history table creating means for creating a history table associating information, a description position of the instruction code in the intermediate code, and an identifier indicating that parallel execution of another instruction code is permitted , based on the intermediate code Of the instruction codes that read and write object variables, other instruction codes Is a program for functioning as an instruction code detecting means for detecting an instruction code that is described in the history table associated with the identifier indicating the permission of the parallel execution.

本発明によれば、プログラムのソースコードから中間コードを生成し、その中間コードから、メモリ参照/書き込みを示す命令コードを検出する。そして、その命令コードの仮実行において、操作する変数がアンロック状態で実行される命令コードであると判定した場合には、その命令コードが記述されているソースコードの位置を画面に表示している。従って、ユーザは、ソースコードの記述が改変されることなく、どのソースコードの位置の記述を、競合状態が発生しないように変更すべきかを検出でき、またその修正を行うことができる。また、メモリ参照/書き込みを示す命令コードを全て検出できるため、精度良く、競合状態を発生させる命令コードに対応するソースコードの位置を検出することができる。   According to the present invention, an intermediate code is generated from a source code of a program, and an instruction code indicating memory reference / write is detected from the intermediate code. When it is determined in the temporary execution of the instruction code that the variable to be operated is an instruction code executed in the unlocked state, the position of the source code in which the instruction code is described is displayed on the screen. Yes. Therefore, the user can detect and correct which source code location description should be changed so as not to cause a race condition without altering the source code description. In addition, since all instruction codes indicating memory reference / write can be detected, the position of the source code corresponding to the instruction code that causes a race condition can be detected with high accuracy.

以下、本発明の一実施形態によるプログラム診断装置を図面を参照して説明する。
図1は同実施形態によるプログラム診断装置の構成を示すブロック図である。
この図において、符号1はプログラム診断装置である。そして、プログラム診断装置1は、Webアプリケーション解析部11、診断実行部12、競合状態条件判定部13、表示部14、命令コード記憶部15、オペランドスタック16、メモリ監視履歴DB(データベース)17を備えている。
Hereinafter, a program diagnostic apparatus according to an embodiment of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing the configuration of the program diagnosis apparatus according to the embodiment.
In this figure, reference numeral 1 denotes a program diagnostic apparatus. The program diagnosis apparatus 1 includes a Web application analysis unit 11, a diagnosis execution unit 12, a race condition condition determination unit 13, a display unit 14, an instruction code storage unit 15, an operand stack 16, and a memory monitoring history DB (database) 17. ing.

そして、プログラム診断装置1は、並列実行されるプログラムの共通資源へのアクセス競合状態を、プログラムソースコード中から検出するものであり、まず、プログラムの入力を受け付ける。次に、プログラムの中間コードを生成する。そして、中間コードに基づいて、オブジェクト変数の読み書きを行なう命令コードのうち、他の命令コードの並列実行を許可する識別子に関連付けられる命令コードを検出する。さらに、検出した命令コードが記述されているプログラムソースコード中の行を、当該プログラムソースコードの表示画面に表示する処理を行う。これにより、プログラムのソースコードの記述を改変することなく、また精度良く、競合状態を発生させる命令コードの検出および修正をプログラムの製作者が容易に行うことができるよう画面をモニタへ出力している。   The program diagnostic apparatus 1 detects an access contention state to a common resource of programs executed in parallel from the program source code, and first receives an input of the program. Next, an intermediate code of the program is generated. Based on the intermediate code, an instruction code associated with an identifier that permits parallel execution of other instruction codes is detected among instruction codes for reading and writing object variables. Furthermore, a process of displaying a line in the program source code in which the detected instruction code is described on the display screen of the program source code is performed. As a result, the screen is output to the monitor so that the program producer can easily detect and correct the instruction code that causes a race condition without altering the description of the source code of the program. Yes.

図2はプログラム診断装置の処理概要を示す図である。
この図が示すように、本実施形態によるプログラム診断装置1は、Java(登録商標)言語のプログラムソースコードをJava(登録商標)言語の中間コード(バイトコード)にコンパイルし、その中間コードを用いて、ソースコードの脆弱性、つまり、並列実行されるプログラムの共通資源へのアクセス競合状態が発生しないかどうかの診断を、データベースに記録された情報に基づいて行なう。そして、Java(登録商標)言語のプログラムソースコード中の、競合状態を発生させる可能性のある命令コードに対応する記述の行に警告マーカ等を表示する処理を行う。
FIG. 2 is a diagram showing an outline of processing of the program diagnostic apparatus.
As shown in this figure, the program diagnostic apparatus 1 according to the present embodiment compiles a Java (registered trademark) language program source code into a Java (registered trademark) language intermediate code (byte code), and uses the intermediate code. Based on the information recorded in the database, a diagnosis of whether or not a vulnerability of the source code, that is, an access race state to a common resource of a program executed in parallel does not occur. Then, processing for displaying a warning marker or the like in a description line corresponding to an instruction code that may cause a race condition in the program source code of Java (registered trademark) language is performed.

ここで、本実施形態において診断を行なうプログラムは、ウェブアプリケーションサーバにおいて、クライアントからのリクエスト情報の受信に応じて処理を開始するフィルタプログラム、リスナプログラム、Java(登録商標)サーブレットプログラム、Java(登録商標)サーバページプログラム等である。これらのプログラムは、ユーザの操作するクライアント端末からリクエスト情報を受信することを契機に動作するプログラムである。電子決済サイト等では、ウェブアプリケーションサーバにおける競合状態の発生の削減を厳しくチェックする必要があり、本実施形態によるプログラム診断が特に行なわれるべきプログラムである。なお、本実施形態のプログラム診断装置1による診断方法は、ウェブアプリケーションサーバの、フィルタプログラム、リスナプログラム、Java(登録商標)サーブレットプログラム、Java(登録商標)サーバページプログラム以外の、他のサーバで動作するプログラムの競合状態の診断に用いるようにしてもよい。また、本実施形態においては、Java(登録商標)言語のプログラムソースコードをJava(登録商標)言語の中間コード(バイトコード)にコンパイルしているが、これは、中間コードがソースコードに比べて、処理情報の粒度が細かく表れており、変数やオブジェクトの状態等の属性情報が含まれるためである。これらの属性情報を利用して、精度の良い診断を実行することとなる。   Here, the diagnosis program in this embodiment is a filter program, a listener program, a Java (registered trademark) servlet program, or a Java (registered trademark) that starts processing in response to reception of request information from the client in the web application server. ) Server page program. These programs are programs that operate when receiving request information from a client terminal operated by a user. In an electronic payment site or the like, it is necessary to strictly check the reduction of the occurrence of a competitive state in the web application server, and the program diagnosis according to the present embodiment is particularly to be performed. The diagnosis method by the program diagnosis apparatus 1 of the present embodiment operates on other servers other than the filter program, listener program, Java (registered trademark) servlet program, and Java (registered trademark) server page program of the web application server. You may make it use for the diagnosis of the race condition of the program to perform. In this embodiment, the program source code in the Java (registered trademark) language is compiled into intermediate code (byte code) in the Java (registered trademark) language. This is because the intermediate code is compared with the source code. This is because the granularity of the processing information appears finely and attribute information such as variables and object states is included. By using these attribute information, a highly accurate diagnosis is executed.

図3は並列実行されるプログラムの共通資源へのアクセス競合状態の概要を示す図である。
この図が示すように、ウェブアプリケーションサーバ上で2つのスレッドが実行された場合、ある共通資源(変数やオブジェクト等)が両方のスレッドからのアクセスを受け付け可能な状態(アンロック(Unlock)状態)となっている場合、アクセス競合状態が発生し、共通資源の持つデータ値が所望の値と異なってしまう可能性がある。従って、一方の1つのスレッドがある共通資源にアクセスしている場合には、その命令コードによっては、他の1つ又は複数のスレッドが、その共通資源へのアクセスができないような状態(ロック(Lock)状態)に制御することが必要となる。そして、プログラム中から、競合状態が発生する可能性のある共通資源へのアクセス処理を行っている記述がみつかれば、その箇所が、競合状態の発生する可能性のプログラム中の記述であると判定することができる。
FIG. 3 is a diagram showing an outline of a contention state of access to common resources of programs executed in parallel.
As shown in this figure, when two threads are executed on the web application server, a certain common resource (variable, object, etc.) can accept access from both threads (Unlock state) In such a case, an access contention state may occur, and the data value of the common resource may be different from the desired value. Therefore, when one of the threads is accessing a common resource, depending on the instruction code, the other one or more threads may not be able to access the common resource (lock ( Lock) state). If a description is found in the program that performs access processing to a common resource that may cause a race condition, the location is a description in the program that may cause a race condition. Can be determined.

図4はプログラム診断装置の処理フローを示す第1の図である。
次に、プログラム診断装置1の処理フローの全体像について説明する。まず、ウェブアプリケーション解析部11が、ウェブアプリケーションサーバを構成する全てのソースファイルから、全ての「ユーザリクエスト受信時処理開始メソッド」を読み込む(ステップS1)。この「ユーザリクエスト受信時処理開始メソッド」は、ウェブアプリケーションサーバの、フィルタプログラム、リスナプログラム、Java(登録商標)サーブレットプログラム、Java(登録商標)サーバページプログラム等の、ユーザ端末からのリクエスト情報を受け付けて、処理を開始するクラス内に含まれている。ここでメソッドとは、オブジェクト指向プログラミングにおいて、各オブジェクトが持っている自身に対する操作命令のコマンドを記述したプログラムである。
FIG. 4 is a first diagram showing a processing flow of the program diagnosis apparatus.
Next, an overview of the processing flow of the program diagnostic apparatus 1 will be described. First, the web application analysis unit 11 reads all “user request reception process start methods” from all source files constituting the web application server (step S1). This “user request reception process start method” accepts request information from a user terminal such as a filter program, a listener program, a Java (registered trademark) servlet program, a Java (registered trademark) server page program of the web application server. Is included in the class that starts the process. Here, the method is a program in which a command of an operation instruction for each object possessed by each object is described in object-oriented programming.

そして、ウェブアプリケーション解析部11は、1つの「ユーザリクエスト受信時処理開始メソッド」から、「実行モジュール群」を生成する(ステップS2)。そして、ウェブアプリケーション解析部11は生成した「実行モジュール群」が含まれるソースコードがコンパイル済みかを判定し(ステップS3)、コンパイルされていなければ、そのソースコードをコンパイルして中間コードを生成する(ステップS31)。そして、ウェブアプリケーション解析部11は、中間コードに記述されている命令コードを、ユーザ端末からのリクエスト情報に対応して実行する処理の順に、命令コード記憶部15に格納する(ステップS4)。   Then, the web application analysis unit 11 generates an “execution module group” from one “user request reception process start method” (step S2). Then, the web application analysis unit 11 determines whether the generated source code including the “execution module group” has been compiled (step S3), and if not compiled, compiles the source code to generate an intermediate code. (Step S31). Then, the web application analysis unit 11 stores the instruction code described in the intermediate code in the instruction code storage unit 15 in the order of processing executed in response to request information from the user terminal (step S4).

次に、診断実行部12が、命令コード記憶部15から命令コードを読み込み、オペランドスタック16上でエミュレート実行(擬似実行)させ、ウェブアプリケーションが使用する共有メモリの操作を行う命令コード(メモリ操作命令コード)のバイトコード位置(命令コードの中間(バイト)コード内のメソッドの先頭を0とした何バイト目かを示す値)を命令コード記憶部15から読み込む(ステップS5)。そして診断実行部12は、メモリ操作命令コードのバイトコード位置と、メモリ操作命令コードによって変更される共有メモリの状態などの履歴をメモリ監視履歴DB17のメモリ監視履歴テーブルに書き込む(ステップS6)。次に、競合状態条件判定部13が、メモリ監視履歴テーブルを読み込み、競合条件(オブジェクト変数の読み書きを行なう命令コードのうち、他の命令コードの並列実行を許可する識別子に関連付けられて記録されている命令コードかどうかの条件)が、真となる変数に対応したメモリ操作命令コードのバイトコード位置を読み込む(ステップS7)。そして、競合状態条件判定部13の読み込んだメモリ操作命令コードのバイトコード位置から、実行モジュール群の位置情報を計算し、表示部14へ通知する(ステップS8)。また表示部14では、モニタなどの外部表示装置へ、実行モジュール群の位置情報を出力する(ステップS9)。   Next, the diagnosis execution unit 12 reads the instruction code from the instruction code storage unit 15, performs emulation execution (pseudo execution) on the operand stack 16, and operates the shared memory used by the web application (memory operation) The byte code position (instruction code) (a value indicating the number of bytes with the head of the method in the middle (byte) code of the instruction code as 0) is read from the instruction code storage unit 15 (step S5). Then, the diagnosis execution unit 12 writes the history such as the byte code position of the memory operation instruction code and the state of the shared memory changed by the memory operation instruction code in the memory monitoring history table of the memory monitoring history DB 17 (step S6). Next, the race condition condition determination unit 13 reads the memory monitoring history table and records the race condition (associated with an identifier that permits parallel execution of other instruction codes among instruction codes for reading and writing object variables). Read the byte code position of the memory operation instruction code corresponding to the variable for which the condition code is true (step S7). Then, the position information of the execution module group is calculated from the byte code position of the memory operation instruction code read by the race condition condition determination unit 13 and notified to the display unit 14 (step S8). The display unit 14 outputs the position information of the execution module group to an external display device such as a monitor (step S9).

次に、上記ステップS1〜ステップS9の処理の詳細について説明する。
図5はプログラム診断装置の処理フローを示す第2の図である。
この図より、上記ステップS1においては、まず、ウェブアプリケーション解析部11が、ウェブアプリケーションを構成するソースファイルが格納されたディレクトリ・パスを読み込む(ステップS11)。そしてウェブアプリケーション解析部11は、そのディレクトリ・パス配下に格納されているウェブアプリケーション配備記述子(デプロイメントディスクリプタ)を読み込み、その記述子から、ウェブアプリケーションサーバの、フィルタプログラム、リスナプログラム、Java(登録商標)サーブレットプログラム、Java(登録商標)サーバページプログラムの各名称を読み込む(ステップS12)。また、ウェブアプリケーション解析部11は、名称を特定した対象ソースファイル(ウェブアプリケーションを構成するソースファイル)から、ステップS12で特定した名称を持つクラスのスーパークラスを求め、そのスーパークラスごとに、「ユーザリクエスト受信時処理開始メソッド一覧」で定義されたメソッドを、「ユーザリクエスト受信時処理開始メソッド」としてメモリへ保存する(ステップS13)。
Next, the details of the processing in steps S1 to S9 will be described.
FIG. 5 is a second diagram showing a processing flow of the program diagnosis apparatus.
As shown in the figure, in step S1, the web application analysis unit 11 first reads a directory / path in which source files constituting the web application are stored (step S11). Then, the web application analysis unit 11 reads the web application deployment descriptor (deployment descriptor) stored under the directory / path, and from the descriptor, the web application server filter program, listener program, Java (registered trademark). ) The names of the servlet program and the Java (registered trademark) server page program are read (step S12). Further, the web application analysis unit 11 obtains a superclass of the class having the name specified in step S12 from the target source file (namely, the source file constituting the web application) for which the name is specified. The method defined in “Request reception process start method list” is stored in the memory as “User request reception process start method” (step S13).

図6はユーザリクエスト受信時処理開始メソッド一覧を示す図である。
「ユーザリクエスト受信時処理開始メソッド一覧」は、予め記憶部等で記憶しており、図6で示すように、クラスごとに1つまたは複数のメソッドが記述されている。
FIG. 6 is a diagram showing a list of methods for starting processing when a user request is received.
The “user request reception process start method list” is stored in advance in a storage unit or the like, and one or more methods are described for each class as shown in FIG.

図7はプログラム診断装置の処理フローを示す第3の図である。
次に、上記ステップS2においては、まず、ウェブアプリケーション解析部11が、ステップS13においてメモリへ保存した「ユーザリクエスト受信時処理開始メソッド」のリストから1つのメソッドを読み込む(ステップS21)。そして、ウェブアプリケーション解析部11は、そのメソッド内で実行される全ての命令コードを読み込み、命令コードのリストを生成する(ステップS22)。次にウェブアプリケーション解析部11は、命令コードのリストを「実行モジュール群(「ユーザリクエスト受信時処理開始メソッド」を始点とした一連の処理内で実行されるメソッド内の命令コードの集合)」としてメモリ内のデータテーブルに一時的に追加記録する(ステップS23)。そして、ウェブアプリケーション解析部11は、メモリに一時記録されたデータテーブルにおいて、実行モジュール群における命令コードのリストが空かどうかを判定し(ステップS24)、空であれば、処理を終了し、空でなければ、命令コードのリストから1つの命令コードを読み込む(ステップS25)。そして命令コードがメソッド呼び出しを実行する命令コードかを判定する(ステップS26)。メソッド呼び出しを実行する命令コードでなければ、ステップS25に戻り、次の命令コードを読み込む。またメソッド呼び出しを実行する命令コードであれば、呼び出したメソッド(他のメソッド)についてステップS22以降の処理を再帰的に実行する(ステップS27)。
FIG. 7 is a third diagram showing a processing flow of the program diagnosis apparatus.
Next, in step S2, first, the web application analysis unit 11 reads one method from the list of “user request reception process start method” stored in the memory in step S13 (step S21). Then, the web application analysis unit 11 reads all instruction codes executed in the method and generates a list of instruction codes (step S22). Next, the web application analysis unit 11 sets a list of instruction codes as “execution module group (a set of instruction codes in a method executed in a series of processes starting from“ user request reception process start method ”)”. It is additionally recorded temporarily in the data table in the memory (step S23). Then, the web application analysis unit 11 determines whether the instruction code list in the execution module group is empty in the data table temporarily recorded in the memory (step S24). Otherwise, one instruction code is read from the instruction code list (step S25). Then, it is determined whether the instruction code is an instruction code for executing a method call (step S26). If the instruction code does not execute the method call, the process returns to step S25 to read the next instruction code. If it is an instruction code for executing a method call, the process after step S22 is recursively executed for the called method (other method) (step S27).

そして、上記ステップS3,ステップS31、ステップS4で示したように、ウェブアプリケーション解析部11は生成した「実行モジュール群」が含まれるソースコードがコンパイル済みかを判定し、コンパイルされていなければ、そのソースコードをコンパイルして中間コードを生成する。そして、ウェブアプリケーション解析部11は、中間コードに記述されている命令コードを、ユーザ端末からのリクエスト情報に対応して実行する処理の順に、命令コード記憶部15に格納する。   Then, as shown in steps S3, S31, and S4, the web application analysis unit 11 determines whether the generated source code including the “execution module group” has been compiled. Compile source code to generate intermediate code. Then, the web application analysis unit 11 stores the instruction code described in the intermediate code in the instruction code storage unit 15 in the order of processing to be executed in response to request information from the user terminal.

図8は命令コード記憶部内に格納されるデータ例<中間(バイト)コード>を示す図である。
この図で示すように、命令コード記憶部15の中間(バイト)コードのテーブルにおいて、ウェブアプリケーション解析部11によって格納された命令コードが記述される。各命令コードは1バイト単位で記録され、各命令コードに対応付けて、その1バイト単位の順番を示すバイトコード位置(命令コードの中間(バイト)コード内のメソッドの先頭を0とした何バイト目かを示す値)が記録される。なお、命令コード記憶部15における命令コードのバイトコード位置と、ウェブアプリケーションのソースコードにおける記述位置(行番号)が、中間(バイト)コードに記述されているものとする。
FIG. 8 is a diagram illustrating an example of data <intermediate (byte) code> stored in the instruction code storage unit.
As shown in this figure, the instruction code stored by the web application analysis unit 11 is described in the intermediate (byte) code table of the instruction code storage unit 15. Each instruction code is recorded in 1-byte units, and associated with each instruction code is the byte code position indicating the order of the 1-byte unit (how many bytes with the beginning of the method in the middle (byte) code of the instruction code set to 0) A value indicating whether or not the eye is recorded). It is assumed that the bytecode position of the instruction code in the instruction code storage unit 15 and the description position (line number) in the source code of the web application are described in the intermediate (byte) code.

図9はプログラム診断装置の処理フローを示す第4の図である。
図10はプログラム診断装置の処理フローを示す第5の図である。
次に、上述のステップS5においては、まず、診断実行部12が、オペランドスタック16上において命令コードのエミュレート実行(擬似実行)を指示されると、命令コード記憶部15に記録されているデータテーブルから1つの命令コードを読み取る。そして、診断実行部12は、読み取った命令コードが、クラス変数(オブジェクト変数)の参照またはそのクラス変数への書き込みを行なうコード(getstaticまたはputstaticか?)かどうかを判定する(ステップS51)。そして、Yesであれば、共有メモリの操作を行う命令コードであると判定し、Noであれば、共有メモリの操作を行う命令コードでないと判定する。また診断実行部12は、読み取った命令コードが、インスタンス変数(オブジェクト変数)の参照またはそのインスタンス変数への書き込みを行なうコード(getfieldまたはputfieldか?)かどうかを判定する(ステップS52)。また診断実行部12は、読み取った命令コードの参照または書き込み対象となるインスタンス変数(オブジェクト変数)が、ウェブアプリケーションのインスタンスかどうかを判定する(ステップS53)。これは命令コードの第1引数が表す判別情報で判別する。そして、ステップS53でYesであれば、共有メモリの操作(参照/書き込み)を行う命令コードであると判定する。また、ステップS52でNoまたはステップS53でNoと判定した場合には、共有メモリの操作を行う命令コードでないと判定する。
FIG. 9 is a fourth diagram showing a processing flow of the program diagnostic apparatus.
FIG. 10 is a fifth diagram showing a processing flow of the program diagnostic apparatus.
Next, in step S5 described above, first, when the diagnosis execution unit 12 is instructed to emulate (pseudo execution) the instruction code on the operand stack 16, the data recorded in the instruction code storage unit 15 is recorded. One instruction code is read from the table. Then, the diagnosis execution unit 12 determines whether or not the read instruction code is a code (getstatic or putstatic?) That refers to or writes to the class variable (object variable) (step S51). If Yes, it is determined that the instruction code is for operating the shared memory, and if No, it is determined that the instruction code is not for operating the shared memory. The diagnosis execution unit 12 determines whether the read instruction code is a code (getfield or putfield?) For referring to or writing to the instance variable (object variable) (step S52). Further, the diagnosis execution unit 12 determines whether the instance variable (object variable) to be referred to or written to the read instruction code is an instance of the web application (step S53). This is determined by the determination information represented by the first argument of the instruction code. If Yes in step S53, it is determined that the instruction code is for operating (referencing / writing) the shared memory. Further, when it is determined No in step S52 or No in step S53, it is determined that the instruction code is not for operating the shared memory.

次に診断実行部12は、共有メモリの操作を行う命令コードであると判定された命令コードを順に読み込む(ステップS501)。そして、診断実行部12は、読み込んだ命令コードのバイトコード位置を、命令コード記憶部15から読み込む(ステップS502)。そして、そのバイトコード位置を出力する(ステップS503)。共有メモリの操作を行う命令コードであると判定された命令コードと、そのバイトコード位置は、一時的にメモリ等に格納される。   Next, the diagnosis execution unit 12 sequentially reads instruction codes determined to be instruction codes for operating the shared memory (step S501). Then, the diagnosis execution unit 12 reads the byte code position of the read instruction code from the instruction code storage unit 15 (step S502). Then, the byte code position is output (step S503). The instruction code determined to be an instruction code for operating the shared memory and its byte code position are temporarily stored in a memory or the like.

図11はプログラム診断装置の処理フローを示す第6の図である。
次に、診断実行部12は、前記一時的にメモリに格納された、共有メモリの操作を行う命令コードであると判定された命令コードを取得する(ステップS61)。そして、その命令コードがメモリ参照を示す命令コード(getstatic/putstatic/getfield/putfield)かを判定する(ステップS62)。そしてYesの場合は、ステップS51〜ステップS53の処理により、共有メモリの操作(参照/書き込み)を行う命令コードと判定されているかの情報がTrueであれば、その命令コードと、そのバイトコード位置を対応付けて、メモリ監視履歴DB内のメモリ監視履歴テーブルに対応付けて書き込む(ステップS63)。そして、その命令コードが、命令コードの実行時に共通資源へのアクセスができないよう制御するロックコマンド(monitorenter)によってロックされるかを判定する(ステップS64)。そして、ロックされる場合であれば、下記に説明するロック/ロック解除対象の変数取得処理によって取得した変数と、その変数が「ロック状態」である旨を示す情報とを対応付けて、メモリ監視履歴テーブルに書き込む(ステップS64)。
FIG. 11 is a sixth diagram illustrating a processing flow of the program diagnostic apparatus.
Next, the diagnosis execution unit 12 acquires an instruction code that is determined to be an instruction code for operating the shared memory, which is temporarily stored in the memory (step S61). Then, it is determined whether the instruction code is an instruction code indicating a memory reference (getstatic / putstatic / getfield / putfield) (step S62). In the case of Yes, if the information indicating whether or not the instruction code for performing the operation (referencing / writing) of the shared memory is True by the processing in steps S51 to S53, the instruction code and the byte code position thereof are determined. Are associated and written in the memory monitoring history table in the memory monitoring history DB (step S63). Then, it is determined whether or not the instruction code is locked by a lock command (monitorenter) that controls to prevent access to the common resource when the instruction code is executed (step S64). If it is locked, the memory acquired by the variable / unlock target acquisition process described below is associated with the information indicating that the variable is “locked state” to monitor the memory. Write to the history table (step S64).

また命令コードが、命令コードの実行時に共通資源へのアクセスができない制御の解除を示すロック解除コマンド(monitorexit)によってロック解除されたかを判定する(ステップS65)。そして、ロック解除コマンドによってロック解除されたと判定できれば、下記に説明するロック/ロック解除対象の変数取得処理によって取得した変数と、その変数が「アンロック状態」である旨を示す情報とを対応付けて、メモリ監視履歴テーブルに書き込む(ステップS66)。そして、実行モジュール群の全ての命令コードについて、仮実行を完了したかを判定し(ステップS67)、全ての命令コードについて仮実行の完了を判定した場合には処理を終了する。   Further, it is determined whether or not the instruction code has been unlocked by a lock release command (monitorexit) indicating release of control that cannot access the common resource when the instruction code is executed (step S65). If it can be determined that the lock has been released by the lock release command, the variable acquired by the lock / unlock target acquisition process described below is associated with the information indicating that the variable is “unlocked” Is written in the memory monitoring history table (step S66). Then, it is determined whether or not provisional execution has been completed for all instruction codes in the execution module group (step S67). If it is determined that provisional execution has been completed for all instruction codes, the process ends.

図12はプログラム診断装置の処理フローを示す第7の図である。
図12は、上述のロック/ロック解除対象の変数取得処理を示す図である。この処理においてはロックコマンド(monitorenter)またはロック解除コマンド(monitorexit)である場合には、その命令コードを読み込む(ステップS601)。そして、オペランドスタック16から変数名を読み取り(ステップS602)、その変数名を出力する(ステップS603)
FIG. 12 is a seventh diagram showing the processing flow of the program diagnostic apparatus.
FIG. 12 is a diagram showing the above-described lock / unlock target variable acquisition process. In this process, if the command is a lock command (monitorenter) or an unlock command (monitorexit), the instruction code is read (step S601). Then, the variable name is read from the operand stack 16 (step S602), and the variable name is output (step S603).

図13はメモリ監視履歴テーブルの例を示す図である。
この図が示すように、メモリ監視履歴テーブルは、共有メモリの操作を行う命令コードであると判定された命令コードと、そのバイトコード位置と、その命令コードが操作する共通資源である変数(オブジェクト)と、その命令コードの実行時に当該変数がロック状態となるかアンロック状態となるかを示す状態の情報と、を対応付けて記憶するテーブルである。
FIG. 13 is a diagram illustrating an example of a memory monitoring history table.
As shown in this figure, the memory monitoring history table includes an instruction code determined to be an instruction code for operating a shared memory, its byte code position, and a variable (object) that is a common resource operated by the instruction code. ) And information on a state indicating whether the variable is in a locked state or an unlocked state when the instruction code is executed.

図14はメモリ監視履歴テーブルと競合条件の判定処理の概要を示す図である。
図14に示すように、本実施形態においては、メモリ参照を示す命令コードは、putfield(インスタンス変数に値を格納)、getfield(インスタンス変数から値を取得)、putstatic(クラス変数に値を格納)、getstatic(クラス変数から値を取得)のいずれかであり、これらの命令コードと、その命令コードの実行時において共通資源である変数(オブジェクト)が「アンロック状態」となることを示す情報がメモリ監視履歴テーブルに対応付けられている場合にのみ、その命令コードが競合状態を発生する可能性があると判定する。なお、monitorenter(モニタ開始)と、monitorexit(モニタ終了)は、Java(登録商標)言語で記述されたソースコードにおいて「synchronized修飾子」の記述をバイトコードに変換したものである。
FIG. 14 is a diagram showing an outline of the memory monitoring history table and the competition condition determination process.
As shown in FIG. 14, in this embodiment, instruction codes indicating memory references are putfield (a value is stored in an instance variable), getfield (a value is acquired from an instance variable), putstatic (a value is stored in a class variable) , Getstatic (obtains a value from a class variable), and information indicating that these instruction codes and variables (objects) that are common resources at the time of execution of the instruction codes are in an “unlocked state” Only when the instruction code is associated with the memory monitoring history table, it is determined that the instruction code may cause a race condition. Note that monitorenter (monitor start) and monitorexit (monitor end) are obtained by converting the description of “synchronized qualifier” into byte code in the source code described in the Java (registered trademark) language.

そして、monitorenterと、monitorexitの命令コードの間のバイトコード位置に命令コード記憶部15に記録される全ての命令コードは、その命令コードの実行時において、共通資源に対して必ずロック状態とするものであるため、メモリ監視履歴テーブルにおいては、monitorenterとmonitorexitの間に入る命令コードの操作する変数の状態は、全て「ロック状態」を示す状態の情報が登録されることとなる。monitorenterとmonitorexitの組合せが複数ある場合には、monitorenterがメモリ監視履歴テーブルに記述される数と、その後monitorexitがメモリ監視履歴テーブルに記述される数によって、monitorenterとmonitorexitの組合せが全て出現したかを判定し、それらの組合せの間の命令コードの操作する変数の状態は全て「ロック状態」となり、monitorenterとmonitorexitの組合せの出現が終了したと判定した後は、「アンロック状態」である旨を示す情報が登録される。   All instruction codes recorded in the instruction code storage unit 15 at the byte code position between the monitorenter and the monitorexit instruction code are always locked to the common resource when the instruction code is executed. Therefore, in the memory monitoring history table, all the status information indicating the “locked status” is registered for the statuses of the variables operated by the instruction code between the monitorenter and the monitorexit. If there are multiple combinations of monitorenter and monitorexit, check whether all combinations of monitorenter and monitorexit appear according to the number of monitorenter described in the memory monitoring history table and the number of monitorexit described in the memory monitoring history table. After determining that all the states of the variables operated by the instruction codes between the combinations are in the “locked state” and determining that the combination of the monitorenter and the monitorexit has ended, it is in the “unlocked state”. The information shown is registered.

図15はオペランドスタック上での命令コード仮実行による状態取得の概要を示す図である。
この図が示すように、まず、Java(登録商標)のソースコードをバイトコードに変換する。そして、バイトコード上にはLockまたはUnlockの情報が静的に記述されていない。しかしながら、このバイトコード中の各命令コードを実行するにあたり、ソースコード中のshynchronized識別子に対応するバイトコード内の命令コードがmonitorengerとなり、この命令コードにより、変数(オブジェクト)の状態がLockされたと判定している。
FIG. 15 is a diagram showing an outline of status acquisition by instruction code temporary execution on the operand stack.
As shown in this figure, first, Java (registered trademark) source code is converted into byte code. In addition, Lock or Unlock information is not statically described on the bytecode. However, when executing each instruction code in this byte code, the instruction code in the byte code corresponding to the shynchronized identifier in the source code becomes a monitorenger, and it is determined that the variable (object) state is locked by this instruction code. is doing.

図16はプログラム診断装置の処理フローを示す第8の図である。
次に、上述のステップS7においては、まず、競合状態条件判定部13が、メモリ監視履歴DB17に格納されているメモリ監視履歴テーブルから1つの命令コードのレコードを読み込む(ステップS701)。そして、命令コードが、メモリ参照を示す命令コードのgetstatic、putstatic、getfield、putfieldのいずれかであり、かつ、その命令コードの実行時において操作する変数がアンロック状態である旨を示す情報(Unlock)と対応付けられてレコードに記録されているかを判定する(ステップS702)。そして、Yesの場合には、競合状態の発生する可能性があり危険であると判断し、その命令コードに対応付けられて記録されているバイトコード位置をメモリ監視履歴テーブルから読み取ってメモリ等に一時記録しておく(ステップS703)。そして、メモリ監視履歴テーブルに記録されている全ての命令コードのレコードについて処理を行ったかを判定し(ステップS704)、処理が終了していなければ、ステップS701〜S704の処理を繰り返す。
FIG. 16 is an eighth diagram showing the processing flow of the program diagnostic apparatus.
Next, in step S7 described above, first, the race condition condition determination unit 13 reads a record of one instruction code from the memory monitoring history table stored in the memory monitoring history DB 17 (step S701). Information indicating that the instruction code is one of the getcode, putstatic, getfield, and putfield instruction codes indicating the memory reference, and that the variable to be operated at the time of executing the instruction code is in the unlocked state (Unlock ) And whether it is recorded in the record (step S702). In the case of Yes, it is determined that there is a possibility of a race condition and it is dangerous, and the byte code position recorded in association with the instruction code is read from the memory monitoring history table and stored in the memory or the like. Temporary recording is performed (step S703). Then, it is determined whether or not processing has been performed for all instruction code records recorded in the memory monitoring history table (step S704). If processing has not ended, the processing of steps S701 to S704 is repeated.

図17はプログラム診断装置の処理フローを示す第9の図である。
次に、上述のステップS8においては、まず、競合状態条件判定部13が、ステップS703で一時的にメモリ等に記録された、メモリ参照を示す命令コードであって操作する変数がアンロック状態である旨を示す命令コードのバイトコード位置を読み取る(ステップS81)。そして、処理対象のウェブアプリケーションを構成するソースファイル(フィルタプログラム、リスナプログラム、Java(登録商標)サーブレットプログラム、Java(登録商標)サーバページプログラムのいずれかのソースファイル)における、バイトコード位置に対応する、ソースコード内の記述位置(行番号)を読み込む(ステップS82)。例えば、上述したように、命令コード記憶部15における命令コードのバイトコード位置と、ウェブアプリケーションのソースコードにおける記述位置(行番号)が、中間(バイト)コードに格納されているので、この中間(バイト)コードから読み込むようにすれば良い。そして、そのソースコード位置を表示部14に出力する(ステップS83)。そして、ステップS9の処理において、表示部14が、モニタなどの外部表示装置へ、競合状態の発生する可能性があると検出した命令コードが記述されているプログラムソースコード中の行を、当該プログラムソースコードの表示画面に表示して外部表示装置へ出力する処理を行う。
FIG. 17 is a ninth diagram illustrating the processing flow of the program diagnostic apparatus.
Next, in step S8 described above, first, the race condition condition determination unit 13 is an instruction code indicating a memory reference, which is temporarily recorded in a memory or the like in step S703, and the variable to be operated is in an unlocked state. The byte code position of the instruction code indicating the presence is read (step S81). Then, it corresponds to a bytecode position in a source file (a source file of any one of a filter program, a listener program, a Java (registered trademark) servlet program, and a Java (registered trademark) server page program) constituting a processing target web application. The description position (line number) in the source code is read (step S82). For example, as described above, the byte code position of the instruction code in the instruction code storage unit 15 and the description position (line number) in the source code of the web application are stored in the intermediate (byte) code. Byte) code should be read. Then, the source code position is output to the display unit 14 (step S83). Then, in the process of step S9, the line in the program source code in which the instruction code that the display unit 14 has detected that there is a possibility of a race condition is displayed on the external display device such as a monitor is displayed as the program. Display on the source code display screen and output to the external display device.

図18は表示画面の例を示す図である。
図18で示すように、表示画面にはソースコード中に警告マーカが表示される。この警告マーカは、当該マーカが付される行のプログラムの記述が、競合状態の発生する可能性があることを示している。ユーザはこの行にsynchronized修飾子を記述することにより、警告マーカが付されている箇所の記述により競合が発生することを回避する。そして、再度、プログラム診断装置1によって診断を行なうことにより、警告マーカが外れた表示画面が出力されることとなる。また、表示画面では、図18の左下の子画面で示すように、検出結果としてソースコードの行数と、競合状態の発生確度とを示す一覧の画面を表示するようにしてもよい。
FIG. 18 shows an example of a display screen.
As shown in FIG. 18, a warning marker is displayed in the source code on the display screen. This warning marker indicates that the description of the program in the line to which the marker is attached may cause a race condition. By describing the synchronized qualifier on this line, the user avoids the occurrence of contention due to the description of the location where the warning marker is attached. Then, the diagnosis is performed again by the program diagnosis apparatus 1, and the display screen from which the warning marker is removed is output. Further, on the display screen, as shown in the lower left child screen of FIG. 18, a list screen showing the number of lines of the source code and the occurrence probability of the race condition may be displayed as the detection result.

以上、本発明の実施形態について説明したが、上述の処理によれば、Java(登録商標)言語のソースコードから中間コードを生成し、その中間コードから、メモリ参照/書き込みを示す命令コードを検出する。そして、その命令コードの仮実行において、操作する変数がアンロック状態で実行される命令コードであると判定した場合には、その命令コードが記述されているソースコードの位置を画面に表示している。従って、ユーザは、ソースコードの記述が改変されることなく、どのソースコードの位置の記述を、競合状態が発生しないように変更すべきかを検出でき、またその修正を行うことができる。また、メモリ参照/書き込みを示す命令コード全て検出できるため、精度良く、競合状態の発生させる命令コードに対応するソースコードの位置を検出することができる。   As described above, the embodiments of the present invention have been described. According to the above-described processing, an intermediate code is generated from a Java (registered trademark) language source code, and an instruction code indicating memory reference / write is detected from the intermediate code. To do. When it is determined in the temporary execution of the instruction code that the variable to be operated is an instruction code executed in the unlocked state, the position of the source code in which the instruction code is described is displayed on the screen. Yes. Therefore, the user can detect and correct which source code location description should be changed so as not to cause a race condition without altering the source code description. Further, since all instruction codes indicating memory reference / write can be detected, the position of the source code corresponding to the instruction code causing the race condition can be detected with high accuracy.

なお、上述のプログラム診断装置は内部に、コンピュータシステムを有している。そして、上述した各処理の過程は、プログラムの形式でコンピュータ読み取り可能な記録媒体に記憶されており、このプログラムをコンピュータが読み出して実行することによって、上記処理が行われる。ここでコンピュータ読み取り可能な記録媒体とは、磁気ディスク、光磁気ディスク、CD−ROM、DVD−ROM、半導体メモリ等をいう。また、このコンピュータプログラムを通信回線によってコンピュータに配信し、この配信を受けたコンピュータが当該プログラムを実行するようにしても良い。   The above-described program diagnosis apparatus has a computer system inside. Each process described above is stored in a computer-readable recording medium in the form of a program, and the above process is performed by the computer reading and executing the program. Here, the computer-readable recording medium means a magnetic disk, a magneto-optical disk, a CD-ROM, a DVD-ROM, a semiconductor memory, or the like. Alternatively, the computer program may be distributed to the computer via a communication line, and the computer that has received the distribution may execute the program.

また、上記プログラムは、前述した機能の一部を実現するためのものであっても良い。さらに、前述した機能をコンピュータシステムにすでに記録されているプログラムとの組み合わせで実現できるもの、いわゆる差分ファイル(差分プログラム)であっても良い。   The program may be for realizing a part of the functions described above. Furthermore, what can implement | achieve the function mentioned above in combination with the program already recorded on the computer system, and what is called a difference file (difference program) may be sufficient.

プログラム診断装置の構成を示すブロック図である。It is a block diagram which shows the structure of a program diagnostic apparatus. プログラム診断装置の処理概要を示す図である。It is a figure which shows the process outline | summary of a program diagnostic apparatus. 並列実行されるプログラムの共通資源へのアクセス競合状態の概要を示す図である。It is a figure which shows the outline | summary of the access competition state to the common resource of the program performed in parallel. プログラム診断装置の処理フローを示す第1の図である。It is a 1st figure which shows the processing flow of a program diagnostic apparatus. プログラム診断装置の処理フローを示す第2の図である。It is a 2nd figure which shows the processing flow of a program diagnostic apparatus. ユーザリクエスト受信時処理開始メソッド一覧を示す図である。It is a figure which shows the process start method list at the time of user request reception. プログラム診断装置の処理フローを示す第3の図である。It is a 3rd figure which shows the processing flow of a program diagnostic apparatus. 命令コード記憶部内に格納されるデータ例<中間(バイト)コード>を示す図である。It is a figure which shows the example of data <intermediate (byte) code> stored in an instruction code memory | storage part. プログラム診断装置の処理フローを示す第4の図である。It is a 4th figure which shows the processing flow of a program diagnostic apparatus. プログラム診断装置の処理フローを示す第5の図である。It is a 5th figure which shows the processing flow of a program diagnostic apparatus. プログラム診断装置の処理フローを示す第6の図である。It is a 6th figure which shows the processing flow of a program diagnostic apparatus. プログラム診断装置の処理フローを示す第7の図である。It is a 7th figure which shows the processing flow of a program diagnostic apparatus. メモリ監視履歴テーブルの例を示す図である。It is a figure which shows the example of a memory monitoring log | history table. メモリ監視履歴テーブルと競合条件の判定処理の概要を示す図である。It is a figure which shows the outline | summary of a memory monitoring history table and the determination process of a competition condition. オペランドスタック上での命令コード仮実行による状態取得の概要を示す図である。It is a figure which shows the outline | summary of the state acquisition by the instruction code temporary execution on an operand stack. プログラム診断装置の処理フローを示す第8の図である。It is an 8th figure which shows the processing flow of a program diagnostic apparatus. プログラム診断装置の処理フローを示す第9の図である。It is a 9th figure which shows the processing flow of a program diagnostic apparatus. 表示画面の例を示す図である。It is a figure which shows the example of a display screen. ウェブサーバにおける競合状態を示す図である。It is a figure which shows the competition state in a web server.

符号の説明Explanation of symbols

1・・・プログラム診断装置
11・・・ウェブアプリケーション解析部
12・・・診断実行部
13・・・競合状態条件判定部
14・・・表示部
15・・・命令コード記憶部
16・・・オペランドスタック
17・・・メモリ監視履歴DB
DESCRIPTION OF SYMBOLS 1 ... Program diagnostic apparatus 11 ... Web application analysis part 12 ... Diagnosis execution part 13 ... Competition condition condition determination part 14 ... Display part 15 ... Instruction code memory | storage part 16 ... Operand Stack 17 ... Memory monitoring history DB

Claims (6)

並列実行されるプログラムの共通資源へのアクセス競合状態を検出するプログラム診断装置であって、
前記プログラムの入力を受け付けるプログラム入力受付手段と、
前記プログラムの中間コードを生成する中間コード生成手段と、
前記中間コードに記述されている命令コードを仮実行する命令コード仮実行手段と、
前記仮実行の結果に基づいて、当該仮実行した命令コードと、該命令コードが読み書きを行なうオブジェクト変数の識別情報と、該命令コードの前記中間コードにおける記載位置と、他の命令コードの並列実行を許可することを示す識別子と、を関連付けた履歴テーブルを作成する履歴テーブル作成手段と、
前記中間コードに基づいて、オブジェクト変数の読み書きを行なう命令コードのうち、他の命令コードの並列実行を許可することを示す識別子に関連付けられて前記履歴テーブルに記載されている命令コードを検出する命令コード検出手段と、
を備えることを特徴とするプログラム診断装置。
A program diagnostic device for detecting a race condition for access to a common resource of a program executed in parallel,
Program input receiving means for receiving input of the program;
Intermediate code generating means for generating intermediate code of the program;
An instruction code provisional execution means for provisionally executing the instruction code described in the intermediate code;
Based on the result of the provisional execution, the provisionally executed instruction code, the identification information of the object variable that the instruction code reads and writes, the description position of the instruction code in the intermediate code, and the parallel execution of other instruction codes A history table creating means for creating a history table in association with an identifier indicating that
An instruction for detecting an instruction code described in the history table in association with an identifier indicating that parallel execution of other instruction codes is permitted among instruction codes for reading and writing object variables based on the intermediate code Code detection means;
A program diagnostic apparatus comprising:
前記検出した命令コードが記述されているプログラムソースコード中の行を、当該プログラムソースコードの表示画面に表示する検出命令コード位置表示手段と、
を備えることを特徴とする請求項1に記載のプログラム診断装置。
The lines in Help program source code instructions code the detection is written, the detection instruction code position display means for displaying on the display screen of the program source code,
The program diagnostic apparatus according to claim 1, further comprising:
前記検出した命令コードに関連付けて前記履歴テーブルに記録されている中間コードの記載位置に基づいて、当該命令コードが記述されているプログラムソースコード中の行を特定する命令コード位置特定手段と、
を備えることを特徴とする請求項1または請求項2に記載のプログラム診断装置。
Based on the described position of the intermediate code recorded in the history table in association with the instruction code the detected, and the instruction code position specifying means the instruction code to identify the row in the Help program source code is written,
The program diagnostic apparatus according to claim 1 , further comprising:
前記履歴テーブル作成手段は、前記履歴テーブルにおいて、前記共通資源へのアクセスが出来ないよう制御する命令コードと、当該命令コードに対応する命令コードであって前記共通資源へのアクセスが出来ない制御の解除を行う命令コードの、中間コードにおける記載位置の間に記録されている命令コードについては、他の命令コードの並列実行を許可しないことを示す識別子に対応付に関連付けて記録するIn the history table, the history table creating means includes an instruction code for controlling the access to the common resource, and an instruction code corresponding to the instruction code, the control not being able to access the common resource. The instruction code recorded between the description positions in the intermediate code of the instruction code to be canceled is recorded in association with an identifier indicating that parallel execution of other instruction codes is not permitted.
ことを特徴とする請求項1から請求項3の何れか一項に記載のプログラム診断装置。  The program diagnostic apparatus according to any one of claims 1 to 3, wherein
並列実行されるプログラムの共通資源へのアクセス競合状態を検出するプログラム診断装置におけるプログラム診断方法であって、
前記プログラムの入力を受け付け、
前記プログラムの中間コードを生成し、
前記中間コードに記述されている命令コードを仮実行し、
前記仮実行の結果に基づいて、当該仮実行した命令コードと、該命令コードが読み書きを行なうオブジェクト変数の識別情報と、該命令コードの前記中間コードにおける記載位置と、他の命令コードの並列実行を許可することを示す識別子と、を関連付けた履歴テーブルを作成し、
前記中間コードに基づいて、オブジェクト変数の読み書きを行なう命令コードのうち、他の命令コードの並列実行を許可することを示す識別子に関連付けられて前記履歴テーブルに記載されている命令コードを検出する
ことを特徴とするプログラム診断方法。
A program diagnostic method in a program diagnostic apparatus for detecting a race condition for access to a common resource of programs executed in parallel,
Receiving input of the program,
Generate intermediate code of the program,
Temporarily executing the instruction code described in the intermediate code;
Based on the result of the provisional execution, the provisionally executed instruction code, the identification information of the object variable that the instruction code reads and writes, the description position of the instruction code in the intermediate code, and the parallel execution of other instruction codes Create a history table that associates identifiers indicating that
Detecting an instruction code described in the history table in association with an identifier indicating that parallel execution of other instruction codes is permitted among instruction codes for reading and writing object variables based on the intermediate code. A program diagnosis method characterized by the above.
並列実行されるプログラムの共通資源へのアクセス競合状態を検出するプログラム診断装置のコンピュータを、
前記プログラムの入力を受け付けるプログラム入力受付手段、
前記プログラムの中間コードを生成する中間コード生成手段、
前記中間コードに記述されている命令コードを仮実行する命令コード仮実行手段、
前記仮実行の結果に基づいて、当該仮実行した命令コードと、該命令コードが読み書きを行なうオブジェクト変数の識別情報と、該命令コードの前記中間コードにおける記載位置と、他の命令コードの並列実行を許可することを示す識別子と、を関連付けた履歴テーブルを作成する履歴テーブル作成手段、
前記中間コードに基づいて、オブジェクト変数の読み書きを行なう命令コードのうち、他の命令コードの並列実行を許可することを示す識別子に関連付けられて前記履歴テーブルに記載されている命令コードを検出する命令コード検出手段、
として機能させるためのプログラム。
A computer of a program diagnostic apparatus for detecting a race condition for access to a common resource of programs executed in parallel,
Program input receiving means for receiving input of the program;
Intermediate code generating means for generating an intermediate code of the program;
Temporary instruction code execution means for temporarily executing the instruction code described in the intermediate code;
Based on the result of the provisional execution, the provisionally executed instruction code, the identification information of the object variable that the instruction code reads and writes, the description position of the instruction code in the intermediate code, and the parallel execution of other instruction codes A history table creating means for creating a history table associating an identifier indicating that permission is allowed,
An instruction for detecting an instruction code described in the history table in association with an identifier indicating that parallel execution of other instruction codes is permitted among instruction codes for reading and writing object variables based on the intermediate code Code detection means,
Program to function as.
JP2008091323A 2008-03-31 2008-03-31 Program diagnostic apparatus, program diagnostic method and program thereof Active JP4966904B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008091323A JP4966904B2 (en) 2008-03-31 2008-03-31 Program diagnostic apparatus, program diagnostic method and program thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008091323A JP4966904B2 (en) 2008-03-31 2008-03-31 Program diagnostic apparatus, program diagnostic method and program thereof

Publications (2)

Publication Number Publication Date
JP2009245184A JP2009245184A (en) 2009-10-22
JP4966904B2 true JP4966904B2 (en) 2012-07-04

Family

ID=41306989

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008091323A Active JP4966904B2 (en) 2008-03-31 2008-03-31 Program diagnostic apparatus, program diagnostic method and program thereof

Country Status (1)

Country Link
JP (1) JP4966904B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10698792B2 (en) * 2018-05-02 2020-06-30 Microsoft Technology Licensing, Llc Execution control with cross-level trace mapping
CN111045926B (en) * 2019-11-05 2023-04-14 北京字节跳动网络技术有限公司 Application program jamming detection method, device, medium and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04266133A (en) * 1991-02-20 1992-09-22 Oki Electric Ind Co Ltd Program debugging method
JPH0512059A (en) * 1991-07-08 1993-01-22 Mitsubishi Electric Corp Debugging system for parallel processing software
JP2007257397A (en) * 2006-03-24 2007-10-04 Fujitsu Ltd Contention state detection process additional program, contention state detection process adding apparatus and contention state detection process adding method

Also Published As

Publication number Publication date
JP2009245184A (en) 2009-10-22

Similar Documents

Publication Publication Date Title
US7895605B2 (en) Method for tracking an event through multiple module-specific files
WO2019024674A1 (en) Smart contract processing method and apparatus
US9411616B2 (en) Classloader/instrumentation approach for invoking non-bound libraries
US20110106776A1 (en) Incremental implementation of undo/redo support in legacy applications
US6928378B2 (en) Stress testing at low cost through parallel execution of unit tests
US10725893B2 (en) System and method for determination of code coverage for software applications in a network environment
CN109740122A (en) The conversion method and device of mind map use-case file
El-Hokayem et al. THEMIS: a tool for decentralized monitoring algorithms
US8001424B2 (en) System and method for fault mapping of exceptions across programming models
US20090249021A1 (en) Method And Systems For Invoking An Advice Operation Associated With A Joinpoint
JP4966904B2 (en) Program diagnostic apparatus, program diagnostic method and program thereof
US9064042B2 (en) Instrumenting computer program code by merging template and target code methods
US8359579B2 (en) Monitoring dynamic aspect oriented applications at execution time
US9646252B2 (en) Template clauses based SAT techniques
JP5377522B2 (en) Efficiently correlate nominally incompatible types
US8726239B2 (en) Generating type-safe wrappers for dynamic detouring
Wu et al. Automatic SaaS test cases generation based on SOA in the cloud service
US20110246967A1 (en) Methods and systems for automation framework extensibility
CN111813416A (en) File packaging method, device and equipment and storage medium
US7506319B2 (en) Generating a model of software in execution
EP1979810A1 (en) Compile-time interpretable code error detection
Attouchi et al. Memory monitoring in a multi-tenant osgi execution environment
TWI438683B (en) Computer-readable medium and method for transacting accesses via unmanaged pointers
KR101506656B1 (en) System for quality management of application and method therefor
Hammer et al. Check for updates PSCS4CPP: A Generative PSCS Implementation for C+

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110328

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110510

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110707

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20120306

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120402

R150 Certificate of patent or registration of utility model

Ref document number: 4966904

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20150406

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250