JP7068941B2 - Program comparison device, program comparison method and comparison program - Google Patents
Program comparison device, program comparison method and comparison program Download PDFInfo
- Publication number
- JP7068941B2 JP7068941B2 JP2018119265A JP2018119265A JP7068941B2 JP 7068941 B2 JP7068941 B2 JP 7068941B2 JP 2018119265 A JP2018119265 A JP 2018119265A JP 2018119265 A JP2018119265 A JP 2018119265A JP 7068941 B2 JP7068941 B2 JP 7068941B2
- Authority
- JP
- Japan
- Prior art keywords
- source code
- program
- work
- comparison
- working
- 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
Links
Images
Landscapes
- Stored Programmes (AREA)
Description
本発明は、ソースコードとオブジェクトプログラムとの比較を行うプログラム比較装置、プログラム比較方法および比較プログラムに関する。 The present invention relates to a program comparison device for comparing a source code and an object program, a program comparison method, and a comparison program.
従来、オブジェクトプログラムとソースコードとの比較を行って変更点を確認する技術が知られている。例えば、特許文献1では、ソースコードとオブジェクトプログラムとの一致または不一致を判定するプログラム比較解析装置が提案されている。特許文献1のプログラム比較解析装置では、オブジェクトプログラムを逆コンパイルして言語プログラムを生成し、ソースプログラムと言語プログラムを比較する。そして、ソースプログラムと言語プログラムの対応箇所の一致または不一致を判定する構成となっている。
Conventionally, a technique has been known in which an object program is compared with a source code to confirm changes. For example,
ソースコードをコンパイルしてオブジェクトプログラムを得る変換処理は、一般的には不可逆変換である。従って、オブジェクトプログラムを逆コンパイルしても、元のソースコードと同一のソースコードを得ることはできない。そのため、特許文献1に記載される逆コンパイルした言語プログラムとソースプログラムとでは、表現が大きく異なる。特許文献1では、表現の異なるソースプログラムと言語プログラムとを比較するために、プログラムの対応表または解析ツリーを生成して、ソースプログラムと言語プログラムとの対応箇所を対応付ける必要があり、処理が煩雑である。
The conversion process of compiling the source code to obtain an object program is generally an irreversible conversion. Therefore, even if the object program is decompiled, the same source code as the original source code cannot be obtained. Therefore, the expressions of the decompiled language program described in
本発明は、上記従来技術における課題に鑑みてなされたものであり、ソースコードとオブジェクトプログラムとを簡易な処理で比較できるプログラム比較装置、プログラム比較方法および比較プログラムを提供することを目的とする。 The present invention has been made in view of the above problems in the prior art, and an object of the present invention is to provide a program comparison device, a program comparison method, and a comparison program capable of comparing a source code and an object program by simple processing.
本発明のプログラム比較装置は、ソースコードをコンパイルして作業用オブジェクトを生成し、該作業用オブジェクトを逆コンパイルして第1作業用ソースコードを生成する第1コード生成部と、オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成する第2コード生成部と、第1作業用ソースコードと第2作業用ソースコードとを比較する比較部と、比較部における比較結果を表示する表示部と、を備える。 The program comparison device of the present invention compiles the source code to generate a working object, and decompiles the working object to generate the first working source code. The first code generator and the object program are reversed. A second code generator that compiles and generates a second work source code, a comparison unit that compares the first work source code and the second work source code, and a display unit that displays the comparison result in the comparison unit. And prepare.
本発明のプログラム比較方法は、ソースコードをコンパイルして作業用オブジェクトを生成し、該作業用オブジェクトを逆コンパイルして第1作業用ソースコードを生成するステップと、オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成するステップと、第1作業用ソースコードと第2作業用ソースコードとを比較するステップと、比較の結果を表示するステップと、を含む。 In the program comparison method of the present invention, a step of compiling the source code to generate a working object and then back-compiling the working object to generate the first working source code and a step of back-compiling the object program to generate the first working source code are performed. 2. The step of generating the working source code, the step of comparing the first working source code and the second working source code, and the step of displaying the comparison result are included.
本発明の比較プログラムは、ソースコードをコンパイルして作業用オブジェクトを生成し、該作業用オブジェクトを逆コンパイルして第1作業用ソースコードを生成するステップと、オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成するステップと、第1作業用ソースコードと第2作業用ソースコードとを比較するステップと、比較の結果を表示するステップと、をコンピュータに実行させるものである。 The comparison program of the present invention has a step of compiling the source code to generate a working object and then back-compiling the working object to generate the first working source code, and a second step of back-compiling the object program to generate the second working object. The computer is made to execute a step of generating a working source code, a step of comparing the first working source code and the second working source code, and a step of displaying the comparison result.
本発明によれば、表現が同じ第1作業用ソースコードと第2作業用ソースコードとを生成することで、ソースコードとオブジェクトプログラムとの比較を簡易な処理で行うことができる。 According to the present invention, by generating the source code for the first work and the source code for the second work having the same expression, the source code and the object program can be compared by a simple process.
実施の形態1.
以下、本発明に係るプログラム比較装置100の実施の形態について、図面を参照して説明する。図1は、実施の形態1におけるプログラム比較装置100の概略構成図である。本実施の形態のプログラム比較装置100は、コンピュータ200で実行されるオブジェクトプログラムとソースコードとの比較を行うコンピュータである。プログラム比較装置100を用いて、コンピュータ200のオブジェクトプログラムにおける変更点、例えば更新の有無または更新内容等が検出される。
Hereinafter, embodiments of the
図1に示すように、プログラム比較装置100は、入力部1と、制御部2と、表示部3とを備える。入力部1は、コンピュータ200からオブジェクトプログラムを取得し、制御部2に入力する。オブジェクトプログラムは、コンパイル方式のプログラムであればよく、例えばCL(Control Language)プログラムである。また、入力部1は、オブジェクトプログラムと比較するソースコードをユーザから取得し、制御部2へ入力する。なお、ソースコードは図示されないメモリに記憶されていてもよく、入力部1は、当該メモリからソースコードを取得して、制御部2へ入力してもよい。
As shown in FIG. 1, the
制御部2は、入力部1から入力されるソースコードとオブジェクトプログラムとの比較を行う。制御部2は、メモリ(図示せず)に格納されるプログラムを実行するCPU(Central Processing Unit)またはマイクロコンピュータなどで構成される。なお、制御部2を単一または複合回路などのハードウェアで構成してもよい。
The
表示部3は、LCD(Liquid Crystal Display)などのディスプレイである。表示部3は、制御部2によるソースコードとオブジェクトプログラムとの比較結果を表示する。なお、本実施の形態では、プログラム比較装置100が表示部3を備える構成としているが、プログラム比較装置100に接続されるその他の機器が表示部3を備えてもよい。
The display unit 3 is a display such as an LCD (Liquid Crystal Display). The display unit 3 displays the comparison result between the source code and the object program by the
また、制御部2は、プログラムを実行することにより実現される機能部として、第1コード生成部21と、第2コード生成部22と、比較部23と、表示生成部24とを有する。第1コード生成部21は、ソースコードをコンパイルして作業用オブジェクトを生成し、作業用オブジェクトを逆コンパイルして、第1作業用ソースコードを生成する。なお、作業用オブジェクトを生成するために用いられるコンパイラは、コンピュータ200のオブジェクトプログラムを生成するために用いられるコンパイラと同じものとする。第2コード生成部22は、オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成する。なお、第1コード生成部21で用いられる逆コンパイラと、第2コード生成部22で用いられる逆コンパイラは、同じものとする。
Further, the
比較部23は、第1作業用ソースコードと、第2作業用ソースコードとを比較する。ここで、第1作業用ソースコードと、第2作業用ソースコードとは、同様のコンパイラおよび逆コンパイラを用いて生成されているため、変換処理で失われる情報も同じであり、形式および表現が同じとなる。そのため、比較部23では、第1作業用ソースコードと、第2作業用ソースコードとをテキスト比較することにより、一致および不一致を判断することができる。
The
表示生成部24は、比較部23の比較結果に基づき、表示部3に表示させる比較結果画面30を生成する。図2は、本実施の形態の表示部3に表示される比較結果画面30の一例である。図2に示すように、比較結果画面30は、3画面に分割されており、各画面に第1作業用ソースコード31と、第2作業用ソースコード32と、元のソースコード33とがそれぞれ並んで表示される。
The
また、比較結果画面30は、第1作業用ソースコード31と、第2作業用ソースコード32とを同時にスクロールするスクロールバー35と、ソースコード33をスクロールするスクロールバー36とを有する。これにより、第1作業用ソースコード31および第2作業用ソースコード32と、ソースコード33とをそれぞれ独立してスクロールさせることができ、両者を容易に見比べることができる。
Further, the
また、比較結果画面30では、第1作業用ソースコード31と、第2作業用ソースコード32との相違箇所がハイライトで示される。これにより、比較結果画面30を見たユーザは、容易に相違箇所を把握することができる。なお、第1作業用ソースコード31と第2作業用ソースコード32との相違箇所の表示は、強調表示されるものであればよく、ハイライトに限定されるものではない。例えば、第1作業用ソースコード31と第2作業用ソースコード32との相違箇所の色を変える、もしくは下線または囲い線などを表示する、などしてもよい。
Further, on the
図3は、本実施の形態におけるプログラム比較方法のフローチャートである。プログラム比較方法は、制御部2がメモリに記憶される比較プログラムを実行することにより実施される。まず、制御部2に比較対象となるソースコードとオブジェクトプログラムが入力される(S1)。そして、第1コード生成部21により、ソースコードがコンパイルされ、作業用オブジェクトが生成される(S2)。続いて、生成された作業用オブジェクトが逆コンパイルされ、第1作業用ソースコードが生成される(S3)。また、第2コード生成部22により、オブジェクトプログラムが逆コンパイルされ、第2作業用ソースコードが生成される(S4)。なお、第1作業用ソースコードの生成と、第2作業用ソースコードの生成は、並列に実施されてもよい。
FIG. 3 is a flowchart of the program comparison method in the present embodiment. The program comparison method is carried out by the
続いて、比較部23によって、第1作業用ソースコードと第2作業用ソースコードとが比較され(S5)、相違点の有無が判断される(S6)。第1作業用ソースコードと第2作業用ソースコードとに相違点がある場合(S6:YES)、表示生成部24により、相違箇所のハイライト表示を含む比較結果画面30が生成され、表示部3に表示される(S7)。一方、第1作業用ソースコードと第2作業用ソースコードとに相違点がない場合(S6:NO)、表示生成部24により、相違点がないことを通知する表示を含む比較結果画面30が生成され、表示部3に表示される(S8)。相違点がない場合は、相違点がないことを表示することで、ユーザが相違箇所を探すことなく、ソースコードとオブジェクトプログラムが同一であることを迅速に判断できる。
Subsequently, the
以上のように、本実施の形態によると、同じ表現の第1作業用ソースコードと第2作業用ソースコードとを生成することで、比較部23にてテキスト比較という簡易な処理を行うだけでソースコードとオブジェクトプログラムとを比較できる。また、第1作業用ソースコードと第2作業用ソースコードとは表現が同じであるため、これらを表示部3に並べて表示することで、ユーザが一致または不一致を容易に判断できる。また、第1作業用ソースコードと第2作業用ソースコードとを表示するとともに、比較結果として相違箇所を強調表示することで、迅速に相違箇所を特定することができ、作業効率が向上する。
As described above, according to the present embodiment, by generating the first work source code and the second work source code having the same expression, the
実施の形態2.
次に、本発明の実施の形態2について説明する。図4は、実施の形態2におけるプログラム比較装置100Aの概略構成図である。実施の形態2のプログラム比較装置100Aは、制御部2Aが解析部25を有する点において、実施の形態1と相違する。プログラム比較装置100Aのその他の構成は、実施の形態1のプログラム比較装置100と同様である。
Next,
解析部25は、制御部2Aがプログラムを実行することにより実現される機能部である。解析部25は、比較部23において、第1作業用ソースコードと第2作業用ソースコードとに相違点があると判断された場合に、元のソースコードにおける当該相違点の対応箇所を解析して特定する。具体的には、解析部25は、第1コード生成部21によるコンパイルおよび逆コンパイルにおける内部処理の解析を行い、対応箇所を追うことで、相違点に対応する箇所を特定する。また、解析部25は、第1作業用ソースコードおよび第2作業用ソースコードと、ソースコードとの対応関係を予め記憶し、当該対応関係に基づいて相違点の対応箇所を特定してもよい。
The
表示生成部24は、比較部23による比較結果に加え、解析部25により特定された対応箇所を含む比較結果画面30を生成し、表示部3に表示させる。具体的には、比較結果画面30において、ソースコードの対応箇所がハイライト表示されるなどの強調表示が行われる。また、複数の相違点がある場合には、各相違点と対応箇所との対応がわかるように、例えば色分けなどを行って表示される。
The
図5は、本実施の形態におけるプログラム比較方法のフローチャートである。本実施の形態のプログラム比較方法におけるステップS1からステップS8は、実施の形態1と同様である。そして、第1作業用ソースコードと第2作業用ソースコードとに相違点があり(S6:YES)、相違箇所がハイライト表示されると(S7)、ソースコードにおける相違点の対応箇所が解析される(S9)。そして、比較結果画面30に表示されるソースコードにおいて、特定された対応箇所がハイライト表示される(S10)。
FIG. 5 is a flowchart of the program comparison method in the present embodiment. Steps S1 to S8 in the program comparison method of the present embodiment are the same as those of the first embodiment. Then, when there is a difference between the first work source code and the second work source code (S6: YES) and the difference is highlighted (S7), the corresponding part of the difference in the source code is analyzed. Is done (S9). Then, in the source code displayed on the
本実施の形態によると、実施の形態1と同様の効果に加え、ソースコードにおける相違点の対応箇所が特定される。これにより、ユーザが相違点とソースコードとの対応を迅速に把握することができ、作業効率がさらに向上する。 According to the present embodiment, in addition to the same effect as that of the first embodiment, the corresponding points of the differences in the source code are specified. As a result, the user can quickly grasp the correspondence between the difference and the source code, and the work efficiency is further improved.
以上が本発明の実施の形態の説明であるが、本発明は、上記の実施の形態に限定されるものではなく、本発明の主旨を逸脱しない範囲で種々に変形することが可能である。例えば、制御部2は、第1作業用ソースコードを予め生成し、図示しないメモリ等に記憶していてもよい。これにより、オブジェクトプログラムとの比較を行う度に、第1作業用ソースコードを生成する必要がなく、処理がさらに簡素化される。
The above is the description of the embodiment of the present invention, but the present invention is not limited to the above-described embodiment, and can be variously modified without departing from the gist of the present invention. For example, the
また、比較結果画面30において、第1作業用ソースコード31と第2作業用ソースコード32のみを並べて表示し、ソースコード33を別画面に表示してもよい。さらに、比較結果画面30において、第1作業用ソースコード31と第2作業用ソースコード32との相違箇所のみまたはソースコード33の対応箇所のみ、もしくはその両方を表示してもよい。
Further, on the
1 入力部、2、2A 制御部、3 表示部、21 第1コード生成部、22 第2コード生成部、23 比較部、24 表示生成部、25 解析部、30 比較結果画面、31 第1作業用ソースコード、32 第2作業用ソースコード、33 ソースコード、35、36 スクロールバー、100、100A プログラム比較装置、200 コンピュータ。 1 Input unit, 2, 2A control unit, 3 display unit, 21 1st code generation unit, 22 2nd code generation unit, 23 comparison unit, 24 display generation unit, 25 analysis unit, 30 comparison result screen, 31 1st work Source code for 32 second work source code, 33 source code, 35, 36 scrollbars, 100, 100A program comparison device, 200 computers.
Claims (8)
オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成する第2コード生成部と、
前記第1作業用ソースコードと前記第2作業用ソースコードとを比較する比較部と、
前記比較部における比較結果を表示する表示部と、
を備えることを特徴とするプログラム比較装置。 A first code generator that compiles the source code to generate a working object and decompiles the working object to generate the first working source code.
The second code generator that decompiles the object program and generates the source code for the second work,
A comparison unit that compares the source code for the first work and the source code for the second work,
A display unit that displays the comparison result in the comparison unit, and a display unit.
A program comparison device characterized by comprising.
前記表示部は、前記ソースコードの前記対応箇所を表示することを特徴とする請求項1~5の何れか一項に記載のプログラム比較装置。 When the comparison unit determines that there is a difference between the first work source code and the second work source code, the comparison unit further includes an analysis unit that analyzes the corresponding portion of the difference in the source code. ,
The program comparison device according to any one of claims 1 to 5, wherein the display unit displays the corresponding portion of the source code.
オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成するステップと、
前記第1作業用ソースコードと前記第2作業用ソースコードとを比較するステップと、
前記比較の結果を表示するステップと、
を含むことを特徴とするプログラム比較方法。 The steps of compiling the source code to generate a working object and decompiling the working object to generate the first working source code.
The step of decompiling the object program to generate the source code for the second work,
A step of comparing the source code for the first work with the source code for the second work,
The step of displaying the result of the comparison and
A program comparison method characterized by including.
オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成するステップと、
前記第1作業用ソースコードと前記第2作業用ソースコードとを比較するステップと、
前記比較の結果を表示するステップと、
をコンピュータに実行させる比較プログラム。 The steps of compiling the source code to generate a working object and decompiling the working object to generate the first working source code.
The step of decompiling the object program to generate the source code for the second work,
A step of comparing the source code for the first work with the source code for the second work,
The step of displaying the result of the comparison and
A comparison program that lets your computer run.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018119265A JP7068941B2 (en) | 2018-06-22 | 2018-06-22 | Program comparison device, program comparison method and comparison program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018119265A JP7068941B2 (en) | 2018-06-22 | 2018-06-22 | Program comparison device, program comparison method and comparison program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2019220110A JP2019220110A (en) | 2019-12-26 |
JP7068941B2 true JP7068941B2 (en) | 2022-05-17 |
Family
ID=69096789
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2018119265A Active JP7068941B2 (en) | 2018-06-22 | 2018-06-22 | Program comparison device, program comparison method and comparison program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP7068941B2 (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003280903A (en) | 2002-03-26 | 2003-10-03 | Hitachi Software Eng Co Ltd | System for generating source program comparison information |
US20080189689A1 (en) | 2005-04-21 | 2008-08-07 | Alstom Ferroviaria S.P.A. | Method for Preparing and Checking Application Data |
JP2013152559A (en) | 2012-01-24 | 2013-08-08 | Toshiba Corp | Program comparison analysis device and program comparison analysis method |
US20170169223A1 (en) | 2015-12-11 | 2017-06-15 | Institute For Information Industry | Detection system and method thereof |
-
2018
- 2018-06-22 JP JP2018119265A patent/JP7068941B2/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003280903A (en) | 2002-03-26 | 2003-10-03 | Hitachi Software Eng Co Ltd | System for generating source program comparison information |
US20080189689A1 (en) | 2005-04-21 | 2008-08-07 | Alstom Ferroviaria S.P.A. | Method for Preparing and Checking Application Data |
JP2013152559A (en) | 2012-01-24 | 2013-08-08 | Toshiba Corp | Program comparison analysis device and program comparison analysis method |
US20170169223A1 (en) | 2015-12-11 | 2017-06-15 | Institute For Information Industry | Detection system and method thereof |
Also Published As
Publication number | Publication date |
---|---|
JP2019220110A (en) | 2019-12-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9589115B2 (en) | Obfuscation assisting apparatus | |
KR102244281B1 (en) | Kernel module loading method and device | |
US20120192156A1 (en) | Test case pattern matching | |
JP6441786B2 (en) | Test support apparatus, test support method, and program | |
JP4862945B2 (en) | Data analysis system | |
US20150033210A1 (en) | Method and system for debugging a change-set | |
KR20120041153A (en) | Sequence program debugging device, debugging method, and program | |
JP7068941B2 (en) | Program comparison device, program comparison method and comparison program | |
WO2012036304A1 (en) | Operation verification support device, operation verification support method, and operation verification support program | |
JP5941859B2 (en) | Verification device, verification method, and program | |
JP6506108B2 (en) | PROGRAM DISPLAY DEVICE, PROGRAM DISPLAY SYSTEM, PROGRAM DISPLAY METHOD, AND PROGRAM DISPLAY PROGRAM | |
JP2017167642A (en) | Operation verification device of software, and operation verification method of software | |
JP6665576B2 (en) | Support device, support method, and program | |
JP2013152559A (en) | Program comparison analysis device and program comparison analysis method | |
JP6978458B2 (en) | Sequence program processing device used for tracing sequence programs | |
WO2012133606A1 (en) | Apparatus for setting affecting extent of program, and method of specifying affecting extent and method of extracting affecting program using same | |
US20150199183A1 (en) | Program analysis apparatus and program analysis method | |
US9164736B2 (en) | Data processing system, input support method, and input support program | |
Reiss et al. | Tool demonstration: The visualizations of code bubbles | |
KR101149655B1 (en) | Program design apparatus and method | |
JP2013235306A (en) | Method and device for supporting program generation | |
JP6011988B2 (en) | Impact range survey method and impact range survey device | |
JP2809048B2 (en) | Screen debugging method | |
Hunt | Scala Testing | |
WO2016147398A1 (en) | Waveform display device, waveform display method, and waveform display program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20210324 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20220324 |
|
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: 20220405 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20220502 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 7068941 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |