JP2013156802A - Module dependency extraction device, module dependency extraction method and program - Google Patents

Module dependency extraction device, module dependency extraction method and program Download PDF

Info

Publication number
JP2013156802A
JP2013156802A JP2012016281A JP2012016281A JP2013156802A JP 2013156802 A JP2013156802 A JP 2013156802A JP 2012016281 A JP2012016281 A JP 2012016281A JP 2012016281 A JP2012016281 A JP 2012016281A JP 2013156802 A JP2013156802 A JP 2013156802A
Authority
JP
Japan
Prior art keywords
module
source code
program
dependency
function
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
Application number
JP2012016281A
Other languages
Japanese (ja)
Other versions
JP5800724B2 (en
Inventor
Yamahiko Ito
山彦 伊藤
Shigeki Suzuki
繁樹 鈴木
Noriyuki Komiya
紀之 小宮
Taichi Ishizaka
太一 石阪
Takeru Kuroiwa
丈瑠 黒岩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2012016281A priority Critical patent/JP5800724B2/en
Publication of JP2013156802A publication Critical patent/JP2013156802A/en
Application granted granted Critical
Publication of JP5800724B2 publication Critical patent/JP5800724B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To precisely extract dependency between modules in an environment with restrictions.SOLUTION: A source code acquisition unit 22 acquires source code from a source code storage unit 21. A target module designation unit 23 receives designation of a first module and a second module which are targets for dependency extraction. An operation condition designation unit 24 receives designation of an operation condition for executing a program. When the acquired source code is analyzed and the program corresponding to the acquired source code is executed by the designated operation condition, a common information extraction unit 251 extracts information which is commonly referable from the first module and the second module as information showing dependency between the first module and the second module, and a presentation unit 26 presents the extracted information.

Description

本発明は、モジュール依存関係抽出装置、モジュール依存関係抽出方法、及び、プログラムに関する。   The present invention relates to a module dependency relationship extraction device, a module dependency relationship extraction method, and a program.

一般に、ソフトウェアを構成するモジュール間の依存度が小さい程、モジュールに対応する機能の改修や削除をする際に他のモジュールへの影響が小さくなり(独立性が高くなり)、ソフトウェアの保守性が向上する。特許文献1、2には、ソフトウェアのモジュール間の依存度を定量的に測定する技術について記載されている。   In general, the smaller the dependency between the modules that make up the software, the smaller the impact on other modules when modifying or deleting the function corresponding to the module (independence becomes higher), and the maintainability of the software. improves. Patent Documents 1 and 2 describe techniques for quantitatively measuring the degree of dependence between software modules.

具体的には、特許文献1には、オブジェクト指向の言語で作成されたソフトウェア(プログラム)に対して、依存関係の種別ごとに依存度を定量化して算出することが記載されている。また、特許文献2には、C言語等のオブジェクト指向をサポートしていない言語であっても、モジュール間で共有するグローバル変数に対するアクセス回数に基づいて、モジュール間の依存度を算出することが記載されている。   Specifically, Patent Document 1 describes that the degree of dependency is quantified and calculated for each type of dependency relationship for software (program) created in an object-oriented language. Further, Patent Document 2 describes that the dependency between modules is calculated based on the number of accesses to a global variable shared between modules even in a language that does not support object orientation such as C language. Has been.

特許文献1、2では、ソフトウェア(プログラム)が扱うデータの範囲には制約が無いことを前提にプログラムやソースコードを解析して、モジュール間の依存度を算出する。特許文献1、2に記載の方法で算出されるモジュール間の依存度は、新規にプログラムを開発するような場合に、モジュールの独立性を示す尺度として有効である。   In Patent Documents 1 and 2, a program or source code is analyzed on the premise that there is no restriction on the range of data handled by software (program), and the dependence between modules is calculated. The degree of dependence between modules calculated by the methods described in Patent Documents 1 and 2 is effective as a measure of module independence when a new program is developed.

特開2000−215045号公報Japanese Patent Laid-Open No. 2000-215045 特開2010−282441号公報JP 2010-282441 A

これに対し、例えば、パソコン上で開発されたソフトウェア(プログラム)を組み込み機器等に移植したい場合がある。この場合、組み込み機器のハードウェアリソースの制約等のため、移植するプログラムが扱うデータに制限を加えて、その制限下では実行されない機能を削除する開発がなされることがある。このような場合、削除対象となる機能に対応するモジュールは、扱うデータの範囲に依存して容易に削除できる場合と、削除に伴って広範囲に渡りプログラムの改修が必要となるため容易に削除できない場合とがある。   On the other hand, for example, there are cases where it is desired to port software (program) developed on a personal computer to an embedded device or the like. In this case, due to restrictions on the hardware resources of the embedded device, etc., development may be performed to limit the data handled by the program to be transplanted and delete functions that are not executed under the limitation. In such a case, the module corresponding to the function to be deleted cannot be easily deleted because it can be easily deleted depending on the range of data to be handled, and the program needs to be extensively modified along with the deletion. There are cases.

ここで、このモジュールを容易に削除できるか否かを、特許文献1、2に記載の手法で算出したモジュール間の依存度に基づいて判断することが考えられる。即ち、依存度が高い場合は独立性が低いため削除が困難と判断し、依存度が低い場合は独立性が高いため削除が容易と判断する。しかしながら、特許文献1、2に記載の手法では、プログラムが扱うデータ範囲に制限が加えられている場合には、モジュール間の依存度を正しく測定することができない。従って、上述したように既存のプログラムを組み込み機器等に移植する際に機能を削除するような開発を行う場合、特許文献1、2に記載の手法で算出されたモジュール間の依存度を、モジュールの独立性を示す尺度として利用するのは不適当であった。   Here, it is conceivable to determine whether or not this module can be easily deleted based on the dependency between modules calculated by the methods described in Patent Documents 1 and 2. That is, when the degree of dependence is high, it is judged that the deletion is difficult because the degree of independence is low, and when the degree of dependence is low, it is judged that the deletion is easy because the degree of independence is high. However, in the methods described in Patent Documents 1 and 2, when the data range handled by the program is restricted, the dependency between modules cannot be measured correctly. Therefore, as described above, when performing development to delete a function when porting an existing program to an embedded device or the like, the dependency between modules calculated by the methods described in Patent Documents 1 and 2 is expressed as a module. It was inappropriate to use it as a measure of independence.

本発明は、上記実情に鑑みてなされたものであり、プログラムが扱うデータ範囲に制限が加えられた場合であっても、モジュール間の依存関係を正確に抽出することができるモジュール依存関係抽出装置、モジュール依存関係抽出方法、及び、プログラムを提供することを目的とする。   The present invention has been made in view of the above circumstances, and is a module dependency relationship extraction device that can accurately extract the dependency relationship between modules even when the data range handled by the program is limited. It is an object to provide a module dependency relationship extraction method and a program.

上記目的を達成するため、本発明のモジュール依存関係抽出装置は、
プログラムのソースコードを取得するソースコード取得手段と、
前記プログラムを構成するモジュールのなかから、第1のモジュールと前記第1のモジュールから呼び出される第2のモジュールとの指定を受け付けるモジュール指定手段と、
前記プログラムを動作させるための動作条件の指定を受け付ける動作条件指定手段と、
前記ソースコードを解析して前記指定した動作条件で前記プログラムを動作させた場合に、前記第1のモジュール及び前記第2のモジュールから共通に参照可能な情報を、前記第1のモジュールにおける前記第2のモジュールの依存の関係を示す情報として抽出する依存関係抽出手段と、
前記依存関係抽出手段によって抽出された情報を提示する提示手段と、
を備えることを特徴とする。
In order to achieve the above object, the module dependency extraction device of the present invention provides:
Source code acquisition means for acquiring the source code of the program;
Module designation means for accepting designation of a first module and a second module called from the first module from among the modules constituting the program;
An operation condition specifying means for receiving specification of an operation condition for operating the program;
When the source code is analyzed and the program is operated under the specified operating condition, information that can be commonly referred to from the first module and the second module is referred to as the first module in the first module. Dependency extraction means for extracting information indicating the dependency relationship of the two modules;
Presenting means for presenting information extracted by the dependency relationship extracting means;
It is characterized by providing.

本発明によれば、指定された動作条件に従ってソースコードを解析してモジュール間の依存関係を抽出する。従って、プログラムが扱うデータ範囲に制限が加えられた場合であっても、モジュール間の依存関係を正確に抽出することができる。   According to the present invention, the source code is analyzed according to the specified operating condition, and the dependency relationship between the modules is extracted. Therefore, even when the data range handled by the program is restricted, the dependency relationship between modules can be accurately extracted.

本発明の実施形態に係るモジュール依存関係抽出装置の物理的な構成を示す図である。It is a figure which shows the physical structure of the module dependence relationship extraction apparatus which concerns on embodiment of this invention. 本発明の実施形態に係るモジュール依存関係抽出装置の機能構成図である。It is a functional block diagram of the module dependence relationship extraction apparatus which concerns on embodiment of this invention. 依存関係抽出処理の動作を説明するためのフローチャートである。It is a flowchart for demonstrating operation | movement of a dependence relationship extraction process. 解析対象となるソースコードの例を示す図である。It is a figure which shows the example of the source code used as analysis object. (A)は、対象モジュール指定部によって指定されたモジュールの構成を示す図である。(B)は、動作条件指定部によって指定された動作条件を示す図である。(A) is a figure which shows the structure of the module designated by the object module designation | designated part. (B) is a figure which shows the operation condition designated by the operation condition designation | designated part. 共通参照情報抽出処理の動作を説明するためのフローチャートである。It is a flowchart for demonstrating operation | movement of a common reference information extraction process. 共通参照情報提示画面の例を示す図である。It is a figure which shows the example of a common reference information presentation screen. 削除可能コードが他の部分と区別されて表示されているソースコードの例を示す図である。It is a figure which shows the example of the source code in which the erasable code is displayed distinguishing from other parts. UDPパケット送信処理の動作を説明するためのフローチャートである。It is a flowchart for demonstrating operation | movement of a UDP packet transmission process. UDPパケット通信プログラムのソースコードの一部を示す図(その1)である。It is FIG. (1) which shows a part of source code of a UDP packet communication program. UDPパケット通信プログラムのソースコードの一部を示す図(その2)である。It is FIG. (2) which shows a part of source code of a UDP packet communication program. UDPパケット通信プログラムのソースコードの一部を示す図(その3)である。It is FIG. (The 3) which shows a part of source code of a UDP packet communication program. UDPパケット通信プログラムのソースコードの一部を示す図(その4)である。It is FIG. (4) which shows a part of source code of a UDP packet communication program. 対象モジュール指定部によって指定されたモジュールの構成を示す図である。It is a figure which shows the structure of the module designated by the object module designation | designated part. 削除可能コードが他の部分と区別されて表示されているソースコードの例を示す図(その1)である。FIG. 10 is a diagram (part 1) illustrating an example of source code in which a erasable code is displayed separately from other parts. 削除可能コードが他の部分と区別されて表示されているソースコードの例を示す図(その2)である。FIG. 10 is a diagram (part 2) illustrating an example of source code in which a erasable code is displayed separately from other parts. 削除可能コードが他の部分と区別されて表示されているソースコードの例を示す図(その3)である。FIG. 10 is a diagram (part 3) illustrating an example of source code in which a erasable code is displayed separately from other parts. 削除可能コードが他の部分と区別されて表示されているソースコードの例を示す図(その4)である。FIG. 10 is a diagram (part 4) illustrating an example of a source code in which a erasable code is displayed separately from other parts. 削除可能コードが他の部分と区別されて表示されているソースコードの例を示す図(その5)である。FIG. 10 is a diagram (No. 5) illustrating an example of source code in which a erasable code is displayed separately from other parts.

以下、本発明の実施形態について、図面を参照しながら詳細に説明する。なお、図中同一または相当部分には同一符号を付す。また、特に言及が無い場合、本発明の実施形態で示すプログラムのソースコードはC言語で記載されているものとする。また、本発明の実施形態における「関数」は、ユーザが独自に定義した関数を指し、C言語で標準的に準備されているprintf等の関数は含ないものとする。また、以下の説明で適宜例示するソースコードには、説明を容易にするため左側に行番号を付す。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In the drawings, the same or corresponding parts are denoted by the same reference numerals. Unless otherwise specified, it is assumed that the source code of the program shown in the embodiment of the present invention is written in C language. In addition, the “function” in the embodiment of the present invention refers to a function uniquely defined by the user, and does not include a function such as printf prepared as a standard in C language. In addition, the source code illustrated as appropriate in the following description is given a line number on the left side for easy description.

本発明の実施形態に係るモジュール依存関係抽出援装置100は、プログラム内から指定したモジュール間における依存の関係を示す情報を抽出する装置である。   The module dependency relationship extraction assistance device 100 according to the embodiment of the present invention is a device that extracts information indicating a dependency relationship between modules designated from within a program.

パソコン上で開発したプログラムを組み込み機器に移植する際に、組み込み機器のリソース(例えば、メモリ使用量等)には制約があるため、特定の機能に対応するモジュールを削除する開発を行う場合がある。このような場合、削除対象のモジュールが他のモジュールに対してどのように依存していたかをユーザ(開発者)に提示することは、開発作業を支援する上で重要である。本発明の実施形態に係るモジュール依存関係抽出援装置100は、このような場面で好適に利用される。   When a program developed on a personal computer is ported to an embedded device, the embedded device resources (for example, memory usage) are limited, so development may be performed to delete modules corresponding to specific functions. . In such a case, it is important to show the user (developer) how the module to be deleted depends on other modules in order to support the development work. The module dependence relationship extraction assisting apparatus 100 according to the embodiment of the present invention is suitably used in such a situation.

モジュール依存関係抽出装置100は、物理的には、図1に示すように、通信部11と、操作部12と、表示部13と、記憶部14と、入出力I/F部15と、制御部16と、を備える。各部はバス17を介して互いに接続されている。   As shown in FIG. 1, the module dependency relationship extraction apparatus 100 physically includes a communication unit 11, an operation unit 12, a display unit 13, a storage unit 14, an input / output I / F unit 15, and a control. Unit 16. Each unit is connected to each other via a bus 17.

通信部11は、通信ネットワーク2を介して、ネットワーク2上の図示せぬ情報処理装置等と通信を行うものであり、通信インタフェース等を備える。例えば、通信部11は、依存関係抽出のために解析するプログラムのソースコードを、これらネットワーク2上の情報処理装置から受信してもよい。   The communication unit 11 communicates with an information processing apparatus (not shown) on the network 2 via the communication network 2 and includes a communication interface and the like. For example, the communication unit 11 may receive the source code of the program to be analyzed for the dependency relationship extraction from the information processing apparatuses on the network 2.

操作部12は、モジュール依存関係抽出装置100に様々な情報を入力するために使用するものであり、キーボード等の入力装置を備える。   The operation unit 12 is used to input various information to the module dependency relationship extraction apparatus 100, and includes an input device such as a keyboard.

表示部13は、様々な情報を出力するものであり、液晶ディスプレイ等の表示装置を備える。   The display unit 13 outputs various information and includes a display device such as a liquid crystal display.

記憶部14は、様々な情報、プログラム、などのアプリケーション等を記憶するものであり、ハードディスクドライブ等の補助記憶装置を備える。   The storage unit 14 stores various information, programs, and other applications, and includes an auxiliary storage device such as a hard disk drive.

入出力I/F部15は、入出力機器3を接続するためのインタフェースである。例えば、依存関係抽出のために解析するプログラムのソースコードを、入出力I/F部15を介して、CD−ROMドライブ等の入出力機器3から取り込むこともできる。   The input / output I / F unit 15 is an interface for connecting the input / output device 3. For example, the source code of a program to be analyzed for dependency relation extraction can be taken in from the input / output device 3 such as a CD-ROM drive via the input / output I / F unit 15.

制御部16は、データの演算処理を行うと共に、バス17を介して通信部11、操作部12、出力部13、記憶部14、入出力I/F部15を制御するものであり、CPU(Central Processing Unit)16a、ROM(Read Only Memory)16b、RAM(Random Access Memory)16c等を備える。制御部16における演算処理及び制御処理は、具体的には、CPU16aが、RAM16cを作業領域として使用して各種データを一時的に記憶させながら、ROM16bに記憶されている制御プログラムを実行することにより行われる。   The control unit 16 performs calculation processing of data and controls the communication unit 11, the operation unit 12, the output unit 13, the storage unit 14, and the input / output I / F unit 15 via the bus 17. A central processing unit (16a), a read only memory (ROM) 16b, a random access memory (RAM) 16c, and the like are provided. Specifically, the arithmetic processing and control processing in the control unit 16 are performed by the CPU 16a executing a control program stored in the ROM 16b while temporarily storing various data using the RAM 16c as a work area. Done.

モジュール依存関係抽出装置100は、機能的には、図2に示すように、ソースコード記憶部21と、ソースコード取得部22と、対象モジュール指定部23と、動作条件指定部24と、依存関係抽出部25と、提示部26とを備える。なお、これらの各部とは、図1に示した制御部16が、同じく図1に示した通信部11、操作部12、出力部13、記憶部14、又は入出力I/F部15を制御することにより実現される。   As shown in FIG. 2, the module dependency relationship extraction device 100 functionally includes a source code storage unit 21, a source code acquisition unit 22, a target module specification unit 23, an operation condition specification unit 24, and a dependency relationship. An extraction unit 25 and a presentation unit 26 are provided. The control unit 16 shown in FIG. 1 controls the communication unit 11, the operation unit 12, the output unit 13, the storage unit 14, or the input / output I / F unit 15 shown in FIG. It is realized by doing.

ソースコード記憶部21には、複数のソースコードが格納されている。各ソースコードには、1乃至複数の関数が記載(定義)されている。   The source code storage unit 21 stores a plurality of source codes. Each source code describes (defines) one or more functions.

ソースコード取得部22は、操作部12を介して入力されたユーザからの指示に基づいて、モジュール間の依存関係を抽出するための解析対象とするプログラムのソースコードを1乃至複数取得する。なお、ソースコード取得部22は、ソースコード記憶部21に格納されている全てのソースコードを解析対象として取得してもよい。また、ソースコード取得部22は、インターネット等を介して、外部のサーバ等からソースコードを取得してもよい。なお、ソースコード取得部22によって取得されたソースコードを取得ソースコードと呼称して以下説明する。   The source code acquisition unit 22 acquires one or more source codes of a program to be analyzed for extracting dependency relationships between modules based on an instruction from the user input via the operation unit 12. Note that the source code acquisition unit 22 may acquire all source codes stored in the source code storage unit 21 as analysis targets. The source code acquisition unit 22 may acquire source code from an external server or the like via the Internet or the like. The source code acquired by the source code acquisition unit 22 is referred to as an acquired source code and will be described below.

対象モジュール指定部23は、操作部12を介して入力されたユーザからの指示に基づいて、取得ソースコードに対応するプログラムを構成するモジュールのなかから、依存関係抽出の対象とするモジュールを指定する。具体的には、対象モジュール指定部23は、依存元のモジュール(第1のモジュール)と、第1のモジュールから呼び出される依存先のモジュール(第2のモジュール)とを指定する。なお、プログラムから機能を削除する開発を支援するためにモジュール依存関係抽出装置100を利用する場合は、削除対象となる機能に対応するモジュールを第2のモジュールに指定するのが望ましい。   The target module designating unit 23 designates a module to be subject to dependency extraction from among modules constituting a program corresponding to the acquired source code based on an instruction from the user input via the operation unit 12. . Specifically, the target module designating unit 23 designates a dependence source module (first module) and a dependence destination module (second module) called from the first module. When using the module dependency extraction device 100 to support development for deleting a function from a program, it is desirable to designate the module corresponding to the function to be deleted as the second module.

なお、本実施形態におけるモジュールは、1乃至複数の関数の集合を表すものとする。従って、対象モジュール指定部23は、ユーザからの指示に基づいて、取得ソースコード内で定義されている関数のなかから、第1のモジュールと第2のモジュールとに属する関数を関数名等で指定する。   Note that the module in the present embodiment represents a set of one or more functions. Accordingly, the target module designating unit 23 designates functions belonging to the first module and the second module from the functions defined in the acquisition source code based on an instruction from the user by a function name or the like. To do.

動作条件指定部24は、操作部12を介して入力されたユーザからの指示に基づいて、取得ソースコードに対応するプログラムを動作させるための入力データの条件(動作条件)を指定する。
なお、本実施形態では、動作条件は、パソコン上で作成された既存のプログラムを組み込み機器等に移植する際に、組み込み機器のハードウェアリソースの制約のために、移植先のプログラムで制限される入力データの範囲を示す。例えば、メモリの空き容量を入力データとしてメモリの空き容量に応じた処理を実行させる既存のプログラムを組み込み機器に移植する場合、この入力データの最大値を移植先でのメモリの空き容量の限界値とする動作条件を設定すればよい。
The operation condition designating unit 24 designates input data conditions (operation conditions) for operating the program corresponding to the acquired source code based on an instruction from the user input via the operation unit 12.
In this embodiment, the operating conditions are limited by the destination program due to restrictions on the hardware resources of the embedded device when the existing program created on the personal computer is ported to the embedded device or the like. Indicates the range of input data. For example, when porting an existing program that executes processing according to the available memory capacity to the embedded device using the available memory capacity as input data, the maximum value of this input data is the limit value of the available memory capacity at the destination. It is sufficient to set the operating conditions.

依存関係抽出部25は、取得プログラムを解析して、指定された動作条件下でプログラムを動作させた場合の第1のモジュールと第2のモジュール間の依存の関係を示す情報を抽出する。依存関係抽出部25は、共通参照情報抽出部251と、削除対象特定部252と、削除可能リソース見積部253と、モジュール間依存度算出部254とを備える。   The dependency relationship extraction unit 25 analyzes the acquired program and extracts information indicating the dependency relationship between the first module and the second module when the program is operated under the specified operation condition. The dependency relationship extraction unit 25 includes a common reference information extraction unit 251, a deletion target specifying unit 252, a deletable resource estimation unit 253, and an inter-module dependency calculation unit 254.

共通参照情報抽出部251は、取得ソースコードを解析して、指定された動作条件下でプログラムを動作させた場合に第1のモジュールと第2のモジュールとの両方から共通に参照可能な情報(関数及びグローバル変数)を抽出する。   The common reference information extraction unit 251 analyzes the acquired source code and can refer to information in common from both the first module and the second module when the program is operated under specified operating conditions ( Functions and global variables).

削除対象特定部252は、共通参照情報抽出部251によって抽出された関数及びグローバル変数のうち、第2のモジュールの削除に伴ってプログラム内から一緒に削除可能となるものを特定する。具体的には、削除対象特定部252は、抽出された関数及びグローバル変数のうち、指定された動作条件下でプログラムを動作させた場合に第1のモジュールと第2モジュール以外のモジュール(関数)からは参照されないものを削除可能対象として特定する。   The deletion target specifying unit 252 specifies the functions and global variables extracted by the common reference information extraction unit 251 that can be deleted together from within the program when the second module is deleted. Specifically, the deletion target specifying unit 252 is a module (function) other than the first module and the second module when the program is operated under the specified operating condition among the extracted functions and global variables. Those that are not referred to from are identified as objects that can be deleted.

削除可能リソース見積部253は、削除対象特定部252が削除可能と特定した関数及びグローバル変数をプログラムから削除した場合の、ハードウェアリソースの削減量を見積もる。   The deletable resource estimation unit 253 estimates the amount of hardware resource reduction when the function and global variable identified as deletable by the deletion target specifying unit 252 are deleted from the program.

モジュール間依存度算出部254は、共通参照情報抽出部251によって抽出された関数とグローバル変数のうち、削除対象特定部252が削除でないと判断した関数とグローバル変数に基づいて、第1のモジュールに対する第2のモジュールの依存の程度を表すモジュール間依存度を算出する。   The inter-module dependence calculation unit 254 determines the first module based on the function and global variable extracted by the common reference information extraction unit 251 based on the function and global variable that the deletion target specifying unit 252 determines not to delete. An inter-module dependency indicating the degree of dependency of the second module is calculated.

(依存関係抽出処理)
続いて、モジュール依存関係抽出装置100によって実施される、プログラム内を構成するモジュール間の依存の関係を抽出する依存関係抽出処理の動作について、適宜具体例を挙げて詳細に説明する。ユーザは、モジュール依存関係抽出装置100の操作部12を介して、依存関係抽出処理を開始するための指示を入力する。この指示に応答して、モジュール依存関係抽出装置100は、図3のフローチャートに示す依存関係抽出処理を実行する。
(Dependency extraction process)
Subsequently, the operation of the dependency relationship extraction process for extracting the dependency relationship between the modules constituting the program executed by the module dependency relationship extracting apparatus 100 will be described in detail with specific examples as appropriate. The user inputs an instruction for starting the dependency relationship extraction process via the operation unit 12 of the module dependency relationship extraction apparatus 100. In response to this instruction, the module dependency relationship extracting apparatus 100 executes the dependency relationship extracting process shown in the flowchart of FIG.

依存関係抽出処理が実行されると、まず、ユーザは、モジュール依存関係抽出装置100の操作部12を操作して、解析対象とするプログラムのソースコードを指定する。ソースコード取得部22は、この指定を受けて、指定されたソースコード(取得ソースコード)をソースコード記憶部21から取得する(ステップS101)。例えば、図4に示すソースコードが取得されたものとして、以下説明する。   When the dependency relationship extraction processing is executed, first, the user operates the operation unit 12 of the module dependency relationship extraction device 100 to specify the source code of the program to be analyzed. In response to this specification, the source code acquisition unit 22 acquires the specified source code (acquired source code) from the source code storage unit 21 (step S101). For example, the following description will be made assuming that the source code shown in FIG. 4 has been acquired.

図3に戻り、ソースコードの取得が完了すると、ユーザは、操作部12を操作して、取得したソースコードから依存関係抽出の対象とする依存元となる第1のモジュールと、第1のモジュールから呼び出される依存先の第2のモジュールとを指定する。対象モジュール指定手段は、この指定を受け付け、受け付けた内容に基づいて第1のモジュールと第2のモジュールとを特定する(ステップS102)。   Returning to FIG. 3, when the acquisition of the source code is completed, the user operates the operation unit 12, and the first module and the first module that are the dependency sources from which the dependency is extracted from the acquired source code Designates the second module to be called from. The target module designating unit accepts this designation, and identifies the first module and the second module based on the accepted content (step S102).

例えば、図5(A)に示すように、図4に示す取得ソースコードから、第1のモジュールとして関数「mod1_func0()」、第2のモジュールとして関数「mod2_func1()」、「mod2_func2()」、「mod2_func3()」、「mod2_func4()」、「mod2_func5()」、「mod2_func6()」が指定されたものとして、以下説明する。   For example, as shown in FIG. 5A, from the acquisition source code shown in FIG. 4, the function “mod1_func0 ()” as the first module, and the functions “mod2_func1 ()” and “mod2_func2 ()” as the second modules. , “Mod2_func3 ()”, “mod2_func4 ()”, “mod2_func5 ()”, and “mod2_func6 ()” are designated as follows.

図3に戻り、第1のモジュールと第2のモジュールとの指定が完了すると、ユーザは、操作部12を操作して、取得ソースコードに対応するプログラムを実行させるための動作条件を指定(入力)する。動作条件指定部24は、この指定を受け付け、受け付けた内容に基づいて動作条件を取得する(ステップS103)。   Returning to FIG. 3, when the designation of the first module and the second module is completed, the user operates the operation unit 12 to designate (input) an operating condition for causing the program corresponding to the acquired source code to be executed. ) The operating condition designating unit 24 accepts this designation, and acquires the operating condition based on the accepted content (step S103).

例えば、図5(B)に示すように、図4に示す取得ソースコード内で扱われる変数「val」の値は任意、変数「val2」の値は100未満でプログラムを動作させることを示す動作条件が指定されたものとして、以下説明する。   For example, as shown in FIG. 5B, the value of the variable “val” handled in the acquisition source code shown in FIG. 4 is arbitrary, and the value of the variable “val2” is less than 100. The following description assumes that the conditions are specified.

図3に戻り、動作条件の指定が完了すると、共通参照情報抽出部251は、取得ソースコードに対応するプログラムを指定された動作条件で実行した場合に、第1のモジュールと第2のモジュールの両方から共通に参照可能な情報を抽出する共通参照情報抽出処理を実行する(ステップS104)。共通参照情報抽出処理については、図6のフローチャートを用いて詳細に説明する。   Returning to FIG. 3, when the specification of the operation condition is completed, the common reference information extraction unit 251 executes the program of the first module and the second module when the program corresponding to the acquired source code is executed under the specified operation condition. A common reference information extraction process for extracting information that can be commonly referred to from both is executed (step S104). The common reference information extraction process will be described in detail with reference to the flowchart of FIG.

共通参照情報抽出処理が開始されると、まず、共通参照情報抽出部251は、取得ソースコードを解析して、取得ソースコードに対応するプログラムを指定された動作条件で実行した場合に、第1のモジュールと第2のモジュールの両方から共通に参照される可能性がある関数とグローバル変数とを抽出する(ステップS1041)。   When the common reference information extraction process is started, first, the common reference information extraction unit 251 analyzes the acquired source code, and executes the first when the program corresponding to the acquired source code is executed under the specified operating condition. Functions and global variables that may be commonly referenced from both the module and the second module are extracted (step S1041).

例えば、図4に示す取得ソースコードに対応するプログラムを、図5(B)で指定された動作条件「val2<100」で実行した場合、取得ソースコードの16行目と24行目に記載されている関数「mod2_func3()」、「mod2_func6()」が実行されることは無い。従って、第1のモジュール(関数「mod1_func0()」)からは、関数「mod2_func3()」、「mod2_func6()」は参照されず、これらの関数は抽出の対象から除外される。また、取得ソースコードの12行目の処理は指定動作条件下においても実行される可能性があるため、第1のモジュールと第2のモジュールの両方から関数「mod2_func1()」とグローバル変数「g_val1」とが参照可能であることが分かる。以下、同様に取得ソースコードを解析して、最終的に関数「mod2_func1()」、「mod2_func2()」、「mod2_func4()」、「mod2_func5()」と、グローバル変数「g_val1」とがステップS1041の処理で抽出される。   For example, when the program corresponding to the acquisition source code shown in FIG. 4 is executed under the operation condition “val2 <100” specified in FIG. 5B, it is described in the 16th and 24th lines of the acquisition source code. The functions “mod2_func3 ()” and “mod2_func6 ()” are not executed. Accordingly, the functions “mod2_func3 ()” and “mod2_func6 ()” are not referred to from the first module (function “mod1_func0 ()”), and these functions are excluded from the extraction target. In addition, since the process on the 12th line of the acquisition source code may be executed even under the specified operation condition, the function “mod2_func1 ()” and the global variable “g_val1” are issued from both the first module and the second module. It can be seen that " Thereafter, the obtained source code is similarly analyzed, and finally the functions “mod2_func1 ()”, “mod2_func2 ()”, “mod2_func4 ()”, “mod2_func5 ()”, and the global variable “g_val1” are step S1041. It is extracted by processing.

図6に戻り、続いて、共通参照情報抽出部251は、取得ソースコードを解析して、取得ソースコードに対応するプログラムを指定された動作条件で実行した場合に、ステップS1041で抽出された関数から参照される可能性がある他の関数(サブルーチン)があるか否かを判別する(ステップS1042)。
例えば、上述の例では、ステップS1041で抽出された関数「mod2_func1()」、「mod2_func2()」、「mod2_func4()」、「mod2_func5()」のそれぞれについて、他の関数を参照しているか否かが判別される。ここでは、そのような関数は検出されなかったものとして、以下説明する。
Returning to FIG. 6, subsequently, the common reference information extraction unit 251 analyzes the acquired source code, and executes the function extracted in step S <b> 1041 when the program corresponding to the acquired source code is executed under the specified operating condition. It is determined whether there is another function (subroutine) that may be referred to from (step S1042).
For example, in the above-described example, whether or not another function is referred to for each of the functions “mod2_func1 ()”, “mod2_func2 ()”, “mod2_func4 ()”, and “mod2_func5 ()” extracted in step S1041. Is determined. Here, the following description will be given assuming that such a function is not detected.

図6に戻り、他の関数(サブルーチン)があると判別した場合(ステップS1042;Yes)、共通参照情報抽出部251は、この関数(サブルーチン)が定義されているソースコードの部分を解析して、指定された動作条件下で、この関数から参照される可能性がある関数とグローバル変数とを抽出する(ステップS1043)。   Returning to FIG. 6, when it is determined that there is another function (subroutine) (step S1042; Yes), the common reference information extraction unit 251 analyzes the part of the source code in which the function (subroutine) is defined. Then, a function and a global variable that can be referred to from this function are extracted under the specified operating condition (step S1043).

以下、共通参照情報抽出部251は、指定された動作条件下で、ステップS1043で抽出された関数から参照される可能性がある関数(サブルーチン)があるか否かを判別し、サブルーチンがある場合に、そのサブルーチンから参照可能な関数とグローバル変数とを抽出する処理を繰り返す。   Hereinafter, the common reference information extraction unit 251 determines whether there is a function (subroutine) that may be referred to from the function extracted in step S1043 under the specified operating condition. In addition, the process of extracting functions and global variables that can be referred to from the subroutine is repeated.

一方、関数(サブルーチン)が無いと判別した場合(ステップS1042;No)、これ以上抽出する関数とグローバル変数は無いこととなり、共通参照情報抽出処理は終了する。   On the other hand, when it is determined that there is no function (subroutine) (step S1042; No), there are no more functions and global variables to be extracted, and the common reference information extraction process ends.

図3に戻り、共通参照情報抽出処理が完了すると、提示部26は、共通参照情報抽出処理によって抽出された情報(関数とグローバル変数)を表示部13に表示(提示)する(ステップS105)。   Returning to FIG. 3, when the common reference information extraction process is completed, the presentation unit 26 displays (presents) the information (function and global variable) extracted by the common reference information extraction process on the display unit 13 (step S105).

上述の例では、図7(A)に示すように、抽出された関数「mod2_func1()」、「mod2_func2()」、「mod2_func4()」、「mod2_func5()」とグローバル変数「g_val1」との名称が一覧表示される共通参照情報提示画面が表示部13に表示される。   In the above example, as shown in FIG. 7A, the extracted functions “mod2_func1 ()”, “mod2_func2 ()”, “mod2_func4 ()”, “mod2_func5 ()” and the global variable “g_val1” A common reference information presentation screen in which names are displayed as a list is displayed on the display unit 13.

図3に戻り、続いて、操作部12を介して、ユーザから削除可能コード表示の指示要求が有った場合、削除対象特定部252は、共通参照情報抽出処理(ステップS104)によって抽出された関数及びグローバル変数のうち、指定された動作条件下でプログラムを実行させた場合に、第1のモジュール及び第2のモジュール以外からは参照されない関数及びグローバル変数を削除可能な関数及びグローバル変数として特定する(ステップS106)。   Returning to FIG. 3, when there is an instruction request to display a deleteable code from the user via the operation unit 12, the deletion target specifying unit 252 is extracted by the common reference information extraction process (step S <b> 104). Among functions and global variables, when a program is executed under specified operating conditions, functions and global variables that are not referenced by other than the first module and second module are specified as functions and global variables that can be deleted. (Step S106).

上述の例では、図4に示す取得ソースコード内の32〜35行目の記載から、第1のモジュール及び第2のモジュール以外のモジュール(関数「mod4_func()」)内で、共通参照情報抽出処理(ステップS104)で抽出された関数「mod2_func2()」が参照されているのがわかる。従って、関数「mod2_func2()」は削除可能な対象からは除外され、最終的に、関数「mod2_func1()」、「mod2_func4()」、「mod2_func5()」と、グローバル変数「g_val1」とが削除可能と特定される。   In the above example, the common reference information is extracted in the modules other than the first module and the second module (function “mod4_func ()”) from the description of the 32rd to 35th lines in the acquisition source code shown in FIG. It can be seen that the function “mod2_func2 ()” extracted in the process (step S104) is referenced. Therefore, the function “mod2_func2 ()” is excluded from the objects that can be deleted, and finally the functions “mod2_func1 ()”, “mod2_func4 ()”, “mod2_func5 ()”, and the global variable “g_val1” are deleted. Identified as possible.

図3に戻り、続いて、提示部26は、ステップS106で特定された削除可能な関数及びグローバル変数が取得ソースコード内で記載されている部分を、削除可能なコードとして他の部分と区別可能に表示する画面を作成して表示部13に表示する(ステップS107)。   Returning to FIG. 3, subsequently, the presentation unit 26 can distinguish the part in which the erasable function and the global variable specified in step S <b> 106 are described in the acquisition source code from other parts as the erasable code. A screen to be displayed is created and displayed on the display unit 13 (step S107).

上述の例では、図8に示すように、削除可能と特定された関数「mod2_func1()」、「mod2_func4()」、「mod2_func5()」と、グローバル変数「g_val1」とが記載されている1行目、12行目、20行目、及び22行目の部分が削除可能部分として点線で囲まれた取得ソースコードが表示される。   In the above-described example, as shown in FIG. 8, the functions “mod2_func1 ()”, “mod2_func4 ()”, “mod2_func5 ()” that are identified as deletable, and the global variable “g_val1” are described. The acquired source code in which the parts of the line 12, the twelfth line, the twentieth line, and the twenty-second line are surrounded by a dotted line as a erasable part is displayed.

図3に戻り、続いて、操作部12を介して、ユーザから削減可能なハードウェアリソース表示の指示要求が有った場合、リソース見積部253は、ステップS107で削除可能コードとして表示した部分を削除した場合のハードウェアリソース(例えば、記憶容量(ROM容量)やメモリ使用量(RAM容量))の削減量を見積もる(ステップS108)。そして、提示部26は、見積もったハードウェアリソースの削減量を、表示部13に表示(提示)する(ステップS109)。   Returning to FIG. 3, when there is a request to display a hardware resource that can be reduced from the user via the operation unit 12, the resource estimation unit 253 displays the portion displayed as the erasable code in step S <b> 107. A reduction amount of hardware resources (for example, storage capacity (ROM capacity) and memory usage (RAM capacity)) when deleted is estimated (step S108). Then, the presentation unit 26 displays (presents) the estimated hardware resource reduction amount on the display unit 13 (step S109).

例えば、ROM容量であれば、リソース見積部253は、削除可能コードとして表示した部分のみをコンパイルし、生成されたバイナリコードのサイズを計測することで見積もればよい。また、RAM容量であれば、リソース見積部253は、削除可能コードと特定したグローバル変数のソースコード内での宣言部分を参照してこのグローバル変数に割り当てられるメモリを予測して、RAM容量を見積もればよい。   For example, if the capacity is ROM capacity, the resource estimation unit 253 may compile only the portion displayed as the erasable code and estimate the size of the generated binary code. If the RAM capacity is reached, the resource estimation unit 253 estimates the RAM capacity by predicting the memory allocated to the global variable by referring to the declaration part in the source code of the global variable identified as the erasable code. That's fine.

上述の例では、関数「mod2_func1()」、「mod2_func4()」、及び「mod2_func5()」をコンパイルすることによって得られるバイナリコードのサイズ分のROM容量、及びグローバル変数「g_val1」を記憶するために要するRAM容量が、削除可能コードを削除した場合のハードウェアリソースの削減量となる。なお、RAM容量の削減量については、本来、OSのリソースや、タスクや割り込みのコンテキストなどに要する容量の評価も必要であるが、本実施の形態ではタスクを削除していないため、評価に入れないこととする。   In the above example, to store the ROM capacity for the size of the binary code obtained by compiling the functions “mod2_func1 ()”, “mod2_func4 ()”, and “mod2_func5 ()”, and the global variable “g_val1” The RAM capacity required for this is the amount of hardware resource reduction when the erasable code is deleted. Note that the amount of RAM capacity to be reduced originally needs to be evaluated for OS resources, the capacity required for tasks and interrupt contexts, etc., but since this embodiment does not delete tasks, it is included in the evaluation. Suppose there is nothing.

続いて、操作部12を介して、ユーザから、モジュール間依存度表示の指示要求が有った場合、モジュール間依存度算出部254は、第2のモジュールの第1のモジュールに対する依存の程度を示すモジュール間依存度を算出する(ステップS110)。具体的には、モジュール間依存度算出部254は、共通参照情報抽出処理(ステップS104)で抽出した関数、グローバル変数のうち、ステップS106で削除可能とならなかった関数、グローバル変数に着目して、モジュール間依存度を算出する。   Subsequently, when there is an inter-module dependency display instruction request from the user via the operation unit 12, the inter-module dependency calculation unit 254 determines the degree of dependency of the second module on the first module. The inter-module dependency shown is calculated (step S110). Specifically, the inter-module dependency calculation unit 254 pays attention to the functions and global variables that cannot be deleted in step S106 among the functions and global variables extracted in the common reference information extraction process (step S104). The inter-module dependency is calculated.

例えば、削除対象にならなかった関数やグローバル変数が多いほど、第2のモジュールを削除するのが困難であり、第2のモジュールは第1のモジュールにより依存していると考えられる。従って、例えば、モジュール間依存度算出部254は、削除対象にならなかった関数やグローバル変数の数をモジュール間依存度として算出すればよい。なお、この場合、上述の例では、抽出された関数とグローバル変数のうち、関数「mod2_func2()」のみが削除対象とならなかったため、依存度は1と算出される。   For example, the more functions and global variables that are not to be deleted, the more difficult it is to delete the second module, and it is considered that the second module depends on the first module. Therefore, for example, the inter-module dependency calculation unit 254 may calculate the number of functions and global variables that are not to be deleted as the inter-module dependency. In this case, in the above-described example, since only the function “mod2_func2 ()” is not a deletion target among the extracted functions and global variables, the dependency is calculated as 1.

若しくは、削除対象にならなかった関数に戻り値が有ったり、引数の数が多いほどより依存しているとも考えられるため、モジュール間依存度算出部254は、「削除対象とならなかった関数の数+削除対象とならなかった各関数の引数の数の合計*2+削除対象とならなかった関数のうち戻り値がある関数の数+削除対象とならなかったグローバル変数の数」等の計算式によってモジュール間依存度を算出してもよい。   Alternatively, since it is considered that the function that is not the deletion target has a return value or the more the number of arguments, the inter-module dependency calculation unit 254 determines that “the function that is not the deletion target”. The total number of arguments of each function that was not to be deleted * 2 + the number of functions that have a return value among the functions that were not to be deleted + the number of global variables that were not to be deleted " The inter-module dependency may be calculated using an equation.

続いて、提示部26は、算出されたモジュール間依存度を、表示部13に表示(提示)する(ステップS111)。以上で、依存関係抽出処理は終了する。   Subsequently, the presentation unit 26 displays (presents) the calculated inter-module dependency on the display unit 13 (step S111). Thus, the dependency relationship extraction process ends.

(具体的なプログラムを用いた依存関係抽出処理の例)
続いて、より具体的なプログラム(IPv6(Internet Protocol Version 6)による通信機能を有する通信装置に組み込まれるUDPパケット通信用のプログラム)を対象に、上述した依存関係抽出処理について説明する。
(Example of dependency extraction processing using a specific program)
Next, the above-described dependency extraction process will be described for a more specific program (a program for UDP packet communication incorporated in a communication device having a communication function based on IPv6 (Internet Protocol Version 6)).

始めに、UDPパケット通信用のプログラム(UDPパケット通信プログラム)によるパケット送信の処理(UDPパケット送信処理)の概要について、図9に示すフローチャートを参照して説明する。なお、UDPパケット送信処理は、通信装置の制御部がUDPパケット通信プログラムを実行することによって行われる処理である。   First, an outline of packet transmission processing (UDP packet transmission processing) by a UDP packet communication program (UDP packet communication program) will be described with reference to the flowchart shown in FIG. The UDP packet transmission process is a process performed when the control unit of the communication apparatus executes a UDP packet communication program.

UDPパケット送信プログラムが実行されると、通信装置の制御部は、自身のMACアドレスからリンクローカルアドレスを設定(生成)する(ステップS201)。   When the UDP packet transmission program is executed, the control unit of the communication apparatus sets (generates) a link local address from its own MAC address (step S201).

続いて、通信装置の制御部は、ローカルネットワーク内に対して近隣要請を送出し、設定したリンクローカルアドレスに重複が無いかどうかを検索する(ステップS202)。検索の結果、重複するリンクローカルアドレスがあると判別した場合(ステップS203;Yes)、同じアドレスを持つノードがネットワーク上に存在することがわかり、通信装置の制御部は、そのリンクローカルアドレスを無効に設定する(ステップS204)。   Subsequently, the control unit of the communication device transmits a neighbor request to the local network, and searches whether there is no duplication in the set link local address (step S202). As a result of the search, when it is determined that there are duplicate link local addresses (step S203; Yes), it is found that a node having the same address exists on the network, and the control unit of the communication device invalidates the link local address. (Step S204).

検索の結果、重複するリンクローカルアドレスがないと判別した場合(ステップS203;No)、又は、ステップS204の処理により重複するリンクローカルアドレスの無効の設定が完了した場合、通信装置の制御部は、設定したリンクローカルアドレスを送信元アドレスとして含むルータ要請メッセージをルータに送信する(ステップS205)。   As a result of the search, when it is determined that there is no duplicate link local address (step S203; No), or when the invalid setting of the duplicate link local address is completed by the process of step S204, the control unit of the communication device A router solicitation message including the set link local address as a transmission source address is transmitted to the router (step S205).

続いて、通信装置の制御部は、ルータ要請メッセージを送信したルータからレスポンスとして受信したルータ広告に新規のプレフィックスが設定されているか否かを判別する(ステップS206)。   Subsequently, the control unit of the communication apparatus determines whether a new prefix is set in the router advertisement received as a response from the router that transmitted the router solicitation message (step S206).

新規のプレフィックスが設定されていると判別した場合(ステップS206;Yes)、通信装置の制御部は、このプレフィックスを用いてIpv6グローバルアドレスを設定(生成)する(ステップS207)。   If it is determined that a new prefix has been set (step S206; Yes), the control unit of the communication apparatus sets (generates) an Ipv6 global address using this prefix (step S207).

続いて、通信装置の制御部は、ネットワーク内に対して近隣要請を送出し、設定したIpv6グローバルアドレスに重複が無いかどうかを検索する(ステップS208)。検索の結果、重複するリンクローカルアドレスがあると判別した場合(ステップS209;Yes)、同じIpv6グローバルアドレスを持つノードがネットワーク上に存在することがわかり、通信装置の制御部は、そのIpv6グローバルアドレスを無効に設定する(ステップS210)。   Subsequently, the control unit of the communication device sends a neighbor request to the inside of the network, and searches whether there is no duplication in the set Ipv6 global address (step S208). As a result of the search, when it is determined that there is an overlapping link local address (step S209; Yes), it can be seen that a node having the same Ipv6 global address exists on the network, and the control unit of the communication device determines the Ipv6 global address. Is set to invalid (step S210).

検索の結果、重複するIpv6グローバルアドレスがないと判別した場合(ステップS209;No)、又は、ステップS210の処理によりIpv6グローバルアドレスの無効の設定が完了した場合、通信装置の制御部は、設定したIpv6グローバルアドレスを用いて、UDPパケットを送信先に送信する(ステップS211)。   As a result of the search, when it is determined that there is no duplicate Ipv6 global address (step S209; No), or when the invalid setting of the Ipv6 global address is completed by the processing of step S210, the control unit of the communication device sets The UDP packet is transmitted to the transmission destination using the Ipv6 global address (step S211).

一方、新規のプレフィックスが設定されていないと判別した場合(ステップS206;No)、通信装置の制御部は、既存のプレフィックスから既に設定されているIpv6グローバルアドレスを用いて、UDPパケットを送信先に送信する(ステップS211)。以上でUDPパケット送信処理は終了する。   On the other hand, if it is determined that a new prefix has not been set (step S206; No), the control unit of the communication device uses the Ipv6 global address already set from the existing prefix as a destination for the UDP packet. Transmit (step S211). Thus, the UDP packet transmission process ends.

続いて、上述したUDPパケット通信プログラムに対応するソースコードSC1〜4を図10〜図13に示す。図10に示すソースコードSC1には、UDPパケット通信プログラムで最初に実行される関数「main()」が記載されている。ソースコードSC1の7行目で関数「main()」から呼ばれる関数「com_init()」は、上述したUDPパケット送信処理のステップS201〜ステップS210に対応する処理(起動時近隣探索)を実行するための関数である。また、12行目の関数「send_udp()」は、UDPパケット送信処理のステップS211に対応する処理(UDPパケットの送信)を実行するための関数である。
なお、UDPパケットの送信処理とは別のタスクで受信処理を実行させるために、6行目の関数「start_task()」で、UDPパケットを受信した際の処理を行う関数「icmp6_input()」が別タスクとして実行される。
Subsequently, source codes SC1 to SC4 corresponding to the above-described UDP packet communication program are shown in FIGS. The source code SC1 shown in FIG. 10 describes a function “main ()” that is executed first in the UDP packet communication program. The function “com_init ()” called from the function “main ()” on the seventh line of the source code SC1 executes a process (neighbor search at start-up) corresponding to step S201 to step S210 of the UDP packet transmission process described above. Is a function of In addition, the function “send_udp ()” on the 12th line is a function for executing a process (UDP packet transmission) corresponding to step S211 of the UDP packet transmission process.
Note that the function “icmp6_input ()” that performs processing when a UDP packet is received by the function “start_task ()” on the sixth line in order to execute the reception process in a task different from the UDP packet transmission process. It is executed as a separate task.

また、図11に示すソースコードSC2の3〜28行目には、起動近接探索を行う関数「com_init()」が記載(定義)されている。また、ソースコードSC2の30〜49行目には、関数「com_init()」のサブルーチンであり、ルータとの通信を行う関数「router_com()」が記載されている。   In addition, in the 3rd to 28th lines of the source code SC2 shown in FIG. 11, a function “com_init ()” for performing activation proximity search is described (defined). Further, the 30th to 49th lines of the source code SC2 describe a function “router_com ()” that is a subroutine of the function “com_init ()” and performs communication with the router.

また、図12に示すソースコードSC3の3〜27行目には、UDPパケットを受信した際の処理を行う関数「icmp6_input()」が記載(定義)されている。この関数「icmp6_input()」は、上述したように、UDPパケットの送信処理とは別タスクで実行される。なお、関数「icmp6_input()」が呼び出されるとき、受信バッファを示すグローバル変数「in_buf」には、受信したUDPパケットが格納されているものとする。関数「icmp6_input()」は、受信したUDPパケットの種別に応じて、必要な処理を実行させるための各種の関数を呼び出す。   In addition, the 3rd to 27th lines of the source code SC3 shown in FIG. 12 describe (define) a function “icmp6_input ()” that performs processing when a UDP packet is received. As described above, this function “icmp6_input ()” is executed in a task different from the UDP packet transmission process. It is assumed that when the function “icmp6_input ()” is called, the received UDP packet is stored in the global variable “in_buf” indicating the reception buffer. The function “icmp6_input ()” calls various functions for executing necessary processing according to the type of the received UDP packet.

また、図13に示すソースコードSC4の4〜8行目、10〜15行目、17〜29行目、及び、31〜35行目には、他の関数から呼ばれる関数「send_ns_dad()」、「send_rs()」、「send_na()」、及び、「send_echo_repl()」が記載(定義)されている。   Further, in the 4th to 8th lines, the 10th to 15th lines, the 17th to 29th lines, and the 31st to 35th lines of the source code SC4 shown in FIG. 13, a function “send_ns_dad ()” called from another function, “Send_rs ()”, “send_na ()”, and “send_echo_repl ()” are described (defined).

続いて、上述したUDPパケット通信プログラムを組み込み機器に移植する際に、「ネットワーク内でアドレスが重複することがないことを前提にアドレスを重複検索する機能を削除する開発」を行う必要があり、その開発作業を支援するために、上述したUDPパケット通信プログラムを対象とした依存関係抽出処理を実行した場合について説明する。   Subsequently, when porting the above-described UDP packet communication program to an embedded device, it is necessary to perform “development of a function for searching for duplicate addresses on the assumption that addresses are not duplicated in the network” In order to support the development work, a case will be described in which the dependency extraction processing for the UDP packet communication program described above is executed.

この場合、まず、ステップS101(ソースコードの指定)では、図10〜図13に示すソースコードSC1〜4が抽出される。   In this case, first, in step S101 (designation of source code), source codes SC1 to SC4 shown in FIGS. 10 to 13 are extracted.

また、ステップS102(モジュールの指定)では、重複検索をする機能を削除する開発を支援するために行う処理であるため、重複検索に関する関数「send_ns_dad()」、「rcv_na_dad」、「detach_addr()」が第2のモジュールとして指定される。また、これらの関数を呼び出している関数「com_init()」が第1のモジュールとして指定される。即ち、図14(A)に示すように第1のモジュールと第2のモジュールとが指定される。   Further, in step S102 (designation of the module), the processing is performed to support the development for deleting the function for performing the duplicate search. Therefore, the functions “send_ns_dad ()”, “rcv_na_dad”, “detach_addr ()” regarding the duplicate search are performed. Is designated as the second module. In addition, the function “com_init ()” that calls these functions is designated as the first module. That is, as shown in FIG. 14A, the first module and the second module are designated.

また、ステップS103(動作条件の指定)では、特に動作条件を指定しない「任意」が設定されたものとする。   In step S103 (designation of operating conditions), it is assumed that “arbitrary” that does not designate any operating conditions is set.

続いて、ステップS104(共通参照情報抽出処理)が実行され、第1のモジュールと第2のモジュールとから共通に参照可能な関数とグローバル変数とが抽出される。図11に示すソースコードSC2の10行目、12行目、13行目、23行目、及び、26行目の記載から、指定した動作条件下において、第1のモジュールに属する関数「com_init()」から第2のモジュールに属する関数「send_ns_dad()」、「rcv_na_dad()」、「detach_addr()」が参照可能であることがわかる。従って、共通に参照される関数として、まずこれらの関数が抽出される。続いて、図13に示すソースコードSC4の4〜8行目の記載から、抽出した関数「send_ns_dad()」が関数「make_ns_dad_packet()」、「icmp6_output」及びグローバル変数「out_buf」を参照することがわかるため、これらも抽出対象とする。従って、最終的に、共通参照情報抽出処理により、関数「send_ns_dad()」、「rcv_na_dad()」、「detach_addr()」、「make_ns_dad_packet()」、「icmp6_output()」と、グローバル変数「out_buf」とが抽出される。そして、ステップS105(共通参照可能情報の表示)では、図7(B)に示すような共通参照情報提示画面が表示部13に表示される。   Subsequently, step S104 (common reference information extraction processing) is executed, and functions and global variables that can be commonly referred to are extracted from the first module and the second module. From the description of the 10th line, the 12th line, the 13th line, the 23rd line, and the 26th line of the source code SC2 shown in FIG. 11, under the specified operating condition, the function “com_init ( ) ”, It can be seen that the functions“ send_ns_dad () ”,“ rcv_na_dad () ”, and“ detach_addr () ”belonging to the second module can be referred to. Therefore, these functions are first extracted as commonly referenced functions. Subsequently, from the description of the fourth to eighth lines of the source code SC4 shown in FIG. 13, the extracted function “send_ns_dad ()” refers to the functions “make_ns_dad_packet ()”, “icmp6_output”, and the global variable “out_buf”. Since these are understood, these are also extracted. Therefore, the functions “send_ns_dad ()”, “rcv_na_dad ()”, “detach_addr ()”, “make_ns_dad_packet ()”, “icmp6_output ()” and the global variable “out_buf” are finally obtained by the common reference information extraction process. And are extracted. Then, in step S105 (display of common referenceable information), a common reference information presentation screen as shown in FIG.

続いて、ステップS106(削除対象の特定)が行われる。抽出された関数のうち、関数「icmp6_output()」は、図13に示すソースコードSC4の13、28、34行目の記載から、モジュール1(関数「com_init()」)とモジュール2(関数「send_ns_dad()」、「rcv_na_dad」、「detach_addr()」)以外のモジュール(関数「send_rs()」と関数「send_na()」と関数「send_echo_repl()」)からも参照可能であることがわかるため、削除対象からは除外される。また、同じく抽出されたグローバル変数「out_buf」は、ソースコードSC4の12、20行目の記載から、モジュール1とモジュール2以外のモジュール(関数「send_rs()」と関数「send_na()」)からも参照可能であることがわかるため、削除対象からは除外される。従って、最終的に、削除対象として、関数「send_ns_dad()」、「rcv_na_dad()」、「detach_addr()」、「make_ns_dad_packet()」が特定される。   Subsequently, step S106 (identification of deletion target) is performed. Among the extracted functions, the function “icmp6_output ()” is the module 1 (function “com_init ()”) and module 2 (function “ Because it can be seen from modules other than send_ns_dad (), rcv_na_dad, detach_addr ()) (function "send_rs ()", function "send_na ()" and function "send_echo_repl ()") Excluded from deletion. Similarly, the extracted global variable “out_buf” is obtained from modules (function “send_rs ()” and function “send_na ()”) other than modules 1 and 2 from the description on lines 12 and 20 of the source code SC4. Since it is understood that can be referred to, it is excluded from the deletion target. Therefore, the functions “send_ns_dad ()”, “rcv_na_dad ()”, “detach_addr ()”, and “make_ns_dad_packet ()” are finally specified as deletion targets.

続いて、ステップS107(削除対象コードの表示)では、これらの削除対象として特定された関数とグローバル変数とがソースコード内で記載又は定義されている部分が削除可能部分として、図15、図16に示すように、点線で囲まれて表示される。   Subsequently, in step S107 (deletion target code display), a part in which the function and the global variable specified as the deletion target are described or defined in the source code is set as a deleteable part. As shown in the figure, the display is surrounded by a dotted line.

続いて、ステップS110(モジュール間依存度の算出)では、上述したように、抽出された関数及びグローバル変数のうち、関数「icmp6_output()」とグローバル変数「out_buf」が、削除対象から除外されている。従って、モジュール間依存度を削除対象とならなかった関数・グローバル変数の数とした場合、モジュール間依存度は2と算出され、ステップS111(モジュール間依存度の表示)で、算出したモジュール間依存度が表示される。   Subsequently, in step S110 (calculation of inter-module dependency), among the extracted functions and global variables, the function “icmp6_output ()” and the global variable “out_buf” are excluded from the deletion target as described above. Yes. Therefore, when the inter-module dependency is the number of functions / global variables that are not to be deleted, the inter-module dependency is calculated as 2, and the calculated inter-module dependency is calculated in step S111 (display of inter-module dependency). The degree is displayed.

なお、関数「icmp6_output()」の引数は1つであり、戻り値は無い(void型)。従って、モジュール間依存度を「削除対象とならなかった関数の数+削除対象とならなかった各関数の引数の数の合計*2+削除対象とならなかった関数のうち戻り値がある関数の数+削除対象とならなかったグローバル変数の数」の計算式で算出した場合、モジュール間依存度は「1+1*2+0+1=4」と算出され、ステップS111(モジュール間依存度の表示)で、算出したモジュール間依存度が表示される。   Note that the function “icmp6_output ()” has one argument and no return value (void type). Therefore, the inter-module dependency is expressed as “the number of functions that are not to be deleted + the total number of arguments of each function that is not to be deleted * 2 + the number of functions that have a return value among the functions that are not to be deleted”. When the calculation formula of “+ number of global variables not to be deleted” is calculated, the inter-module dependency is calculated as “1 + 1 * 2 + 0 + 1 = 4”, and is calculated in step S111 (display of inter-module dependency). The dependency between modules is displayed.

尚、上記の例(重複検索の送信)では、ステップS103(動作条件の指定)の処理において、特に動作条件を指定しなかった。これに対し、重複検索の受信では、ステップ102(モジュールの指定)で第1のモジュールに「icmp6_input()」、第2のモジュールに「send_na()」を指定し、ステップ103で、動作条件に変数ns_typeのとりうる値を「NS_AR」または「NS_NUD」と指定してもよい。なお、この動作条件は、「他の通信装置が送信した重複検査を受信しても処理しない」ことを意味する。このとき、図6に示したフロー図の処理に従うと、図19の20行目の「make_na_dad_packet()」が削除可能な関数となる。なお、上記重複検索受信処理においては、第2のモジュールの指定を、「変数ns_typeを参照する全てのモジュール」としてもよい。   In the above example (transmission of duplicate search), no operation condition is specified in the process of step S103 (designation of operation condition). On the other hand, when receiving a duplicate search, “icmp6_input ()” is designated for the first module and “send_na ()” is designated for the second module in step 102 (designation of the module). A possible value of the variable ns_type may be designated as “NS_AR” or “NS_NUD”. Note that this operating condition means that “no processing is performed even if a duplicate check transmitted by another communication device is received”. At this time, according to the processing of the flowchart shown in FIG. 6, “make_na_dad_packet ()” on the 20th line in FIG. 19 is a function that can be deleted. In the duplicate search reception process, the designation of the second module may be “all modules that refer to the variable ns_type”.

続いて、UDPパケット通信プログラムを組み込み機器に移植する際に、「ルータを使用しない環境での使用を前提にルータ通信に関する機能を削除する開発」を行う必要があり、その開発作業を支援するために、上述したUDPパケット通信プログラムを対象とした依存関係抽出処理を実行した場合について説明する。なお、重複検索する機能を削除する開発を支援する際に実行した依存関係抽出処理の説明と同じ処理については、適宜説明を省略する。   Subsequently, when porting the UDP packet communication program to an embedded device, it is necessary to perform "development that eliminates the function related to router communication on the assumption that it will be used in an environment that does not use a router", in order to support the development work. Next, a description will be given of a case where the dependency extraction process for the above-described UDP packet communication program is executed. In addition, about the same process as the description of the dependence relationship extraction process performed when supporting the development which deletes the function to search repeatedly, description is abbreviate | omitted suitably.

この場合、ステップS102(モジュールの指定)では、ルータ通信機能を削除する開発を支援するために行う処理であるため、ルータ通信に関する関数「router_com()」、「proc_ra()」が第2のモジュールとして指定される。また、これらの関数を呼び出している関数「com_init()」、「icmp6_input()」が第1のモジュールとして指定される。即ち、図14(B)に示すように第1のモジュールと第2のモジュールとが指定される。   In this case, in step S102 (designation of the module), the processing is performed to support the development for deleting the router communication function, and therefore the functions “router_com ()” and “proc_ra ()” related to the router communication are the second module. Specified as In addition, functions “com_init ()” and “icmp6_input ()” that call these functions are designated as the first module. That is, as shown in FIG. 14B, the first module and the second module are designated.

続いて、ステップS104(共通参照情報抽出処理)が実行される。図11に示すソースコードSC2の16行目の記載から、指定した動作条件下において、第1のモジュールに属する関数「com_init()」から第2のモジュールに属する関数「router_com()」が参照可能であることがわかる。また、図12に示すソースコードSC3の13行目の記載から、指定した動作条件下において、第1のモジュールに属する関数「icmp6_input()」から第2のモジュールに属する関数「proc_ra()」が参照可能であることがわかる。従って、共通に参照される関数として、まずこれらの関数「router_com()」、「proc_ra()」が抽出される。さらに、ソースコードSC3の13行目の記載から、抽出した関数「proc_ra()」がグローバル変数「in_buf」を参照することがわかるため、グローバル変数「in_buf」も抽出対象とする。続いて、図11に示すソースコードSC2の35、36、42行目の記載から、抽出した関数「router_com()」が関数「send_rs()」、「proc_rs_reply()」とグローバル変数「retry_cnt」とを参照することがわかるため、これらも抽出対象とする。さらに、図13に示すソースコードSC4の12、13行目の記載から、抽出した関数「send_rs()」が、関数「make_rs_packet()」、「icmp6_output()」とグローバル変数「out_buf」とを参照することがわかるため、これらも抽出対象とする。従って、最終的に、共通参照情報抽出処理により、関数「router_com()」、「proc_ra()」、「send_rs()」、「proc_rs_reply()」、「make_rs_packet()」、「icmp6_output()」と、グローバル変数「in_buf」、「retry_cnt」、「out_buf」とが抽出される。そして、ステップS105(共通情報の表示)では、図7(C)に示すような共通参照情報提示画面が表示される。   Subsequently, step S104 (common reference information extraction process) is executed. From the description of the 16th line of the source code SC2 shown in FIG. 11, the function “router_com ()” belonging to the second module can be referred to from the function “com_init ()” belonging to the first module under the specified operating conditions. It can be seen that it is. Further, from the description of the 13th line of the source code SC3 shown in FIG. 12, the function “proc_ra ()” belonging to the second module is changed from the function “icmp6_input ()” belonging to the first module under the designated operating condition. It can be seen that it can be referred to. Therefore, these functions “router_com ()” and “proc_ra ()” are first extracted as commonly referenced functions. Furthermore, since the extracted function “proc_ra ()” refers to the global variable “in_buf” from the description on the 13th line of the source code SC3, the global variable “in_buf” is also extracted. Subsequently, from the descriptions of the 35th, 36th, and 42th lines of the source code SC2 shown in FIG. 11, the extracted function “router_com ()” has the functions “send_rs ()”, “proc_rs_reply ()”, and the global variable “retry_cnt”. These are also subject to extraction. Furthermore, from the description of the 12th and 13th lines of the source code SC4 shown in FIG. 13, the extracted function “send_rs ()” refers to the functions “make_rs_packet ()”, “icmp6_output ()” and the global variable “out_buf”. These are also extracted. Therefore, finally, the functions `` router_com () '', `` proc_ra () '', `` send_rs () '', `` proc_rs_reply () '', `` make_rs_packet () '', `` icmp6_output () '' The global variables “in_buf”, “retry_cnt”, and “out_buf” are extracted. In step S105 (display of common information), a common reference information presentation screen as shown in FIG. 7C is displayed.

続いて、ステップS106(削除対象の特定)が行われる。抽出された関数のうち、関数「icmp6_output()」は、図13に示すソースコードSC4の7、28、34行目の記載から、モジュール1(関数「com_init()」、「icmp6_input()」)とモジュール2(関数「router_com()」、「proc_ra()」)以外のモジュール(関数「send_ns_dad()」と関数「send_na()」と関数「send_echo_repl()」)からも参照可能であることがわかるため、削除対象からは除外される。また、同じく抽出されたグローバル変数「out_buf」は、ソースコードSC4の6、20行目の記載から、モジュール1とモジュール2以外のモジュール(関数「send_ns_dad()」と関数「send_na()」)からも参照可能であることがわかるため、削除対象からは除外される。また、同じく抽出されたグローバル変数「in_buf」は、図12に示すソースコードSC3の18行目等の記載から、モジュール1とモジュール2以外のモジュール(関数「get_dst_addr()」等)からも参照可能であることがわかるため、削除対象からは除外される。従って、最終的に、削除対象として、関数「router_com()」、「proc_ra()」、「send_rs()」、「proc_rs_reply()」、「make_rs_packet()」とグローバル変数「retry_cnt」とが特定される。   Subsequently, step S106 (identification of deletion target) is performed. Among the extracted functions, the function “icmp6_output ()” is module 1 (functions “com_init ()”, “icmp6_input ()”) from the description on the seventh, 28th and 34th lines of the source code SC4 shown in FIG. And modules 2 (functions “router_com ()”, “proc_ra ()”) other than modules (function “send_ns_dad ()”, function “send_na ()”, and function “send_echo_repl ()”) Since it is understood, it is excluded from the deletion target. Similarly, the extracted global variable “out_buf” is obtained from modules (function “send_ns_dad ()” and function “send_na ()”) other than modules 1 and 2 from the description on the 6th and 20th lines of the source code SC4. Since it is understood that can be referred to, it is excluded from the deletion target. Similarly, the extracted global variable “in_buf” can be referred to from modules other than module 1 and module 2 (function “get_dst_addr ()”, etc.) from the description on the 18th line of the source code SC3 shown in FIG. Therefore, it is excluded from the deletion target. Therefore, finally, the functions “router_com ()”, “proc_ra ()”, “send_rs ()”, “proc_rs_reply ()”, “make_rs_packet ()” and the global variable “retry_cnt” are specified as deletion targets. The

続いて、ステップS107(削除対象コードの表示)では、これらの関数とグローバル変数とがソースコードSC1〜SC4内で記載又は定義されている部分が、削除可能部分として、図17〜図19に示すように、点線で囲まれて表示される。   Subsequently, in step S107 (display of the deletion target code), the parts where these functions and global variables are described or defined in the source codes SC1 to SC4 are shown as the erasable parts in FIGS. 17 to 19. As shown, it is surrounded by a dotted line.

続いて、ステップS110(モジュール間依存度の算出)では、上述したように、抽出された関数及びグローバル変数のうち、関数「icmp6_output()」とグローバル変数「out_buf」、「in_buf」が、削除対象から除外されている。従って、モジュール間依存度を削除対象とならなかった関数・グローバル変数の数とした場合、モジュール間依存度は3と算出され、ステップS111(モジュール間依存度の表示)で、算出したモジュール間依存度が表示される。   Subsequently, in step S110 (calculation of inter-module dependency), as described above, among the extracted functions and global variables, the function “icmp6_output ()” and the global variables “out_buf” and “in_buf” are to be deleted. It is excluded from. Therefore, when the inter-module dependency is the number of functions / global variables not to be deleted, the inter-module dependency is calculated as 3, and the calculated inter-module dependency is calculated in step S111 (display of inter-module dependency). The degree is displayed.

なお、関数「icmp6_output()」は引数は1つであり、戻り値は無い(void型)。従って、モジュール間依存度を「削除対象とならなかった関数の数+削除対象とならなかった各関数の引数の数の合計*2+削除対象とならなかった関数のうち戻り値がある関数の数+削除対象とならなかったグローバル変数の数」の計算式で算出した場合、モジュール間依存度は「1+1*2+0+2=5」と算出され、ステップS111(モジュール間依存度の表示)で、算出したモジュール間依存度が表示される。   Note that the function “icmp6_output ()” has one argument and no return value (void type). Therefore, the inter-module dependency is expressed as “the number of functions that are not to be deleted + the total number of arguments of each function that is not to be deleted * 2 + the number of functions that have a return value among the functions that are not to be deleted”. When the calculation formula of “+ number of global variables not to be deleted” is calculated, the inter-module dependency is calculated as “1 + 1 * 2 + 0 + 2 = 5”, and is calculated in step S111 (display of inter-module dependency). The dependency between modules is displayed.

このように、本実施形態によれば、指定されたデータの制限(動作条件)に基づいてソースコードの解析を行い、モジュール間で共通に参照される情報を抽出する。従って、プログラムが扱うデータ範囲に制限が加えられた場合であっても、モジュール間の依存関係を正確に抽出することができる。   As described above, according to the present embodiment, the source code is analyzed based on the restriction (operation condition) of the designated data, and information that is commonly referred to among the modules is extracted. Therefore, even when the data range handled by the program is restricted, the dependency relationship between modules can be accurately extracted.

また、既存のソフトウェア(プログラム)を組み込み機器に移植するために、組み込み機器のハードウェアリソースの制約に合致するように機能を削除する開発が一般的に行われている。このような場合、本実施形態に係るモジュール依存関係抽出装置100を用いて、この制約を動作条件として指定し、削除する機能に対応するモジュールを依存関係を抽出するモジュール(第2のモジュール)に指定して依存関係抽出処理を行えば、削除する機能に関連する情報がユーザに提示することができる。従って、このような機能を削除する開発を行うユーザを、効率よく支援することが可能となる。   In addition, in order to port existing software (program) to an embedded device, development is generally performed to delete functions so as to meet the hardware resource constraints of the embedded device. In such a case, using the module dependency extraction device 100 according to the present embodiment, this restriction is designated as an operation condition, and the module corresponding to the function to be deleted is extracted as a module (second module) for extracting the dependency. If the dependency extraction process is performed by designating, information related to the function to be deleted can be presented to the user. Therefore, it is possible to efficiently support a user who performs development to delete such a function.

また、本実施形態では、指定された動作条件下で、第1のモジュールと第2のモジュールとから共通に参照可能な関数とグローバル変数とをユーザに提示する。従って、ユーザは、第1のモジュールと第2のモジュールとが、どのような情報を介して結びついているかを容易に確認することができるため、第2のモジュールを削除するような開発を支援することが可能となる。   In the present embodiment, a function and a global variable that can be commonly referred to by the first module and the second module are presented to the user under designated operating conditions. Therefore, the user can easily confirm what information the first module and the second module are connected to, and therefore supports development in which the second module is deleted. It becomes possible.

また、本実施形態では、動作条件に基づいて、共通参照情報として抽出された関数及びグローバル変数のうち、削除可能な関数及びグローバル変数を特定して、ソースコードの他の部分と区別して表示する。従って、ユーザは、この表示を確認することにより、機能を削除する開発をする際に、ソースコードのどの部分を削除すればよいのかを容易に知ることができ、ユーザの開発作業を支援することが可能となる。   Also, in the present embodiment, the functions and global variables that can be deleted are identified from the functions and global variables extracted as common reference information based on the operating conditions, and are displayed separately from other parts of the source code. . Therefore, by confirming this display, the user can easily know which part of the source code should be deleted when developing to delete the function, and support the user's development work. Is possible.

また、本実施形態では、表示した削除可能部分を実際に削除した場合に、削減できるハードウェアリソースの量を見積もって表示するため、ユーザに有意義な情報を提示して、ユーザの開発作業を支援することが可能となる。   Also, in this embodiment, when the displayed deletable part is actually deleted, the amount of hardware resources that can be reduced is estimated and displayed, so that meaningful information is presented to the user and the user's development work is supported. It becomes possible to do.

また、本実施形態では、指定したモジュール間のモジュール間依存度を算出して表示するため、ユーザに有意義な情報を提示して、ユーザの開発作業を支援することが可能となる。   Moreover, in this embodiment, since the inter-module dependence between the designated modules is calculated and displayed, it is possible to present meaningful information to the user and support the user's development work.

なお、本発明は、上記実施形態に限定されず、本発明の要旨を逸脱しない部分での種々の変更は勿論可能である。   In addition, this invention is not limited to the said embodiment, Of course, the various change in the part which does not deviate from the summary of this invention is possible.

例えば、上記実施形態では、モジュールから共通に参照される関数とグローバル変数とを抽出して表示したり、削除可能な関数とグローバル変数が記載されているソースコードの部分を表示した。しかしながら、関数のみ、又はグローバル変数のみを抽出して表示したり、関数のみ、又はグローバル変数のみを削除可能対象として表示してもよい。   For example, in the above-described embodiment, functions and global variables that are commonly referred to from the modules are extracted and displayed, or the source code portion in which the functions and global variables that can be deleted are displayed. However, only the function or only the global variable may be extracted and displayed, or only the function or only the global variable may be displayed as a deletion target.

また、上記実施形態では、図8等に示すように、ソースコード内で削除可能な部分を点線の囲みで表示したが、文字色や字体を他の部分と異ならせて表示してもよい。要するに、削除可能部分をソースコード内の他の部分と区別して表示できれば、任意の表示形態が採用可能である。   Moreover, in the said embodiment, as shown in FIG. 8 etc., although the part which can be deleted in a source code was displayed by the surrounding of a dotted line, you may display a character color and a font differently from another part. In short, any display form can be adopted as long as the erasable part can be displayed separately from other parts in the source code.

また、上記実施形態では、C言語で記載されているソースファイルを例にして主に説明したが、JAVA(登録商標)やBASIC等の他のプログラム言語で記載されているソースファイルにも本願発明が適用できるのは勿論である。なお、その場合、それぞれの言語の文法に沿った手法でソースコードを解析して、関数やグローバル変数の抽出等の処理を行わなければならないのは勿論である。   In the above embodiment, the source file described in the C language has been mainly described as an example. However, the present invention also applies to a source file described in another program language such as JAVA (registered trademark) or BASIC. Of course, is applicable. In that case, of course, it is necessary to analyze the source code by a method according to the grammar of each language and perform processing such as extraction of functions and global variables.

また、例えば、本発明に係るモジュール間存関係抽出装置100の動作を規定する動作プログラムを既存のパーソナルコンピュータや情報端末機器等に適用することで、当該パーソナルコンピュータ等を本発明に係るモジュール依存関係抽出装置100として機能させることも可能である。   In addition, for example, by applying an operation program that defines the operation of the module-existing relationship extraction apparatus 100 according to the present invention to an existing personal computer, an information terminal device, etc. It is also possible to function as the extraction device 100.

また、このようなプログラムの配布方法は任意であり、例えば、CD−ROM(Compact Disk Read-Only Memory)、DVD(Digital Versatile Disk)、MO(Magneto Optical Disk)、メモリカードなどのコンピュータ読み取り可能な記録媒体に格納して配布してもよいし、インターネットなどの通信ネットワークを介して配布してもよい。   Further, the distribution method of such a program is arbitrary. For example, the program can be read by a computer such as a CD-ROM (Compact Disk Read-Only Memory), a DVD (Digital Versatile Disk), an MO (Magneto Optical Disk), or a memory card. It may be distributed by storing in a recording medium, or distributed via a communication network such as the Internet.

100 モジュール依存関係抽出装置
21 ソースコード記憶部
22 ソースコード取得部
23 対象モジュール指定部
24 動作条件指定部
25 依存関係抽出部
251 共通参照情報抽出部
252 削除対象特定部
253 削除可能リソース見積部
254 モジュール間依存度算出部
26 提示部
100 Module Dependency Extraction Device 21 Source Code Storage Unit 22 Source Code Acquisition Unit 23 Target Module Specification Unit 24 Operation Condition Specification Unit 25 Dependency Extraction Unit 251 Common Reference Information Extraction Unit 252 Deletion Target Specification Unit 253 Deletable Resource Estimation Unit 254 Module Interdependency calculation unit 26 Presentation unit

Claims (7)

プログラムのソースコードを取得するソースコード取得手段と、
前記プログラムを構成するモジュールのなかから、第1のモジュールと前記第1のモジュールから呼び出される第2のモジュールとの指定を受け付けるモジュール指定手段と、
前記プログラムを動作させるための動作条件の指定を受け付ける動作条件指定手段と、
前記ソースコードを解析して前記指定した動作条件で前記プログラムを動作させた場合に、前記第1のモジュール及び前記第2のモジュールから共通に参照可能な情報を、前記第1のモジュールと前記第2のモジュール間の依存の関係を示す情報として抽出する依存関係抽出手段と、
前記依存関係抽出手段によって抽出された情報を提示する提示手段と、
を備えることを特徴とするモジュール依存関係抽出装置。
Source code acquisition means for acquiring the source code of the program;
Module designation means for accepting designation of a first module and a second module called from the first module from among the modules constituting the program;
An operation condition specifying means for receiving specification of an operation condition for operating the program;
When the source code is analyzed and the program is operated under the specified operating conditions, information that can be referred to in common from the first module and the second module is referred to as the first module and the second module. Dependency extraction means for extracting information indicating the dependency relationship between the two modules;
Presenting means for presenting information extracted by the dependency relationship extracting means;
A module dependency relationship extracting apparatus comprising:
前記依存関係抽出手段は、前記指定した動作条件で前記プログラムを動作させた場合に前記第1のモジュール及び前記第2のモジュールから共通に参照可能な関数及び/又はグローバル変数を前記ソースコードから抽出する、
ことを特徴とする請求項1に記載のモジュール依存関係抽出装置。
The dependency extraction unit extracts a function and / or a global variable that can be commonly referred to from the first module and the second module when the program is operated under the specified operation condition from the source code. To
The module dependence relationship extracting apparatus according to claim 1, wherein
前記依存関係抽出手段が抽出した関数及び/又はグローバル変数のうち、前記プログラム内の前記第1のモジュール及び前記第2のモジュール以外からは参照されない関数及び/又はグローバル変数を、削除可能な対象として特定する削除対象特定手段をさらに備え、
前記提示手段は、前記削除対象特定手段が特定した関数及び/又はグローバル変数が前記ソースコード内で記載又は定義さている部分を、前記ソースコード内の他の部分と区別して表示する、
ことを特徴とする請求項2に記載のモジュール依存関係抽出装置。
Among the functions and / or global variables extracted by the dependency relationship extraction means, functions and / or global variables that are not referenced by other than the first module and the second module in the program can be deleted. It further includes a deletion target specifying means for specifying,
The presenting means displays a part in which the function and / or global variable specified by the deletion target specifying means is described or defined in the source code separately from other parts in the source code.
The module dependence relationship extracting device according to claim 2, wherein
前記提示手段が表示した削除可能な部分が、前記ソースコードから削除された場合に削減されるハードウェアリソースの量を見積もるリソース見積手段をさらに備え、
前記提示手段は、前記リソース見積手段が見積もったハードウェアリソースの量を提示する、
ことを特徴とする請求項3に記載のモジュール依存関係抽出装置。
A resource estimation unit that estimates an amount of hardware resources to be reduced when the deletable portion displayed by the presenting unit is deleted from the source code;
The presenting means presents an amount of hardware resources estimated by the resource estimating means;
The module dependence relationship extracting device according to claim 3.
前記抽出手段が抽出した関数及び/又はグローバル変数のうち、削除対象特定手段が削除可能な対象と特定しなかった関数及び/又はグローバル変数に基づいて、前記第1のモジュールに対する前記第2のモジュールの依存度を算出する依存度算出手段をさらに備え、
前記提示手段は、前記依存度算出手段が算出した依存度を提示する、
ことを特徴とする請求項3又は4に記載のモジュール依存関係抽出装置。
Of the functions and / or global variables extracted by the extraction means, the second module for the first module based on the functions and / or global variables not specified by the deletion target specifying means as deletion targets. Further comprising a dependency calculation means for calculating the dependency of
The presenting means presents the dependency degree calculated by the dependency degree calculating means.
5. The module dependency relationship extraction device according to claim 3 or 4,
プログラムのソースコードを取得し、
前記プログラムを構成するモジュールのなかから、第1のモジュールと前記第1のモジュールから呼び出される第2のモジュールとの指定を受け付け、
前記プログラムを動作させるための動作条件の指定を受け付け、
前記ソースコードを解析して前記指定した動作条件で前記プログラムを動作させた場合に、前記第1のモジュール及び前記第2のモジュールから共通に参照可能な情報を、前記第1のモジュールと前記第2のモジュール間の依存の関係を示す情報として抽出し、
前記抽出された情報を提示する、
ことを特徴とするモジュール依存関係抽出方法。
Get the source code of the program
Accepting designation of the first module and the second module called from the first module from among the modules constituting the program,
Accepting specification of operating conditions for operating the program,
When the source code is analyzed and the program is operated under the specified operating conditions, information that can be referred to in common from the first module and the second module is referred to as the first module and the second module. Extracted as information indicating the dependency relationship between the two modules,
Presenting the extracted information;
A module dependency extraction method characterized by that.
コンピュータを、
プログラムのソースコードを取得するソースコード取得手段、
前記プログラムを構成するモジュールのなかから、第1のモジュールと前記第1のモジュールから呼び出される第2のモジュールとの指定を受け付けるモジュール指定手段、
前記プログラムを動作させるための動作条件の指定を受け付ける動作条件指定手段、
前記ソースコードを解析して前記指定した動作条件で前記プログラムを動作させた場合に、前記第1のモジュール及び前記第2のモジュールから共通に参照可能な情報を、前記第1のモジュールと前記第2のモジュール間の依存の関係を示す情報として抽出する依存関係抽出手段、
前記依存関係抽出手段によって抽出された情報を提示する提示手段、
として機能させるプログラム。
Computer
Source code acquisition means for acquiring the source code of the program,
Module designation means for accepting designation of the first module and the second module called from the first module from among the modules constituting the program;
An operation condition specifying means for receiving specification of an operation condition for operating the program;
When the source code is analyzed and the program is operated under the specified operating conditions, information that can be referred to in common from the first module and the second module is referred to as the first module and the second module. Dependency extraction means for extracting as information indicating the dependency relationship between the two modules;
Presenting means for presenting information extracted by the dependency relationship extracting means;
Program to function as.
JP2012016281A 2012-01-30 2012-01-30 Module dependency relationship extraction device, module dependency relationship extraction method, and program Expired - Fee Related JP5800724B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012016281A JP5800724B2 (en) 2012-01-30 2012-01-30 Module dependency relationship extraction device, module dependency relationship extraction method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012016281A JP5800724B2 (en) 2012-01-30 2012-01-30 Module dependency relationship extraction device, module dependency relationship extraction method, and program

Publications (2)

Publication Number Publication Date
JP2013156802A true JP2013156802A (en) 2013-08-15
JP5800724B2 JP5800724B2 (en) 2015-10-28

Family

ID=49051926

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012016281A Expired - Fee Related JP5800724B2 (en) 2012-01-30 2012-01-30 Module dependency relationship extraction device, module dependency relationship extraction method, and program

Country Status (1)

Country Link
JP (1) JP5800724B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020261487A1 (en) * 2019-06-27 2020-12-30 オムロン株式会社 Analysis device, analysis method, and analysis program
CN112162776A (en) * 2020-09-04 2021-01-01 维沃移动通信有限公司 Dependency relationship obtaining method and device
JP2022525250A (en) * 2019-05-22 2022-05-11 アビニシオ テクノロジー エルエルシー Static and run-time analysis of computer program systems

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06332684A (en) * 1993-05-24 1994-12-02 Sharp Corp Program correction supporting device
JPH0744397A (en) * 1993-07-30 1995-02-14 Nec Corp Program processing accelerating system
JP2006294011A (en) * 2005-03-15 2006-10-26 Omron Corp Control program development support apparatus
JP2007122207A (en) * 2005-10-26 2007-05-17 Fujitsu Ltd Program analysis program, program analyzing device and program analyzing method
JP2011138247A (en) * 2009-12-28 2011-07-14 Hitachi Ltd Program influence range verification method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06332684A (en) * 1993-05-24 1994-12-02 Sharp Corp Program correction supporting device
JPH0744397A (en) * 1993-07-30 1995-02-14 Nec Corp Program processing accelerating system
JP2006294011A (en) * 2005-03-15 2006-10-26 Omron Corp Control program development support apparatus
JP2007122207A (en) * 2005-10-26 2007-05-17 Fujitsu Ltd Program analysis program, program analyzing device and program analyzing method
JP2011138247A (en) * 2009-12-28 2011-07-14 Hitachi Ltd Program influence range verification method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2022525250A (en) * 2019-05-22 2022-05-11 アビニシオ テクノロジー エルエルシー Static and run-time analysis of computer program systems
US11487534B2 (en) 2019-05-22 2022-11-01 Ab Initio Technology Llc Static and runtime analysis of computer program ecosystems
JP7204011B2 (en) 2019-05-22 2023-01-13 アビニシオ テクノロジー エルエルシー Static and runtime analysis of computer program systems
WO2020261487A1 (en) * 2019-06-27 2020-12-30 オムロン株式会社 Analysis device, analysis method, and analysis program
CN112162776A (en) * 2020-09-04 2021-01-01 维沃移动通信有限公司 Dependency relationship obtaining method and device
CN112162776B (en) * 2020-09-04 2023-07-14 维沃移动通信有限公司 Dependency relationship acquisition method and device

Also Published As

Publication number Publication date
JP5800724B2 (en) 2015-10-28

Similar Documents

Publication Publication Date Title
EP3876116B1 (en) Method and apparatus for running mini program, electronic device, and storage medium
US8627281B2 (en) Method, computer program and computer system for converting source code written in dynamically typed language into target code written in statically typed language and executing target code
KR101908162B1 (en) Live browser tooling in an integrated development environment
US10176270B2 (en) Performance of template based javascript widgets
WO2016177341A1 (en) Interface calling method and device, and terminal
EP2945057B1 (en) Process execution method and information processing apparatus
US20130174131A1 (en) Code converting method, program, and system
WO2016065969A1 (en) Webpage text parsing method and device, and mobile terminal
KR20120025066A (en) Web browsing system and method for rendering dynamic resource uri of script
JP5800724B2 (en) Module dependency relationship extraction device, module dependency relationship extraction method, and program
JP6329329B2 (en) Code caching system
CN110825745A (en) Page generation method and device
KR101092019B1 (en) Web browsing system using the mobile web browser and method thereof and mobile terminal in the used the same
KR20150047940A (en) Method and device for analyzing an application
EP2810160A1 (en) Translating application resources
CN112379885B (en) Applet compiling method, device, equipment and readable storage medium
WO2022047623A1 (en) Software information organization method and device, and computer-readable medium
US9921858B2 (en) Apparatus and method for realizing runtime system for programming language
CN112256252B (en) Interface generation method and device, storage medium and electronic equipment
CN113076084A (en) Resource file processing method, device, equipment and storage medium
JP7322964B2 (en) Test information extraction device, test information extraction method and program
US11934810B2 (en) Translating an edit from a child computer language to a parent computer language while maintaining a semantic meaning of the edit
CN116166866B (en) Method, device, terminal and storage medium for optimizing SEO (secure element operation) on SPA (application platform) application
WO2019015326A1 (en) Method and device for processing static page data
EP3785777B1 (en) Information processing system, information processing method, and program for development apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20141225

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150714

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: 20150728

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150825

R150 Certificate of patent or registration of utility model

Ref document number: 5800724

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

LAPS Cancellation because of no payment of annual fees