JP2019220110A - Program comparison device, program comparison method, and comparison program - Google Patents
Program comparison device, program comparison method, and comparison program Download PDFInfo
- Publication number
- JP2019220110A JP2019220110A JP2018119265A JP2018119265A JP2019220110A JP 2019220110 A JP2019220110 A JP 2019220110A JP 2018119265 A JP2018119265 A JP 2018119265A JP 2018119265 A JP2018119265 A JP 2018119265A JP 2019220110 A JP2019220110 A JP 2019220110A
- Authority
- JP
- Japan
- Prior art keywords
- source code
- program
- comparison
- work
- unit
- 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.)
- Granted
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
Description
本発明は、ソースコードとオブジェクトプログラムとの比較を行うプログラム比較装置、プログラム比較方法および比較プログラムに関する。 The present invention relates to a program comparison device, a program comparison method, and a comparison program for comparing a source code with an object program.
従来、オブジェクトプログラムとソースコードとの比較を行って変更点を確認する技術が知られている。例えば、特許文献1では、ソースコードとオブジェクトプログラムとの一致または不一致を判定するプログラム比較解析装置が提案されている。特許文献1のプログラム比較解析装置では、オブジェクトプログラムを逆コンパイルして言語プログラムを生成し、ソースプログラムと言語プログラムを比較する。そして、ソースプログラムと言語プログラムの対応箇所の一致または不一致を判定する構成となっている。
2. Description of the Related Art Conventionally, there is known a technique of comparing an object program with a source code to confirm a change. For example,
ソースコードをコンパイルしてオブジェクトプログラムを得る変換処理は、一般的には不可逆変換である。従って、オブジェクトプログラムを逆コンパイルしても、元のソースコードと同一のソースコードを得ることはできない。そのため、特許文献1に記載される逆コンパイルした言語プログラムとソースプログラムとでは、表現が大きく異なる。特許文献1では、表現の異なるソースプログラムと言語プログラムとを比較するために、プログラムの対応表または解析ツリーを生成して、ソースプログラムと言語プログラムとの対応箇所を対応付ける必要があり、処理が煩雑である。
The conversion process of compiling a 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 expression differs greatly between the decompiled language program described in
本発明は、上記従来技術における課題に鑑みてなされたものであり、ソースコードとオブジェクトプログラムとを簡易な処理で比較できるプログラム比較装置、プログラム比較方法および比較プログラムを提供することを目的とする。 The present invention has been made in view of the above-described problems in the related art, and has as its object 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作業用ソースコードとを比較する比較部と、比較部における比較結果を表示する表示部と、を備える。 A program comparison device of the present invention compiles a source code to generate a work object, decompiles the work object to generate a first work source code, and reverses the object program. A second code generation unit that compiles to generate a second work source code, a comparison unit that compares the first work source code with the second work source code, and a display unit that displays a comparison result in the comparison unit And.
本発明のプログラム比較方法は、ソースコードをコンパイルして作業用オブジェクトを生成し、該作業用オブジェクトを逆コンパイルして第1作業用ソースコードを生成するステップと、オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成するステップと、第1作業用ソースコードと第2作業用ソースコードとを比較するステップと、比較の結果を表示するステップと、を含む。 A program comparison method according to the present invention includes the steps of compiling a source code to generate a work object, decompiling the work object to generate a first work source code, and decompiling the object program to generate a first work source code. The method includes the steps of: generating two work source codes; comparing the first work source code with the second work source code; and displaying a result of the comparison.
本発明の比較プログラムは、ソースコードをコンパイルして作業用オブジェクトを生成し、該作業用オブジェクトを逆コンパイルして第1作業用ソースコードを生成するステップと、オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成するステップと、第1作業用ソースコードと第2作業用ソースコードとを比較するステップと、比較の結果を表示するステップと、をコンピュータに実行させるものである。 A comparison program of the present invention compiles a source code to generate a work object, decompiles the work object to generate a first work source code, and decompiles the object program to generate a second work source code. The program causes a computer to execute a step of generating a work source code, a step of comparing the first work source code with the second work source code, and a step of displaying a result of the comparison.
本発明によれば、表現が同じ第1作業用ソースコードと第2作業用ソースコードとを生成することで、ソースコードとオブジェクトプログラムとの比較を簡易な処理で行うことができる。 According to the present invention, by generating the first work source code and the second work source code having the same expression, the source code can be compared with the object program by simple processing.
実施の形態1.
以下、本発明に係るプログラム比較装置100の実施の形態について、図面を参照して説明する。図1は、実施の形態1におけるプログラム比較装置100の概略構成図である。本実施の形態のプログラム比較装置100は、コンピュータ200で実行されるオブジェクトプログラムとソースコードとの比較を行うコンピュータである。プログラム比較装置100を用いて、コンピュータ200のオブジェクトプログラムにおける変更点、例えば更新の有無または更新内容等が検出される。
Hereinafter, an embodiment of a
図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
また、制御部2は、プログラムを実行することにより実現される機能部として、第1コード生成部21と、第2コード生成部22と、比較部23と、表示生成部24とを有する。第1コード生成部21は、ソースコードをコンパイルして作業用オブジェクトを生成し、作業用オブジェクトを逆コンパイルして、第1作業用ソースコードを生成する。なお、作業用オブジェクトを生成するために用いられるコンパイラは、コンピュータ200のオブジェクトプログラムを生成するために用いられるコンパイラと同じものとする。第2コード生成部22は、オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成する。なお、第1コード生成部21で用いられる逆コンパイラと、第2コード生成部22で用いられる逆コンパイラは、同じものとする。
In addition, the
比較部23は、第1作業用ソースコードと、第2作業用ソースコードとを比較する。ここで、第1作業用ソースコードと、第2作業用ソースコードとは、同様のコンパイラおよび逆コンパイラを用いて生成されているため、変換処理で失われる情報も同じであり、形式および表現が同じとなる。そのため、比較部23では、第1作業用ソースコードと、第2作業用ソースコードとをテキスト比較することにより、一致および不一致を判断することができる。
The comparing
表示生成部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 according to the present embodiment. The program comparison method is performed 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 first work source code and the second work source code are compared by the comparing unit 23 (S5), and it is determined whether there is a difference (S6). If there is a difference between the first work source code and the second work source code (S6: YES), 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, a second embodiment of the present invention will be described. FIG. 4 is a schematic configuration diagram of a
解析部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 according to 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, there is a difference between the first work source code and the second work source code (S6: YES), and when the different part is highlighted (S7), the corresponding part of the difference in the source code is analyzed. Is performed (S9). Then, in the source code displayed on the
本実施の形態によると、実施の形態1と同様の効果に加え、ソースコードにおける相違点の対応箇所が特定される。これにより、ユーザが相違点とソースコードとの対応を迅速に把握することができ、作業効率がさらに向上する。 According to the present embodiment, in addition to the same effects as those of the first embodiment, a corresponding portion of the difference in the source code is 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 embodiments of the present invention. However, the present invention is not limited to the above embodiments, 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 コンピュータ。
REFERENCE SIGNS
Claims (8)
オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成する第2コード生成部と、
前記第1作業用ソースコードと前記第2作業用ソースコードとを比較する比較部と、
前記比較部における比較結果を表示する表示部と、
を備えることを特徴とするプログラム比較装置。 A first code generation unit that compiles a source code to generate a work object, and decompiles the work object to generate a first work source code;
A second code generator for decompiling the object program to generate a second working source code;
A comparing unit that compares the first working source code with the second working source code;
A display unit for displaying a comparison result in the comparison unit;
A program comparison device comprising:
前記表示部は、前記ソースコードの前記対応箇所を表示することを特徴とする請求項1〜5の何れか一項に記載のプログラム比較装置。 When the comparing 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 a corresponding portion of the difference in the source code. ,
The program comparing device according to claim 1, wherein the display unit displays the corresponding portion of the source code.
オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成するステップと、
前記第1作業用ソースコードと前記第2作業用ソースコードとを比較するステップと、
前記比較の結果を表示するステップと、
を含むことを特徴とするプログラム比較方法。 Compiling the source code to generate a work object; decompiling the work object to generate a first work source code;
Decompiling the object program to generate a second working source code;
Comparing the first working source code with the second working source code;
Displaying the result of the comparison;
A program comparison method comprising:
オブジェクトプログラムを逆コンパイルして第2作業用ソースコードを生成するステップと、
前記第1作業用ソースコードと前記第2作業用ソースコードとを比較するステップと、
前記比較の結果を表示するステップと、
をコンピュータに実行させる比較プログラム。 Compiling the source code to generate a work object; decompiling the work object to generate a first work source code;
Decompiling the object program to generate a second working source code;
Comparing the first working source code with the second working source code;
Displaying the result of the comparison;
A comparison program that causes a computer to execute
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 true JP2019220110A (en) | 2019-12-26 |
JP7068941B2 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 |
---|---|
JP7068941B2 (en) | 2022-05-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9589115B2 (en) | Obfuscation assisting apparatus | |
US20090070747A1 (en) | System for Adding Code Commentary to Source Code During Software Debugging | |
CN108027721B (en) | Techniques for configuring a general program using controls | |
JP5176478B2 (en) | Data flow analysis device, data flow analysis method, and data flow analysis program | |
US20230394483A1 (en) | Blockchain-based data processing method and apparatus | |
JP2016528622A (en) | A system for calculating interprocedural dominance clauses and / or methods | |
WO2012036304A1 (en) | Operation verification support device, operation verification support method, and operation verification support program | |
US11803697B2 (en) | Method and system for labeling and organizing data for summarizing and referencing content via a communication network | |
JP2016048506A (en) | Method for estimating format of log message as well as computer therefor and computer program | |
JP7068941B2 (en) | Program comparison device, program comparison method and comparison program | |
JP2014174577A (en) | Verification device, verification method, and program | |
JP2010067103A (en) | Error information output device, error information output method and error output program for program | |
JP2017004282A (en) | Program display device, program display system, program display method, and program display program | |
US20210397673A1 (en) | Method and system for navigation control | |
JP2013152559A (en) | Program comparison analysis device and program comparison analysis method | |
WO2012133606A1 (en) | Apparatus for setting affecting extent of program, and method of specifying affecting extent and method of extracting affecting program using same | |
JP2013145443A (en) | Test code generation device, test code generation method and test code generation program | |
US9164736B2 (en) | Data processing system, input support method, and input support program | |
Reiss et al. | Tool demonstration: The visualizations of code bubbles | |
JP2809048B2 (en) | Screen debugging method | |
JP6011988B2 (en) | Impact range survey method and impact range survey device | |
JP2015035174A (en) | Control program division device, control program division method, and recording medium therefor | |
KR101149655B1 (en) | Program design apparatus and method | |
Hunt | Scala Testing | |
CN110262787B (en) | Statement replacement method and device and electronic equipment |
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 |