JP7250223B2 - Method, program and apparatus for analyzing source code - Google Patents

Method, program and apparatus for analyzing source code Download PDF

Info

Publication number
JP7250223B2
JP7250223B2 JP2022565049A JP2022565049A JP7250223B2 JP 7250223 B2 JP7250223 B2 JP 7250223B2 JP 2022565049 A JP2022565049 A JP 2022565049A JP 2022565049 A JP2022565049 A JP 2022565049A JP 7250223 B2 JP7250223 B2 JP 7250223B2
Authority
JP
Japan
Prior art keywords
crud
task
diagram
information
potential
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2022565049A
Other languages
Japanese (ja)
Other versions
JPWO2022113425A5 (en
JPWO2022113425A1 (en
Inventor
将輝 藤田
祐希 檜皮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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
Publication of JPWO2022113425A1 publication Critical patent/JPWO2022113425A1/ja
Publication of JPWO2022113425A5 publication Critical patent/JPWO2022113425A5/ja
Application granted granted Critical
Publication of JP7250223B2 publication Critical patent/JP7250223B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3608Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Description

本開示は、ソースコードの解析に関し、より特定的には、大域変数のCRUD図の作成に関する。 TECHNICAL FIELD This disclosure relates to analyzing source code, and more particularly to creating CRUD diagrams of global variables.

近年、ソフトウェア開発におけるソースコードの規模は増大している。それに伴い、ソースコードに含まれる潜在的な不具合も増大傾向にある。特に、大域変数(グローバル変数)は、プロジェクト内のどの関数からも参照可能であるため、その結果、大域変数の影響範囲の検出および解析が困難となっている。 In recent years, the scale of source code in software development has increased. Along with this, the number of potential defects included in the source code tends to increase. In particular, global variables can be referenced from any function within a project, making it difficult to detect and analyze the extent of influence of global variables.

ソースコードの解析に関し、例えば、特開2020-119348号公報(特許文献1)は、「解析対象プログラムに含まれる複数のモジュールの間の呼び出し関係を検出する。複数のモジュールのうち第1のモジュールを起動する。第1のモジュールの起動によってデータベースに対して生成されたクエリを取得し、取得したクエリが所定のフォーマットを満たしているか判定する。所定のフォーマットを満たしていない場合、複数のモジュールのうち第1のモジュールの呼び出し元である第2のモジュールを起動する。所定のフォーマットを満たすクエリが取得されるまで、起動するモジュールを呼び出し元に向かって遡ることで、所定のフォーマットを満たすクエリと当該クエリが生成されたときに起動されたモジュールとを示す解析結果を出力する」解析方法を開示している([要約]参照)。 Regarding the analysis of the source code, for example, Japanese Patent Application Laid-Open No. 2020-119348 (Patent Document 1) describes, "Detecting the calling relationship between a plurality of modules included in the analysis target program. Get the query generated against the database by the activation of the first module, and determine whether the acquired query satisfies the predetermined format.If the query does not meet the predetermined format, if it does not satisfy the predetermined format, the The second module, which is the caller of the first module, is activated, and by tracing the modules to be activated toward the caller until a query satisfying a predetermined format is acquired, the query satisfying the predetermined format is obtained. outputs analysis results indicating which modules were invoked when the query was generated" (see [Abstract]).

特開2020-119348号公報JP 2020-119348 A

特許文献1に開示された技術によると、ソースコード内の大域変数による潜在的な不具合を含み得る箇所を検出できない。したがって、ソースコード内の大域変数による潜在的な不具合を含み得る箇所を検出するための技術が必要とされている。 According to the technique disclosed in Japanese Patent Laid-Open No. 2002-200013, it is impossible to detect a location that may contain potential defects due to global variables in the source code. Therefore, there is a need for techniques for detecting locations in source code that may contain potential defects due to global variables.

本開示は、上記のような背景に鑑みてなされたものであって、ある局面における目的は、ソースコード内の大域変数による潜在的な不具合を含み得る箇所を検出するための技術を提供することにある。 The present disclosure has been made in view of the background as described above, and an object in one aspect is to provide a technique for detecting locations that may contain potential defects due to global variables in source code. It is in.

ある実施の形態に従うと、1または複数のプロセッサによりソースコードを解析する方法が提供される。この方法は、プログラムの不具合パターンを取得するステップと、プログラムのソースコードを取得するステップと、ソースコードから大域変数に関するCRUD情報を抽出するステップと、不具合パターンに基づいて、CRUD情報から潜在的な不具合を特定するステップと、潜在的な不具合の情報を含むCRUD図を出力するステップとを含む。 According to one embodiment, a method for analyzing source code by one or more processors is provided. The method includes the steps of obtaining a defect pattern of a program; obtaining source code of the program; extracting CRUD information about global variables from the source code; It includes identifying defects and outputting a CRUD diagram containing information of potential defects.

ある実施の形態に従うと、ソースコード内の大域変数による潜在的な不具合を含み得る箇所を検出することが可能である。 According to one embodiment, it is possible to detect locations in the source code that may contain potential defects due to global variables.

この開示内容の上記および他の目的、特徴、局面および利点は、添付の図面と関連して理解される本開示に関する次の詳細な説明から明らかとなるであろう。 The above and other objects, features, aspects and advantages of this disclosure will become apparent from the following detailed description of the disclosure taken in conjunction with the accompanying drawings.

ある実施の形態に従うCRUD図生成装置100の機能構成の一例を示す図である。1 is a diagram showing an example of a functional configuration of a CRUD diagram generation device 100 according to an embodiment; FIG. CRUD図生成装置100のハードウェア構成の一例を示す図である。1 is a diagram showing an example of a hardware configuration of a CRUD diagram generation device 100; FIG. ある実施の形態に従うCRUD情報300の一例である。3 is an example of CRUD information 300 according to one embodiment. ある実施の形態に従う不具合潜在パターン111の一例である。It is an example of a potential defect pattern 111 according to an embodiment. ある実施の形態に従うCRUD図113の一例を示す図である。113 illustrates an example CRUD diagram 113 according to an embodiment; FIG. CRUD図生成装置100における不具合潜在パターン111の登録処理の手順の一例を示す図である。FIG. 10 is a diagram showing an example of a procedure of registration processing of the latent failure pattern 111 in the CRUD diagram generation device 100; CRUD図生成装置100におけるソースコード112の取得からCRUD図113の生成までの手順の一例を示す図である。FIG. 3 is a diagram showing an example of a procedure from acquisition of the source code 112 to generation of the CRUD diagram 113 in the CRUD diagram generation device 100; CRUD図生成装置100におけるCRUD情報の抽出処理の手順の一例を示す図である。FIG. 3 is a diagram showing an example of a procedure of CRUD information extraction processing in the CRUD diagram generation device 100; CRUD図生成装置100における不具合潜在箇所の特定処理の手順の一例を示す図である。FIG. 10 is a diagram showing an example of a procedure for specifying a potential defect location in the CRUD diagram generation device 100; ある実施の形態に従う不具合潜在箇所のデータ1000の一例を示す図である。FIG. 10 is a diagram showing an example of data 1000 of potential defect locations according to an embodiment; CRUD図生成装置100におけるCRUD図113の生成処理の手順の一例を示す図である。FIG. 11 is a diagram showing an example of the procedure of generation processing of the CRUD diagram 113 in the CRUD diagram generation device 100; ある実施の形態に従うCRUD図生成装置1200の機能構成の一例を示す図である。FIG. 3 is a diagram showing an example of a functional configuration of a CRUD diagram generation device 1200 according to an embodiment; FIG. タスクの一例を示す図である。It is a figure which shows an example of a task. タスク単位の不具合潜在パターン1211の一例を示す図である。FIG. 12 is a diagram showing an example of a potential failure pattern 1211 for each task; タスク単位のCRUD図1215の一例を示す図である。12 is a diagram showing an example of a task-based CRUD diagram 1215. FIG. CRUD図生成装置1200におけるタスク結合処理の一例を示す図である。FIG. 10 is a diagram showing an example of task combination processing in the CRUD diagram generation device 1200; CRUD図生成装置1200における、不具合潜在箇所を特定する処理の一例を示す図である。FIG. 12 is a diagram showing an example of processing for identifying a latent defect location in the CRUD diagram generation device 1200; ある実施の形態に従うCRUD図生成装置1850の機能構成の一例を示す図である。FIG. 13 is a diagram showing an example of a functional configuration of a CRUD diagram generation device 1850 according to an embodiment; FIG. タスク間依存度の出力ファイル1851の抽出手順の一例を示す図である。FIG. 18 is a diagram showing an example of a procedure for extracting an inter-task dependency output file 1851. FIG. タスク間依存度の出力ファイル1851の一例を示す図である。18 is a diagram showing an example of an output file 1851 of inter-task dependencies; FIG. CRUD図生成装置1850におけるタスク間依存度の出力ファイル1851を出力するまでの処理の手順の一例を示す図である。18 is a diagram showing an example of the procedure of processing up to outputting an output file 1851 of inter-task dependencies in the CRUD diagram generation device 1850. FIG. 本実施の形態に従うCRUD図生成装置1800の機能構成の一例を示す図である。1 is a diagram showing an example of a functional configuration of CRUD diagram generation device 1800 according to the present embodiment; FIG. 不具合潜在パターン1811の一例を示す図である。18 is a diagram showing an example of a potential defect pattern 1811; FIG. CRUD図の差分ファイル1815の一例を示す図である。FIG. 18 is a diagram showing an example of a difference file 1815 of the CRUD diagram; FIG. CRUD図生成装置1800におけるCRUD図の差分ファイル1815を生成する処理手順の一例を示す図である。FIG. 18 is a diagram showing an example of a processing procedure for generating a CRUD diagram difference file 1815 in the CRUD diagram generation device 1800;

以下、図面を参照しつつ、本開示に係る技術思想の実施の形態について説明する。以下の説明では、同一の部品には同一の符号を付してある。それらの名称および機能も同じである。したがって、それらについての詳細な説明は繰り返さない。 Hereinafter, embodiments of the technical concept according to the present disclosure will be described with reference to the drawings. In the following description, the same parts are given the same reference numerals. Their names and functions are also the same. Therefore, detailed description thereof will not be repeated.

実施の形態1.
本実施の形態に従うCRUD図生成装置100は、任意のプログラムのソースコードを解析して、ソースコード中の不具合が潜在している可能性のある箇所(以下、「不具合潜在箇所」と呼ぶ)を特定する。また、CRUD図生成装置100は、不具合潜在箇所の情報を強調表示するCRUD図を生成する。不具合潜在箇所は、大域変数に起因する不具合が潜在している可能性のある箇所を含む。まず、図1および図2を参照して、CRUD図生成装置100の機能およびハードウェア構成について説明する。
Embodiment 1.
The CRUD diagram generation device 100 according to the present embodiment analyzes the source code of an arbitrary program, and finds places where there is a possibility of potential defects in the source code (hereinafter referred to as "potential defect places"). Identify. In addition, the CRUD diagram generation device 100 generates a CRUD diagram that highlights information on potential defect locations. Potential fault locations include locations where there is a possibility that faults caused by global variables are latent. First, the functions and hardware configuration of the CRUD diagram generation device 100 will be described with reference to FIGS. 1 and 2. FIG.

図1は、本実施の形態に従うCRUD図生成装置100の機能構成の一例を示す図である。ある局面において、図1に示す各機能ブロックは、図2に示すハードウェアがソフトウェアと協働することにより実現され得る。 FIG. 1 is a diagram showing an example of the functional configuration of CRUD diagram generation device 100 according to the present embodiment. In one aspect, each functional block shown in FIG. 1 can be realized by the hardware shown in FIG. 2 cooperating with software.

CRUD図生成装置100は、不具合潜在パターン入力部101と、静的解析部102と、CRUD情報抽出部103と、不具合潜在箇所特定部104と、CRUD図生成部105とを備える。CRUD図生成装置100の入出力ファイルは、不具合潜在パターン111と、ソースコード112と、CRUD図113とを含む。CRUD図生成装置100が蓄積するデータは、解析データDB(Database)121と、CRUD情報DB122と、不具合潜在パターンDB123とにそれぞれ保存される。ある局面において、各DBは、CRUD図生成装置100の内部の記憶装置(図示せず)に保存されてもよいし、外部の装置に保存されてもよい。 The CRUD diagram generation device 100 includes a potential failure pattern input unit 101 , a static analysis unit 102 , a CRUD information extraction unit 103 , a potential failure location identification unit 104 , and a CRUD diagram generation unit 105 . The input/output files of the CRUD diagram generation device 100 include potential fault patterns 111 , source code 112 and CRUD diagrams 113 . The data accumulated by the CRUD diagram generation device 100 is stored in an analysis data DB (database) 121, a CRUD information DB 122, and a potential fault pattern DB 123, respectively. In one aspect, each DB may be saved in a storage device (not shown) inside the CRUD diagram generation device 100, or may be saved in an external device.

不具合潜在パターン入力部101は、不具合潜在パターン111の入力を受け付ける。また、不具合潜在パターン入力部101は、取得した不具合潜在パターン111を不具合潜在パターンDB123に格納する。不具合潜在パターン111は、例えば、あるプログラムのソースコードについて、潜在的な不具合を引き起こす可能性がある、大域変数の生成(Create)、参照(Read)、更新(Update)および削除(Delete)の実行条件の組み合わせを含む(以下、各々を「生成(C)、参照(R)、更新(U)および削除(D)」と呼ぶ)。 The potential defect pattern input unit 101 receives an input of the potential defect pattern 111 . Further, the potential defect pattern input unit 101 stores the acquired potential defect pattern 111 in the potential defect pattern DB 123 . The defect potential pattern 111 is, for example, the execution of global variable creation (Create), reference (Read), update (Update), and deletion (Delete) that may cause potential defects in the source code of a certain program. Contains a combination of conditions (hereinafter each referred to as "Create (C), Reference (R), Update (U) and Delete (D)").

大域変数の生成(C)は、オブジェクト指向プログラムにおけるクラスのインスタンスの生成、または、変数へのメモリ領域の動的な確保を含む。変数へのメモリの動的な確保は、例えば、C言語における「malloc()」関数の実行等に相当する。大域変数の参照(R)は、変数に格納されたデータの読み出し処理である。大域変数の更新(U)は、変数に格納されたデータの更新または上書き処理である。削除(D)は、インスタンスの削除、または、変数に動的に確保されたメモリ領域の開放を含む。 Generation of global variables (C) includes generation of class instances in object-oriented programs or dynamic allocation of memory areas to variables. Dynamic allocation of memory to a variable corresponds to, for example, execution of the "malloc( )" function in C language. A global variable reference (R) is a process of reading data stored in a variable. Updating (U) a global variable is the updating or overwriting of the data stored in the variable. Deletion (D) includes deleting an instance or releasing a memory area dynamically allocated for a variable.

静的解析部102は、ソースコード112を取得して、当該ソースコードの解析を実行し、大域変数および関数の参照関係情報を含んだ解析データを生成する。静的解析部102は、生成した解析データを解析データDB121に格納する。ある局面において、ソースコード112は、任意の言語のソースコードを含み得る。例えば、ソースコード112は、C言語等のコンパイルを必要とする言語のソースコードであってもよいし、Python等のインタプリタによって実行される言語のソースコードであってもよい。他の局面において、静的解析部102は、既存の静的解析技術を用いた静的解析ツールにより実現されてもよい。 The static analysis unit 102 acquires the source code 112, analyzes the source code, and generates analysis data including reference relationship information of global variables and functions. The static analysis unit 102 stores the generated analysis data in the analysis data DB 121 . In some aspects, source code 112 may include source code in any language. For example, the source code 112 may be source code in a language such as C that requires compilation, or source code in a language that is executed by an interpreter such as Python. In another aspect, the static analysis unit 102 may be realized by a static analysis tool using existing static analysis technology.

ある局面において、不具合潜在パターン入力部101および静的解析部102は、ユーザからの入力を受け付ける入力インターフェイス、または/および、他の装置からの通信を取得する通信インターフェイスを含んでいてもよい。 In one aspect, the potential failure pattern input unit 101 and the static analysis unit 102 may include an input interface that receives input from the user and/or a communication interface that acquires communication from other devices.

CRUD情報抽出部103は、解析データDB121から、解析データを読み出して解析することで、ソースコード112内の大域変数が、どの関数により作成(C)、参照(R)、更新(U)、および削除(D)されたのか、および、その実行回数を含むCRUD情報を生成する。CRUD情報抽出部103は、生成したCRUD情報をCRUD情報DB122に格納する。これ以降、作成(C)、参照(R)、更新(U)、および削除(D)を総称して「CRUD処理」と呼ぶ。また、「CRUD処理の実行回数(または、CRUD情報)」とは、作成(C)、参照(R)、更新(U)、および削除(D)の各々の処理の実行回数を指す。CRUD情報抽出部103によって抽出されるCRUD情報は、各関数の各大域変数に対するCRUD処理の実行回数(CRUD情報)を含む。 The CRUD information extraction unit 103 reads and analyzes the analysis data from the analysis data DB 121 to determine which functions create (C), reference (R), update (U), and Generate CRUD information including whether it was deleted (D) and its execution count. The CRUD information extraction unit 103 stores the generated CRUD information in the CRUD information DB 122 . Henceforth, creation (C), reference (R), update (U), and deletion (D) are collectively referred to as "CRUD operations". Also, "the number of CRUD processes executed (or CRUD information)" refers to the number of times each of creation (C), reference (R), update (U), and deletion (D) processes is executed. The CRUD information extracted by the CRUD information extraction unit 103 includes the number of CRUD processing executions (CRUD information) for each global variable of each function.

不具合潜在箇所特定部104は、不具合潜在パターンDB123から不具合潜在パターン111を取得し、CRUD情報DB122からCRUD情報を取得する。不具合潜在箇所特定部104は、不具合潜在パターン111およびCRUD情報に基づいて、不具合潜在箇所を特定する。不具合潜在箇所特定部104は、不具合潜在箇所の情報と、CRUD情報とをCRUD図生成部105に出力する。 The potential fault location identification unit 104 acquires the potential fault pattern 111 from the potential fault pattern DB 123 and the CRUD information from the CRUD information DB 122 . The potential defect location identification unit 104 identifies a potential defect location based on the potential defect pattern 111 and the CRUD information. The potential fault point identification unit 104 outputs the information on the potential fault point and the CRUD information to the CRUD diagram generation unit 105 .

CRUD図生成部105は、不具合潜在箇所特定部104から取得した不具合潜在箇所の情報およびCRUD情報に基づいて、CRUD図113を生成して出力する。CRUD図113は、CRUD図113中の不具合潜在箇所を強調表示する情報を含む。ある局面において、CRUD図113中の不具合潜在箇所の強調表示は、不具合箇所のカラムの色の変更、不具合箇所のカラムの罫線処理、文字のサイズの変更、文字の強調、文字の色の変更またはこれらの組み合わせ等の任意の強調表示を含み得る。ユーザは、不具合箇所を強調表示されたCRUD図113を参照することで、ソースコード112に含まれる大域変数に起因する潜在的な不具合を容易に発見することができる。 The CRUD diagram generation unit 105 generates and outputs a CRUD diagram 113 based on the potential defect point information and the CRUD information acquired from the potential defect point identification unit 104 . The CRUD diagram 113 contains information that highlights potential faults in the CRUD diagram 113 . In a certain aspect, the highlighting of the potential defect location in the CRUD diagram 113 is performed by changing the color of the column of the defect location, processing the ruled line of the column of the defect location, changing the character size, emphasizing the character, changing the character color, or Any highlighting such as combinations of these may be included. By referring to the CRUD diagram 113 in which the defect location is highlighted, the user can easily discover potential defects caused by global variables included in the source code 112 .

ある局面において、解析データDB121、CRUD情報DB122および不具合潜在パターンDB123は、リレーショナルDBであってもよいし、JSON(JavaScript(登録商標) Object Notation)等の任意の形式のデータを含んでいてもよい。また、他の局面において、CRUD図生成装置100は、過去に取得または生成した不具合潜在箇所のデータおよびCRUD図113をメモリ(図示せず)に格納してもよい。 In one aspect, the analysis data DB 121, the CRUD information DB 122, and the potential defect pattern DB 123 may be relational DBs, or may contain data in any format such as JSON (JavaScript (registered trademark) Object Notation). . Further, in another aspect, the CRUD diagram generation device 100 may store data of latent failure points acquired or generated in the past and the CRUD diagram 113 in a memory (not shown).

図2は、CRUD図生成装置100のハードウェア構成の一例を示す図である。CRUD図生成装置100は、CPU(Central Processing Unit)201と、1次記憶装置202と、2次記憶装置203と、外部機器インターフェイス204と、入力インターフェイス205と、出力インターフェイス206と、通信インターフェイス207とを含む。 FIG. 2 is a diagram showing an example of the hardware configuration of the CRUD diagram generation device 100. As shown in FIG. The CRUD diagram generation device 100 includes a CPU (Central Processing Unit) 201, a primary storage device 202, a secondary storage device 203, an external device interface 204, an input interface 205, an output interface 206, and a communication interface 207. including.

CPU201は、CRUD図生成装置100の各種機能を実現するためのプログラムを実行し得る。CPU201は、例えば、少なくとも1つの集積回路によって構成される。集積回路は、例えば、少なくとも1つのCPU、少なくとも1つのFPGA(Field Programmable Gate Array)、またはこれらの組み合わせ等によって構成されてもよい。 The CPU 201 can execute programs for realizing various functions of the CRUD diagram generation device 100 . The CPU 201 is composed of, for example, at least one integrated circuit. The integrated circuit may be composed of, for example, at least one CPU, at least one FPGA (Field Programmable Gate Array), or a combination thereof.

1次記憶装置202は、CPU201によって実行されるプログラムと、CPU201によって参照されるデータとを格納する。ある局面において、1次記憶装置202は、DRAM(Dynamic Random Access Memory)またはSRAM(Static Random Access Memory)等によって実現されてもよい。 Primary storage device 202 stores programs executed by CPU 201 and data referred to by CPU 201 . In one aspect, the primary storage device 202 may be implemented by a DRAM (Dynamic Random Access Memory), an SRAM (Static Random Access Memory), or the like.

2次記憶装置203は、不揮発性メモリであり、CPU201によって実行されるプログラムおよびCPU201によって参照されるデータを格納してもよい。その場合、CPU201は、2次記憶装置203から1次記憶装置202に読み出されたプログラムを実行し、2次記憶装置203から1次記憶装置202に読み出されたデータを参照する。ある局面において、2次記憶装置203は、HDD(Hard Disk Drive)、SSD(Solid State Drive)、EPROM(Erasable Programmable Read Only Memory)、EEPROM(Electrically Erasable Programmable Read Only Memory)またはフラッシュメモリ等によって実現されてもよい。 The secondary storage device 203 is a non-volatile memory and may store programs executed by the CPU 201 and data referred to by the CPU 201 . In that case, the CPU 201 executes the program read from the secondary storage device 203 to the primary storage device 202 and refers to the data read from the secondary storage device 203 to the primary storage device 202 . In one aspect, the secondary storage device 203 is implemented by a HDD (Hard Disk Drive), SSD (Solid State Drive), EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory, or the like. may

外部機器インターフェイス204は、プリンター、スキャナーおよび外付けHDD等の任意の外部機器に接続され得る。ある局面において、外部機器インターフェイス204は、USB(Universal Serial Bus)端子等によって実現されてもよい。 The external device interface 204 can be connected to arbitrary external devices such as printers, scanners and external HDDs. In one aspect, the external device interface 204 may be realized by a USB (Universal Serial Bus) terminal or the like.

入力インターフェイス205は、キーボード、マウス、タッチパッドまたはゲームパッド等の任意の入力装置に接続され得る。ある局面において、入力インターフェイス205は、USB端子、PS/2端子およびBluetooth(登録商標)モジュール等によって実現されてもよい。 Input interface 205 may be connected to any input device such as a keyboard, mouse, touchpad or gamepad. In one aspect, the input interface 205 may be realized by a USB terminal, a PS/2 terminal, a Bluetooth (registered trademark) module, and the like.

出力インターフェイス206は、ブラウン管ディスプレイ、液晶ディスプレイまたは有機EL(Electro-Luminescence)ディスプレイ等の任意の出力装置に接続され得る。ある局面において、出力インターフェイス206は、USB端子、D-sub端子、DVI(Digital Visual Interface)端子およびHDMI(登録商標)(High-Definition Multimedia Interface)端子等によって実現されてもよい。 The output interface 206 can be connected to any output device such as a CRT display, a liquid crystal display, or an organic EL (Electro-Luminescence) display. In one aspect, the output interface 206 may be implemented by a USB terminal, a D-sub terminal, a DVI (Digital Visual Interface) terminal, an HDMI (registered trademark) (High-Definition Multimedia Interface) terminal, or the like.

通信インターフェイス207は、有線または無線のネットワーク機器と接続される。ある局面において、通信インターフェイス207は、有線LAN(Local Area Network)ポートおよびWi-Fi(登録商標)(Wireless Fidelity)モジュール等によって実現されてもよい。他の局面において、通信インターフェイス207は、TCP/IP(Transmission Control Protocol/Internet Protocol)、UDP(User Datagram Protocol)等の通信プロトコルを用いてデータを送受信してもよい。 The communication interface 207 is connected to wired or wireless network equipment. In one aspect, the communication interface 207 may be implemented by a wired LAN (Local Area Network) port, a Wi-Fi (registered trademark) (Wireless Fidelity) module, or the like. In another aspect, communication interface 207 may transmit and receive data using communication protocols such as TCP/IP (Transmission Control Protocol/Internet Protocol) and UDP (User Datagram Protocol).

次に、図3~図5を参照して、CRUD図生成装置100が参照または生成するCRUD情報、不具合潜在パターン111、および、CRUD図113について詳しく説明する。 Next, with reference to FIGS. 3 to 5, the CRUD information, potential fault pattern 111 and CRUD diagram 113 referenced or generated by the CRUD diagram generation device 100 will be described in detail.

図3は、本実施の形態に従うCRUD情報300の一例である。CRUD情報300は、各関数の各大域変数に対するCRUD処理の実行回数を示す。CRUD情報300は、例えば、図3に示すテーブル形式で、CRUD情報DB122に格納され得る。ある局面において、CRUD情報300は、JSON等の他の任意のデータ形式で表現されてもよい。CRUD情報300は、要素として、大域変数301と、関数302と、作成(C)303と、参照(R)304と、更新(U)305と、削除(D)306とを含む。 FIG. 3 is an example of CRUD information 300 according to this embodiment. The CRUD information 300 indicates the execution count of CRUD processing for each global variable of each function. The CRUD information 300 can be stored in the CRUD information DB 122 in the form of a table shown in FIG. 3, for example. In some aspects, CRUD information 300 may be expressed in any other data format, such as JSON. CRUD information 300 includes global variables 301, functions 302, creation (C) 303, reference (R) 304, update (U) 305, and deletion (D) 306 as elements.

大域変数301は、ソースコード112に含まれる各大域変数を示す。関数302は、大域変数を使用した関数を示す。図3に示す例では、関数「funcA」は、大域変数「g_val_01, g_val_02, g_val_03」を使用している。また、関数「funcB」も、大域変数「g_val_01, g_val_02, g_val_03」を使用している。 A global variable 301 indicates each global variable included in the source code 112 . Function 302 shows a function using global variables. In the example shown in FIG. 3, the function "funcA" uses global variables "g_val_01, g_val_02, g_val_03". Function "funcB" also uses global variables "g_val_01, g_val_02, g_val_03".

作成(C)303は、大域変数が作成された回数を示す。参照(R)304は、大域変数が参照された回数を示す。更新(U)305は、大域変数が更新された回数を示す。削除(D)306は、大域変数が削除された回数を示す。CRUD情報300のテーブルの1行目を例に説明すると、大域変数「g_val_01」は、関数「funcA」により、1回作成され、1回参照され、1回更新されているが、一度も削除されていない。また、CRUD情報300のテーブルの4行目を例に説明すると、大域変数「g_val_02」は、関数「funcB」により、1回更新され、1回削除されているが、作成および参照はされていない。 Creation (C) 303 indicates the number of times the global variable was created. References (R) 304 indicates the number of times the global variable has been referenced. Update (U) 305 indicates the number of times the global variable has been updated. Deletions (D) 306 indicates the number of times a global variable has been deleted. Taking the first row of the table of the CRUD information 300 as an example, the global variable "g_val_01" is created once, referenced once, and updated once by the function "funcA", but is never deleted. not Also, taking the fourth row of the table of the CRUD information 300 as an example, the global variable "g_val_02" is updated once and deleted once by the function "funcB", but is neither created nor referenced. .

図4は、本実施の形態に従う不具合潜在パターン111の一例である。不具合潜在パターン111は、CRUD図において問題を発生させ得るCRUD処理の実行回数の組み合わせを定義する。不具合潜在パターン111は、例えば、図4に示すテーブル形式で、不具合潜在パターンDB123に格納され得る。ある局面において、不具合潜在パターン111は、JSON等の他の任意のデータ形式で表現されてもよい。また、他の局面において、不具合潜在パターン入力部101は、必ずしも図4に示す形式のデータの入力を受け付ける必要はなく、大域変数ごとの潜在不具合パターンが含まれる任意の形式の情報の入力を受け付けてもよい。 FIG. 4 is an example of potential defect pattern 111 according to the present embodiment. The fault potential pattern 111 defines a combination of execution counts of CRUD processes that can cause problems in the CRUD diagram. The potential failure pattern 111 can be stored in the potential failure pattern DB 123 in the form of a table shown in FIG. 4, for example. In one aspect, the potential defect pattern 111 may be expressed in any other data format such as JSON. In another aspect, the potential failure pattern input unit 101 does not necessarily have to accept input of data in the format shown in FIG. may

不具合潜在パターン111は、要素として、ID(Identifier)401と、分類402と、対象403と、条件404とを含む。ID401は、各々の不具合を一意に示す。分類402は、不具合の分類を示す。図4に示す例では、分類402は、不具合および警告を含む。各不具合は、その危険度等に基づいて分類され得る。対象403は、その分析対象を示す。対象403は、例えば、大域変数および関数を含み得る。ある局面において、対象403は、オブジェクト指向プログラムのクラス等を含んでもよい。条件404は、不具合潜在箇所を検出する際の条件を示す。条件404は、CRUD処理の実行回数の組み合わせにより定義され得る。 The potential failure pattern 111 includes an ID (Identifier) 401, a classification 402, a target 403, and a condition 404 as elements. ID 401 uniquely indicates each fault. Classification 402 indicates the classification of the defect. In the example shown in FIG. 4, categories 402 include defects and warnings. Each failure can be classified based on its degree of risk and the like. Target 403 indicates the analysis target. Objects 403 may include, for example, global variables and functions. In one aspect, object 403 may include classes of object-oriented programs, and the like. A condition 404 indicates a condition for detecting a potential defect location. Conditions 404 may be defined by a combination of CRUD process execution counts.

図4のテーブルの1行目を例に説明すると、CRUD図生成装置100は、対象403「大域変数」において、条件404「C>0&&D==0(作成(C)が1回以上実行され、かつ、削除(D)が一度も実行されない)」が確認されたとき、ある大域変数において、分類402「不具合」の潜在的な不具合があると判定する。図4のテーブルの1行目は、大域変数のインスタンスが生成されているが(または、大域変数に動的にメモリが確保されたが)、大域変数のインスタンスが破棄されていない(または、大域変数に動的に確保されたメモリが解放されてない)ことを示す。このような場合、メモリリークが発生し得る。 Taking the first row of the table in FIG. 4 as an example, the CRUD diagram generation device 100 executes the condition 404 “C>0 && D==0 (creation (C) is executed one or more times in the target 403 “global variable”, and deletion (D) is never executed)" is confirmed, it is determined that there is a potential failure of the category 402 "Failure" in a certain global variable. The first row of the table in FIG. 4 indicates that a global variable instance has been created (or memory has been dynamically allocated to the global variable), but the global variable instance has not been destroyed (or the global indicates that the dynamically allocated memory for the variable has not been released). In such cases, memory leaks can occur.

図4のテーブルの2行目を例に説明すると、CRUD図生成装置100は、対象403「大域変数」において、条件404「U>0&&R==0(更新(U)が1回以上実行され、かつ、参照(R)が一度も実行されない)」が確認されたとき、ある大域変数において、分類402「警告」の潜在的な不具合があると判定する。図4のテーブルの2行目は、大域変数が更新されているが、その後一度も参照されていないことを示す。このような場合、ソースコード112は意味の無い処理を含む可能性がある。 Taking the second row of the table in FIG. 4 as an example, the CRUD diagram generation device 100 executes the condition 404 “U>0 && R==0 (update (U) is executed one or more times in the object 403 “global variable”, and the reference (R) is never executed)" is confirmed, it is determined that there is a potential failure of category 402 "Warning" in a certain global variable. The second row of the table in FIG. 4 indicates that the global variable has been updated but has never been referenced since. In such cases, the source code 112 may contain meaningless processing.

ある局面において、対象403に「関数」が指定されていた場合、CRUD図生成装置100は、各関数における全ての大域変数に対するCRUD情報を合算する。CRUD図生成装置100は、各関数の合算結果が、条件404に含まれるパターンに合致するか否かを判定する。CRUD図生成装置100は、ある関数の合算結果が条件404に含まれるパターンに合致する場合、当該関数において潜在的な不具合があると判定する。 In a certain aspect, when a "function" is specified as the object 403, the CRUD diagram generation device 100 adds up CRUD information for all global variables in each function. The CRUD diagram generation device 100 determines whether the result of adding each function matches the pattern included in the condition 404 . The CRUD diagram generation device 100 determines that there is a potential problem in a function when the result of summation of a function matches the pattern included in the condition 404 .

図5は、本実施の形態に従うCRUD図113の一例を示す図である。CRUD図113は、各関数の各大域変数に対するCRUD処理の実行回数の情報を含む。また、CRUD図113は、不具合潜在箇所を強調表示する。 FIG. 5 is a diagram showing an example of the CRUD diagram 113 according to this embodiment. The CRUD diagram 113 contains information on the number of CRUD processing executions for each global variable of each function. In addition, the CRUD diagram 113 highlights potential fault locations.

CRUD図113は、要素として、大域変数501と、関数502,503を含む。なお、図5に示す関数「funcA, funcB」は一例であり、ある局面において、CRUD図113は、ソースコード112内の1以上の任意の数の関数を要素として含み得る。 The CRUD diagram 113 includes a global variable 501 and functions 502 and 503 as elements. Note that the functions “funcA, funcB” shown in FIG. 5 are only examples, and in a certain aspect, the CRUD diagram 113 may include any number of functions, one or more, in the source code 112 as elements.

図5の一行目を例に説明すると、大域変数501「g_val_01」は、関数502「funcA」において、1回作成(C)され、1回参照(R)され、1回更新(U)されている。また大域変数501「g_val_01」は、関数503「funcB」において、2回参照(R)され、1回更新(U)されている。図5の一行目は、図4の1行目の条件404「C>0&&D==0」に合致するため、強調表示されている。 Taking the first line of FIG. 5 as an example, the global variable 501 “g_val_01” is created (C) once, referenced (R) once, and updated (U) once in the function 502 “funcA”. there is The global variable 501 "g_val_01" is referenced (R) twice and updated (U) once in the function 503 "funcB". The first line in FIG. 5 is highlighted because it matches the condition 404 “C>0&&D==0” in the first line in FIG.

図5の二行目を例に説明すると、大域変数501「g_val_02」は、関数502「funcA」において、1回作成(C)され、2回更新(U)されている。また大域変数501「g_val_02」は、関数503「funcB」において、1回更新(U)され、1回削除(D)されている。図5の二行目は、図4の2行目の条件404「U>0&&R==0」に合致するため、強調表示されている。なお、CRUD図113の強調表示は、分類402に応じて、適宜変更され得る。 Taking the second line in FIG. 5 as an example, the global variable 501 “g_val — 02” is created (C) once and updated (U) twice in the function 502 “funcA”. The global variable 501 "g_val_02" is updated (U) once and deleted (D) once in the function 503 "funcB". The second line in FIG. 5 is highlighted because it matches the condition 404 “U>0&&R==0” in the second line in FIG. Note that the highlighting of the CRUD diagram 113 can be changed as appropriate according to the classification 402 .

図5の3行目は、図4のいずれの条件404にも合致しないため、強調表示されない。このように、CRUD図生成装置100は、不具合潜在箇所を強調表示したCRUD図113を出力する。ユーザは、当該CRUD図113を参照することで、ソースコード112内の大域変数による潜在的な不具合を含み得る箇所を発見しやすくなる。 Row 3 in FIG. 5 is not highlighted because none of the conditions 404 in FIG. 4 are met. In this way, the CRUD diagram generation device 100 outputs the CRUD diagram 113 in which potential failure points are highlighted. By referring to the CRUD diagram 113, the user can easily find a location that may contain potential problems due to global variables in the source code 112. FIG.

次に、図6~図11を参照して、CRUD図生成装置100が、ソースコード112を解析してCRUD図113を出力するまでの処理の手順について説明する。ある局面において、CPU201は、図6~図9、図11および図12の各処理を行うためのプログラムを2次記憶装置203から1次記憶装置202に読み込んで、当該プログラムを実行してもよい。他の局面において、当該処理の一部または全部は、当該処理を実行するように構成された回路素子の組み合わせとしても実現され得る。 Next, with reference to FIGS. 6 to 11, the procedure of processing by the CRUD diagram generation device 100 to analyze the source code 112 and output the CRUD diagram 113 will be described. In one aspect, the CPU 201 may load a program for performing each process of FIGS. 6 to 9, 11 and 12 from the secondary storage device 203 to the primary storage device 202 and execute the program. . In other aspects, part or all of the process may also be implemented as a combination of circuit elements configured to perform the process.

図6は、CRUD図生成装置100における不具合潜在パターン111の登録処理の手順の一例を示す図である。ステップS610において、CPU201は、入力インターフェイス205を介して、1または複数の不具合潜在パターン111を含む不具合潜在パターンファイルを取得する。ある局面において、CPU201は、外部機器インターフェイス204または通信インターフェイス207を介して、不具合潜在パターンファイルを取得してもよい。 FIG. 6 is a diagram showing an example of a procedure for registering the latent failure pattern 111 in the CRUD diagram generation device 100. As shown in FIG. In step S<b>610 , the CPU 201 acquires a potential defect pattern file including one or more potential defect patterns 111 via the input interface 205 . In one aspect, CPU 201 may acquire a potential failure pattern file via external device interface 204 or communication interface 207 .

ステップS620において、CPU201は、全ての不具合潜在パターン111の登録処理を完了するまで、ループ内部の処理を繰り返し実行する。ステップS630において、CPU201は、不具合潜在パターンファイルの中から1つの不具合潜在パターン111を取得する。 In step S<b>620 , the CPU 201 repeatedly executes the processing inside the loop until the registration processing of all potential defect patterns 111 is completed. In step S630, the CPU 201 acquires one potential defect pattern 111 from the potential defect pattern file.

ステップS640において、CPU201は、ステップS630にて取得した不具合潜在パターン111が、既に不具合潜在パターンDB123に登録されているか否かを判定する。CPU201は、ステップS630にて取得した不具合潜在パターン111が、既に不具合潜在パターンDB123に登録されていると判定した場合(ステップS640にてYES)、制御をステップS620に移す。そうでない場合(ステップS640にてNO)、CPU201は、制御をステップS650に移す。ステップS650において、CPU201は、ステップS630にて取得した不具合潜在パターン111を不具合潜在パターンDB123に登録する。 In step S<b>640 , the CPU 201 determines whether the potential defect pattern 111 acquired in step S<b>630 has already been registered in the potential defect pattern DB 123 . When CPU 201 determines that latent failure pattern 111 acquired in step S630 is already registered in latent failure pattern DB 123 (YES in step S640), CPU 201 shifts control to step S620. Otherwise (NO in step S640), CPU 201 shifts the control to step S650. In step S<b>650 , the CPU 201 registers the potential defect pattern 111 acquired in step S<b>630 in the potential defect pattern DB 123 .

図7は、CRUD図生成装置100におけるソースコード112の取得からCRUD図113の生成までの手順の一例を示す図である。ステップS710において、CPU201は、取得したソースコード112に対して静的解析を実行する。CPU201は、解析データを解析データDB121に格納する。 FIG. 7 is a diagram showing an example of the procedure from acquisition of the source code 112 to generation of the CRUD diagram 113 in the CRUD diagram generation device 100. As shown in FIG. In step S<b>710 , the CPU 201 performs static analysis on the obtained source code 112 . The CPU 201 stores the analysis data in the analysis data DB 121. FIG.

ステップS720において、CPU201は、解析データからCRUD情報を抽出する。CPU201は、CRUD情報をCRUD情報DB122に格納する。ステップS720の処理の詳細については図8を参照して説明する。 In step S720, the CPU 201 extracts CRUD information from the analysis data. The CPU 201 stores CRUD information in the CRUD information DB 122 . Details of the processing of step S720 will be described with reference to FIG.

ステップS730において、CPU201は、不具合潜在パターン111に基づいて、ソースコード112内の不具合潜在箇所を特定する。ある局面において、CPU201は、不具合潜在箇所のデータを2次記憶装置203に格納してもよい。ステップS730の処理の詳細については図9を参照して説明する。 In step S<b>730 , the CPU 201 identifies a potential defect location in the source code 112 based on the potential defect pattern 111 . In one aspect, the CPU 201 may store the data of potential defect locations in the secondary storage device 203 . Details of the processing in step S730 will be described with reference to FIG.

ステップS740において、CPU201は、CRUD情報および不具合潜在箇所からCRUD図113を生成して出力する。ある局面において、CPU201は、CRUD図113を2次記憶装置203に格納してもよい。ステップS740の処理の詳細については図11を参照して説明する。 In step S740, the CPU 201 generates and outputs the CRUD diagram 113 from the CRUD information and potential defect locations. In one aspect, CPU 201 may store CRUD diagram 113 in secondary storage device 203 . Details of the processing of step S740 will be described with reference to FIG.

図8は、CRUD図生成装置100におけるCRUD情報の抽出処理の手順の一例を示す図である。図8に示す処理は、図7のステップS720に対応する。ステップS810において、CPU201は、解析データに含まれる全ての変数の確認を完了するまで、ループ内部の処理を繰り返し実行する。 FIG. 8 is a diagram showing an example of a procedure of CRUD information extraction processing in the CRUD diagram generation device 100. As shown in FIG. The processing shown in FIG. 8 corresponds to step S720 in FIG. In step S810, the CPU 201 repeatedly executes the processing inside the loop until confirmation of all variables included in the analysis data is completed.

ステップS820において、CPU201は、解析データから変数を取り出す。ここでの変数は、ソースコード112に含まれる全ての変数を指し、また、大域変数および局所変数(ローカル変数)の両方を含み得る。ある局面において、変数は、構造体、配列、ポインタおよびクラス等を含み得る。 In step S820, the CPU 201 extracts variables from the analysis data. Variables here refer to all variables contained in source code 112 and may include both global variables and local variables. In some aspects, variables may include structures, arrays, pointers, classes, and the like.

ステップS830において、CPU201は、取得した変数が大域変数であるか否かを判定する。CPU201は、取得した変数が大域変数であると判定した場合(ステップS830にてYES)、制御をステップS840に移す。そうでない場合(ステップS830にてNO)、CPU201は、制御をステップS820に移す。 In step S830, CPU 201 determines whether the acquired variable is a global variable. When CPU 201 determines that the acquired variable is a global variable (YES in step S830), control proceeds to step S840. Otherwise (NO in step S830), CPU 201 shifts the control to step S820.

ステップS840において、CPU201は、解析データに含まれる全ての関数の確認を完了するまで、ステップS850~ステップS870の処理を繰り返し実行する。ステップS850において、CPU201は、解析データから参照関数を取り出す。参照関数とは、ステップS820にて取得された変数に対して、CRUD処理を実行する関数である。 In step S840, the CPU 201 repeatedly executes the processing of steps S850 to S870 until confirmation of all functions included in the analysis data is completed. In step S850, CPU 201 retrieves the reference function from the analysis data. A reference function is a function that executes CRUD processing on the variables acquired in step S820.

ステップS860において、CPU201は、CRUD情報を抽出する。より具体的には、CPU201は、ステップS850にて取り出された参照関数の、ステップS820にて取得された変数に対する、CRUD情報を抽出する。 In step S860, the CPU 201 extracts CRUD information. More specifically, the CPU 201 extracts CRUD information for the variable obtained in step S820 of the reference function extracted in step S850.

ステップS870において、CPU201は、ステップS860にて抽出したCRUD情報をCRUD情報DB122に登録する。すでに、同一のデータがCRUD情報DB122に登録されていた場合、CPU201は、本ステップの処理を実行しなくてもよい。 In step S870, the CPU 201 registers the CRUD information extracted in step S860 in the CRUD information DB 122. FIG. If the same data has already been registered in the CRUD information DB 122, the CPU 201 does not have to execute the process of this step.

図9は、CRUD図生成装置100における不具合潜在箇所の特定処理の手順の一例を示す図である。図9に示す処理は、図7のステップS730に対応する。ステップS905において、CPU201は、全ての不具合潜在パターンの確認が完了するまでループ内部の処理を繰り返し実行する。ステップS910において、CPU201は、不具合潜在パターンDB123から、不具合潜在パターン111を取り出す。 FIG. 9 is a diagram showing an example of a procedure for specifying a latent failure point in the CRUD diagram generation device 100. As shown in FIG. The processing shown in FIG. 9 corresponds to step S730 in FIG. In step S905, the CPU 201 repeatedly executes the processing inside the loop until confirmation of all potential failure patterns is completed. In step S<b>910 , the CPU 201 retrieves the potential defect pattern 111 from the potential defect pattern DB 123 .

ステップS915において、CPU201は、判定対象が大域変数であるか否かを判定する。ここでの判定対象とは、ステップS910にて取得された不具合潜在パターン111に合致するか否かを判定される対象である。判定対象は、大域変数および関数を含み得る。ある局面において、大域変数は、構造体、配列、および、ポインタ等を含んでいてもよい。また、他の局面において、判定対象は、変数または/および関数を含むクラスを含んでいてもよい。CPU201は、判定対象が大域変数であると判定した場合(ステップS915にてYES)、制御をステップS920に移す。そうでない場合(ステップS915にてNO)、CPU201は、制御をステップS945に移す。 In step S915, the CPU 201 determines whether the determination target is a global variable. The determination target here is the target for determination as to whether or not it matches the defect potential pattern 111 acquired in step S910. Objects to be determined may include global variables and functions. In one aspect, global variables may include structures, arrays, pointers, and the like. In another aspect, the determination target may include classes including variables and/or functions. When CPU 201 determines that the determination target is a global variable (YES in step S915), CPU 201 moves the control to step S920. Otherwise (NO in step S915), CPU 201 shifts the control to step S945.

ステップS920において、CPU201は、全ての大域変数の確認を完了するまでループ内の処理を繰り返し実行する。ステップS925において、CPU201は、CRUD情報から大域変数を取り出す。 In step S920, the CPU 201 repeatedly executes the processing within the loop until confirmation of all global variables is completed. In step S925, the CPU 201 extracts global variables from the CRUD information.

ステップS930において、CPU201は、大域変数のCRUD情報を合算する。ここでの合算とは、ステップS925にて取得された大域変数に対する各関数のCRUD処理の実行回数の合算である。例えば、大域変数「g_val_01」は、関数「funcA」によりCRUD処理「C(1)R(1)U(1)D(0)」を実行されるとする(例えば、C(1)は、作成(C)の1回実行を意味する)。また、大域変数「g_val_01」は、関数「funcB」によりCRUD処理「C(0)R(2)U(1)D(0)」を実行されるとする。この場合、CPU201は、関数「funcA」によるCRUD処理「C(1)R(1)U(1)D(0)」と、関数「funcB」によるCRUD処理「C(0)R(2)U(1)D(0)」とを合算して、合算結果「C(1)R(3)U(2)D(0)」を得る。 In step S930, the CPU 201 sums the CRUD information of the global variables. The sum here is the sum of the number of CRUD processing execution times of each function for the global variables acquired in step S925. For example, global variable "g_val_01" is assumed to have CRUD processing "C(1)R(1)U(1)D(0)" executed by function "funcA" (for example, C(1) is created means one execution of (C)). It is also assumed that the global variable "g_val_01" is subjected to the CRUD processing "C(0)R(2)U(1)D(0)" by the function "funcB". In this case, the CPU 201 executes CRUD processing “C(1)R(1)U(1)D(0)” by function “funcA” and CRUD processing “C(0)R(2)U” by function “funcB”. (1) D(0)” to obtain the sum result “C(1)R(3)U(2)D(0)”.

ステップS935において、CPU201は、合算結果が取り出した不具合潜在パターン111に合致するか否かを判定する。CPU201は、合算結果が取り出した不具合潜在パターン111に合致すると判定した場合(ステップS935にてYES)、制御をステップS940に移す。そうでない場合(ステップS935にてNO)、CPU201は、制御をステップS925に移す。 In step S<b>935 , the CPU 201 determines whether or not the result of summation matches the extracted defect potential pattern 111 . When CPU 201 determines that the result of summation matches potential defect pattern 111 extracted (YES in step S935), CPU 201 shifts the control to step S940. Otherwise (NO in step S935), CPU 201 shifts the control to step S925.

ステップS940において、CPU201は、不具合潜在パターン111に合致するCRUD処理を実行される大域変数を不具合潜在箇所として登録する。ある局面において、CPU201は、当該登録結果を2次記憶装置203に格納してもよい。 In step S940, the CPU 201 registers a global variable for which CRUD processing that matches the potential defect pattern 111 is executed as a potential defect location. In one aspect, CPU 201 may store the registration result in secondary storage device 203 .

ステップS945において、CPU201は、全ての関数の確認を完了するまでループ内の処理を繰り返し実行する。ステップS950において、CPU201は、CRUD情報から関数を取り出す。 In step S945, the CPU 201 repeatedly executes the processing in the loop until confirmation of all functions is completed. In step S950, the CPU 201 extracts functions from the CRUD information.

ステップS955において、CPU201は、ステップS950にて取り出した関数のCRUD処理の実行回数(CRUD情報)を合算する。例えば、関数「funcA」が、大域変数「g_val_01, g_val_02, g_val_03」の各々に対してCRUD処理「C(1)R(1)U(1)D(0)」、CRUD処理「C(1)R(0)U(2)D(0)」およびCRUD処理「C(1)R(1)U(1)D(0)」の各々を実行するとする。この場合、CPU201は、関数「funcA」の大域変数「g_val_01, g_val_02, g_val_03」の各々に対するCRUD処理の合算結果「C(3)R(2)U(4)D(0)」を得る。 In step S955, the CPU 201 adds up the number of CRUD processing executions (CRUD information) of the functions extracted in step S950. For example, the function "funcA" performs CRUD processing "C(1)R(1)U(1)D(0)", CRUD processing "C(1) R(0)U(2)D(0)" and CRUD processing "C(1)R(1)U(1)D(0)" respectively. In this case, the CPU 201 obtains the result "C(3)R(2)U(4)D(0)" of the CRUD processing for each of the global variables "g_val_01, g_val_02, g_val_03" of the function "funcA".

ステップS960において、CPU201は、合算結果が取り出した不具合潜在パターン111に合致するか否かを判定する。CPU201は、合算結果が取り出した不具合潜在パターン111に合致すると判定した場合(ステップS960にてYES)、制御をステップS965に移す。そうでない場合(ステップS960にてNO)、CPU201は、制御をステップS945に移す。 In step S<b>960 , the CPU 201 determines whether or not the result of summation matches the extracted defect potential pattern 111 . When CPU 201 determines that the result of summation matches potential defect pattern 111 extracted (YES in step S960), CPU 201 shifts the control to step S965. Otherwise (NO in step S960), CPU 201 shifts the control to step S945.

ステップS965において、CPU201は、不具合潜在パターン111に合致するCRUD処理を実行する関数を不具合潜在箇所として登録する。ある局面において、CPU201は、当該登録結果を2次記憶装置203に格納してもよい。 In step S965, the CPU 201 registers a function that executes CRUD processing that matches the potential defect pattern 111 as a potential defect location. In one aspect, CPU 201 may store the registration result in secondary storage device 203 .

図10は、本実施の形態に従う不具合潜在箇所のデータ1000の一例を示す図である。不具合潜在箇所のデータ1000は、図9に示す処理により生成および登録される。不具合潜在箇所のデータ1000は、要素として、ID1001と、不具合潜在箇所1002と、種別1003と、分類1004とを含む。 FIG. 10 is a diagram showing an example of data 1000 of potential defect locations according to the present embodiment. The data 1000 of potential defect locations is generated and registered by the process shown in FIG. Potential defect location data 1000 includes an ID 1001, a potential defect location 1002, a type 1003, and a classification 1004 as elements.

ID1001は、不具合潜在箇所のデータ1000に含まれる不具合潜在箇所を一意に識別する。不具合潜在箇所1002は、不具合が潜在する可能性がある大域変数または関数を示す。種別1003は、不具合潜在箇所1002の種類を示す。種別1003は、大域変数および関数を含み得る。分類1004は、不具合の分類を示す。分類1004は、不具合および警告を含み得る。 The ID 1001 uniquely identifies a potential defect location included in the data 1000 of the potential defect location. Potential fault locations 1002 indicate global variables or functions that may have potential faults. The type 1003 indicates the type of the latent defect location 1002 . Types 1003 may include global variables and functions. Classification 1004 indicates the classification of the defect. Categories 1004 may include defects and warnings.

図11は、CRUD図生成装置100におけるCRUD図113の生成処理の手順の一例を示す図である。図11に示す処理は、図7のステップS740に対応する。 FIG. 11 is a diagram showing an example of the procedure of generation processing of the CRUD diagram 113 in the CRUD diagram generation device 100. As shown in FIG. The processing shown in FIG. 11 corresponds to step S740 in FIG.

ステップS1110において、CPU201は、CRUD情報DB122から、大域変数の一覧を取り出す。ステップS1120において、CPU201は、CRUD情報DB122から、関数一覧を取り出す。ある局面において、CPU201は、ステップS1110およびステップS1120の処理を同時に実行してもよい。 In step S<b>1110 , the CPU 201 retrieves a list of global variables from the CRUD information DB 122 . In step S<b>1120 , the CPU 201 retrieves a function list from the CRUD information DB 122 . In one aspect, CPU 201 may simultaneously execute the processes of steps S1110 and S1120.

ステップS1130において、CPU201は、取り出した全ての大域変数の確認が完了するまでループ内の処理を繰り返し実行する。ステップS1140において、CPU201は、CPU201は、取り出した全ての関数の確認が完了するまでループ内の処理を繰り返し実行する。ステップS1150において、CPU201は、CRUD情報DB122から取り出した大域変数および関数のCRUD図113を生成する。ステップS1160において、CPU201は、不具合潜在箇所のデータ1000に基づいて、CRUD図113内の不具合潜在箇所を強調表示に変更する。CPU201は、不具合潜在箇所を強調表示したCRUD図113を出力する。 In step S1130, the CPU 201 repeatedly executes the processing in the loop until confirmation of all the global variables taken out is completed. In step S1140, CPU 201 repeatedly executes the processing in the loop until confirmation of all the extracted functions is completed. In step S1150, the CPU 201 generates a CRUD diagram 113 of global variables and functions retrieved from the CRUD information DB 122. FIG. In step S1160, the CPU 201 changes the display of the potential defect location in the CRUD diagram 113 to a highlighted display based on the data 1000 of the potential defect location. The CPU 201 outputs a CRUD diagram 113 in which potential fault locations are highlighted.

以上説明したように、本実施の形態に従うCRUD図生成装置100は、プログラムのソースコード112を解析し、大域変数の処理に起因する不具合潜在箇所を強調表示したCRUD図113を出力する機能を備える。当該機能により、ユーザは、通常では発見することが難しい大域変数の処理に起因する不具合を発見しやすくなる。 As described above, the CRUD diagram generation device 100 according to the present embodiment has the function of analyzing the source code 112 of the program and outputting the CRUD diagram 113 highlighting potential failure points caused by the processing of global variables. . This function makes it easier for the user to find defects caused by the processing of global variables, which are usually difficult to find.

実施の形態2.
次に、実施の形態2について説明する。本実施の形態は、タスクリストに基づくCRUD図を生成する点で、実施の形態1とは異なる。なお、実施の形態1と同一の構成については同じ符号を付し、説明を繰り返さない。
Embodiment 2.
Next, Embodiment 2 will be described. This embodiment differs from the first embodiment in that a CRUD diagram is generated based on a task list. The same reference numerals are assigned to the same configurations as those of the first embodiment, and description thereof will not be repeated.

図12は、本実施の形態に従うCRUD図生成装置1200の機能構成の一例を示す図である。ある局面において、図12に示す各機能ブロックは、図2に示すハードウェアがソフトウェアと協働することにより実現され得る。 FIG. 12 is a diagram showing an example of the functional configuration of CRUD diagram generation device 1200 according to the present embodiment. In one aspect, each functional block shown in FIG. 12 can be realized by the hardware shown in FIG. 2 cooperating with software.

CRUD図生成装置1200は、不具合潜在パターン入力部1201と、静的解析部102と、CRUD情報抽出部1203と、タスク結合部1206と、不具合潜在箇所特定部1204と、CRUD図生成部1205とを備える。 The CRUD diagram generation device 1200 includes a potential failure pattern input unit 1201, a static analysis unit 102, a CRUD information extraction unit 1203, a task combination unit 1206, a potential failure location identification unit 1204, and a CRUD diagram generation unit 1205. Prepare.

タスクリスト1214は、タスク(機能)の名称と、当該タスクのエントリーポイントとなる関数名とを含む。例えば、タスクとは、オンラインショップのソフトウェアにおける、商品の購入処理等の個別の機能を含み得る。また、エントリーポイントとなる関数とは、当該タスクの処理を開始する関数である。 The task list 1214 includes task (function) names and function names that are entry points of the tasks. For example, tasks may include individual functions such as processing product purchases in online shop software. Also, the entry point function is a function that starts the processing of the task.

タスク結合部1206は、取得したタスクリスト1214に基づいて、タスクリスト1214に含まれるタスクに関連する関数をグループ化する。以下、あるタスクに関連する関数をグループ化したデータを「タスク情報」と呼ぶ。タスク結合部1206は、当該タスク情報を解析データDB121に保存する。当該タスク情報は、静的解析部102の出力する解析データに関連付けられていてもよい。 The task combiner 1206 groups the functions associated with the tasks included in the task list 1214 based on the obtained task list 1214 . Hereinafter, data in which functions related to a certain task are grouped will be referred to as "task information". The task combining unit 1206 saves the task information in the analysis data DB 121. FIG. The task information may be associated with analysis data output by the static analysis unit 102 .

不具合潜在パターン入力部1201は、タスク単位の不具合潜在パターン1211の入力を受け付ける。CRUD情報抽出部1203は、タスク情報に基づき、タスク単位でCRUD情報を抽出する。ある局面において、CRUD情報抽出部1203は、解析データから関数単位でCRUD情報を抽出してもよい。その場合、不具合潜在箇所特定部1204が、タスク単位となるように、関数のCRUD情報を合算し得る。 The potential failure pattern input unit 1201 receives an input of a potential failure pattern 1211 for each task. The CRUD information extraction unit 1203 extracts CRUD information for each task based on the task information. In one aspect, the CRUD information extraction unit 1203 may extract CRUD information in units of functions from the analysis data. In that case, the potential fault point identification unit 1204 can add up the CRUD information of the functions so that each task is processed.

不具合潜在箇所特定部1204は、タスク単位で、ソースコード112内に潜在的不具合があるか否かを特定する。すなわち、不具合潜在箇所特定部1204は、タスクが含む関数群のCRUD情報の合算値に基づいて、ソースコード112内に潜在的不具合があるか否かを特定する。 The potential fault location identification unit 1204 identifies whether or not there is a potential fault in the source code 112 on a task-by-task basis. In other words, the potential defect location identification unit 1204 identifies whether or not there is a potential defect in the source code 112 based on the sum of the CRUD information of the functions included in the task.

CRUD図生成部1205は、大域変数におけるタスク単位でのCRUD情報を含むCRUD図1215を生成する。強調表示される不具合特定箇所もタスク単位となる。タスク単位でのCRUD情報は、タスクに含まれる各関数のCRUD情報の合算値である。 The CRUD diagram generation unit 1205 generates a CRUD diagram 1215 including CRUD information for each task in global variables. The defect identification location highlighted is also a task unit. The CRUD information for each task is the total value of the CRUD information of each function included in the task.

図13は、タスクの一例を示す図である。図13に示す例では、ソースコード112は、タスク1300と、タスク1310とを含む(タスクを機能と呼び変えてもよい)。また、タスク1300は、関数「funcA, funcB, funcC, funcD, funcE, funcF」を含む。タスク1310は、関数「funcG, funcH, funcI」を含む。この場合、タスク1300のCRUD情報とは、関数「funcA, funcB, funcC, funcD, funcE, funcF」の各々のCRUD情報の合算値になる。また、タスク1310のCRUD情報とは、関数「funcG, funcH, funcI」の各々のCRUD情報の合算値になる。 FIG. 13 is a diagram illustrating an example of tasks. In the example shown in FIG. 13, source code 112 includes task 1300 and task 1310 (tasks may be called functions). Task 1300 also includes functions "funcA, funcB, funcC, funcD, funcE, funcF." Task 1310 includes the functions "funcG, funcH, funcI". In this case, the CRUD information of the task 1300 is the sum of the CRUD information of the functions "funcA, funcB, funcC, funcD, funcE, funcF". Also, the CRUD information of the task 1310 is the sum of the CRUD information of the functions "funcG, funcH, funcI".

図14は、タスク単位の不具合潜在パターン1211の一例を示す図である。不具合潜在パターン1211は、要素として、ID1401と、分類1402と、対象1403と、条件1404とを含む。不具合潜在パターン1211は、例えば、図14に示すテーブル形式で、不具合潜在パターンDB123に格納され得る。ある局面において、不具合潜在パターン1211は、JSON等の他の任意のデータ形式で表現されてもよい。 FIG. 14 is a diagram showing an example of a potential defect pattern 1211 for each task. The potential defect pattern 1211 includes an ID 1401, a category 1402, a target 1403, and a condition 1404 as elements. The potential defect pattern 1211 can be stored in the potential defect pattern DB 123 in the form of a table shown in FIG. 14, for example. In one aspect, the potential defect pattern 1211 may be expressed in any other data format such as JSON.

ID1401は、各々の不具合を一意に示す。分類1402は、不具合の分類を示す。図14に示す例では、分類1402は、「不具合」および「警告」を含む。各不具合は、その危険度等に基づいて分類され得る。対象1403は、その分析対象を示す。対象1403は、例えば、大域変数(タスク)、大域変数および関数を含み得る。大域変数(タスク)とは、タスク単位でCRUD情報を解析される大域変数である。条件1404は、不具合潜在箇所を検出する際の条件を示す。図14に示す例において、条件1404は、「タスク参照数>=4(4つ以上のタスクから参照される大域変数)」と「タスク参照数==1(単一のタスクのみから参照される大域変数)」とを含む。 ID 1401 uniquely indicates each fault. Classification 1402 indicates the classification of the defect. In the example shown in FIG. 14, categories 1402 include "malfunction" and "warning." Each failure can be classified based on its degree of risk and the like. Target 1403 indicates the analysis target. Objects 1403 may include, for example, global variables (tasks), global variables and functions. A global variable (task) is a global variable whose CRUD information is analyzed for each task. A condition 1404 indicates a condition for detecting a potential defect location. In the example shown in FIG. 14, the conditions 1404 are "number of task references >= 4 (global variables referenced by four or more tasks)" and "number of task references == 1 (referenced by only a single task)". global variables)”.

例えば、単一のタスクのみから参照されている大域変数は、局所変数に変更可能な場合がある。CRUD図生成装置1200は、単一のタスクのみから参照されている大域変数をリファクタリングの指標としてユーザに提示することにより、ソースコード112の不具合解析の工数を削減し得る。 For example, a global variable that is only referenced by a single task may be changed to a local variable. The CRUD diagram generation device 1200 can reduce man-hours for failure analysis of the source code 112 by presenting global variables that are referenced only by a single task to the user as refactoring indicators.

図15は、タスク単位のCRUD図1215の一例を示す図である。CRUD図1215は、要素として、大域変数1501と、タスク1502~1505とを含む。なお、タスク1502~1505は一例であり、ある局面において、CRUD図1215は、任意の数のタスクを要素として含んでいてもよい。図15に示す例では、複数の関数がタスク1~タスク4に集約されている。各タスクのGRUD情報は、各タスクに含まれる関数のCRUD情報の合算値(タスク単位のCRUD情報)である。 FIG. 15 is a diagram showing an example of a CRUD diagram 1215 for each task. The CRUD diagram 1215 includes global variables 1501 and tasks 1502-1505 as elements. It should be noted that tasks 1502-1505 are examples, and in some aspects, CRUD diagram 1215 may include any number of tasks as elements. In the example shown in FIG. 15, a plurality of functions are aggregated into tasks 1-4. The GRUD information of each task is the sum of the CRUD information of the functions included in each task (CRUD information for each task).

CRUD図1215の一行目は、大域変数1501「g_val_01」が4つ以上のタスクから参照されており、不具合潜在パターン1211に含まれる条件1404「タスク参照数>=4」に合致するため、強調表示されている。また、CRUD図1215の三行目は、大域変数「g_val_03」が1つのタスクから参照されており、不具合潜在パターンに含まれる条件「タスク参照数==1」に合致するため、強調表示されている。 The first line of the CRUD diagram 1215 is highlighted because the global variable 1501 "g_val_01" is referenced by four or more tasks and matches the condition 1404 "number of task references >= 4" included in the defect potential pattern 1211. It is In addition, the third line of the CRUD diagram 1215 is highlighted because the global variable "g_val_03" is referenced from one task and matches the condition "task reference count == 1" included in the defect potential pattern. there is

次に、図16および図17を参照して、CRUD図生成装置1200が、タスクを結合する処理と、不具合潜在箇所を特定する処理とについて説明する。ある局面において、CPU201は、図16および図17の処理を行うためのプログラムを2次記憶装置203から1次記憶装置202に読み込んで、当該プログラムを実行してもよい。他の局面において、当該処理の一部または全部は、当該処理を実行するように構成された回路素子の組み合わせとしても実現され得る。 Next, referring to FIGS. 16 and 17, the CRUD diagram generation device 1200 will describe the process of combining tasks and the process of identifying potential fault locations. In one aspect, CPU 201 may load a program for performing the processes of FIGS. 16 and 17 from secondary storage device 203 to primary storage device 202 and execute the program. In other aspects, part or all of the process may also be implemented as a combination of circuit elements configured to perform the process.

図16は、CRUD図生成装置1200におけるタスク結合処理の一例を示す図である。ステップS1610において、CPU201は、入力されたタスクリスト1214と、ソースコード112の解析データとを読み込む。ある局面において、CPU201は、解析データの代わりに、関数の情報を含むCRUD情報を取得してもよい。 FIG. 16 is a diagram showing an example of task combination processing in the CRUD diagram generation device 1200. As shown in FIG. In step S<b>1610 , the CPU 201 reads the input task list 1214 and analysis data of the source code 112 . In one aspect, the CPU 201 may acquire CRUD information including function information instead of analysis data.

ステップS1620において、CPU201は、タスクリスト1214に含まれる全ての関数(エントリーポイントとなる関数)の確認を完了するまでループ内の処理を繰り返し実行する。 In step S1620, the CPU 201 repeatedly executes the processing in the loop until confirmation of all functions (functions serving as entry points) included in the task list 1214 is completed.

ステップS1630において、CPU201は、タスクリスト1214から、タスク名およびエントリーポイントとなる関数を取り出す。ステップS1640において、CPU201は、解析データに含まれる関数を全て取り出す。 In step S<b>1630 , CPU 201 extracts the task name and entry point function from task list 1214 . In step S1640, CPU 201 retrieves all functions included in the analysis data.

ステップS1650において、CPU201は、全ての呼び出し関数の確認を完了するまでループ内の処理を繰り返し実行する。「呼び出し関数」とは、エントリーポイントとなる関数から直接的または間接的に参照される関数である。図13に示す例では、関数「funcA」がエントリーポイントとなる関数であり、関数「funcB, funcC, funcD, funcE, funcF」が呼び出し関数である。 In step S1650, the CPU 201 repeatedly executes the processing in the loop until confirmation of all call functions is completed. A "calling function" is a function that is directly or indirectly referred to by a function that is an entry point. In the example shown in FIG. 13, the function "funcA" is the entry point function, and the functions "funcB, funcC, funcD, funcE, funcF" are the calling functions.

ステップS1660において、CPU201は、解析データに含まれる関数の1つが、呼び出し関数であれば、タスクの関数として登録する。ある局面において、CPU201は、複数のタスクの各々に、関数を登録してもよい。 In step S1660, if one of the functions included in the analysis data is a call function, CPU 201 registers it as a task function. In one aspect, CPU 201 may register a function for each of a plurality of tasks.

ステップS1670において、CPU201は、作成したタスク情報を登録する。ある局面において、2次記憶装置203に、エントリーポイントとなる関数、呼び出し関数、およびタスク名を含むタスク情報を保存してもよい。 In step S1670, CPU 201 registers the created task information. In one aspect, the secondary storage device 203 may store task information including entry point functions, calling functions, and task names.

図17は、CRUD図生成装置1200における不具合潜在箇所を特定する処理の一例を示す図である。ステップS1710において、CPU201は、全ての不具合潜在パターンの確認を完了するまでループ内の処理を繰り返し実行する。ステップS1720において、CPU201は、不具合潜在パターンDB123から、不具合潜在パターン1211を取り出す。 FIG. 17 is a diagram showing an example of processing for identifying a latent defect location in the CRUD diagram generation device 1200. As shown in FIG. In step S1710, the CPU 201 repeatedly executes the processing in the loop until confirmation of all potential failure patterns is completed. In step S<b>1720 , CPU 201 retrieves potential defect pattern 1211 from potential defect pattern DB 123 .

ステップS1730において、CPU201は、判定対象が大域変数(タスク)であるか否かを判定する。CPU201は、判定対象が大域変数(タスク)であると判定した場合(ステップS1730にてYES)、制御をステップS1740に移す。そうでない場合(ステップS1730にてNO)、CPU201は、制御をステップS1790に移す。判定対象は、大域変数(タスク)以外に、通常の大域変数および関数を含み得る。 In step S1730, the CPU 201 determines whether the determination target is a global variable (task). When CPU 201 determines that the determination target is a global variable (task) (YES in step S1730), CPU 201 shifts the control to step S1740. Otherwise (NO in step S1730), CPU 201 shifts the control to step S1790. Objects to be judged can include ordinary global variables and functions in addition to global variables (tasks).

ステップS1740において、CPU201は、全ての大域変数の確認を完了するまでループ内の処理を繰り返し実行する。ステップS1750において、CPU201は、タスク単位のCRUD情報から、大域変数を取り出す。 In step S1740, CPU 201 repeatedly executes the processing in the loop until confirmation of all global variables is completed. In step S1750, the CPU 201 extracts a global variable from the task-based CRUD information.

ステップS1760において、CPU201は、タスク単位のCRUD情報から、ステップS1750にて取り出した大域変数を参照するタスクの数を取得して保存する。ある局面において、CPU201は、大域変数を参照するタスクの数だけでなく、任意のCRUD処理に関する情報を取得して保存し得る。 In step S1760, the CPU 201 acquires and stores the number of tasks that refer to the global variable extracted in step S1750 from the task-based CRUD information. In one aspect, CPU 201 may obtain and store information about any CRUD process, not just the number of tasks that reference global variables.

ステップS1770において、CPU201は、ステップS1760にて保存した情報が取り出した不具合潜在パターン1211に合致するか否かを判定する。CPU201は、ステップS1760にて保存した情報が取り出した不具合潜在パターン1211に合致すると判定した場合(ステップS1770にてYES)、制御をステップS1780に移す。そうでない場合、CPU201は、制御をステップS1740に移す。 In step S1770, CPU 201 determines whether or not the information saved in step S1760 matches potential defect pattern 1211 extracted. When CPU 201 determines that the information saved in step S1760 matches potential defect pattern 1211 extracted (YES in step S1770), CPU 201 shifts the control to step S1780. Otherwise, CPU 201 transfers control to step S1740.

ステップS1780において、CPU201は、不具合潜在パターン1211に合致するCRUD処理を実行される大域変数を不具合潜在箇所として登録する。ある局面において、CPU201は、当該登録結果を2次記憶装置203に格納してもよい。ステップS1790において、CPU201は、その他の対象(大域変数および関数等)の場合の処理を実行する。その他の対象の場合の処理は、図9に示す処理等を含む。 In step S1780, the CPU 201 registers a global variable for which CRUD processing that matches the potential defect pattern 1211 is executed as a potential defect location. In one aspect, CPU 201 may store the registration result in secondary storage device 203 . In step S1790, CPU 201 executes processing for other objects (global variables, functions, etc.). The processing for other objects includes the processing shown in FIG. 9 and the like.

以上説明したように、本実施の形態に従うCRUD図生成装置1200は、膨大なソースコード112の全てを解析せずに、解析対象をタスク(機能)に関連する関数および大域変数に絞る。それにより、CRUD図生成装置1200は、効率的に大域変数に起因する潜在的不具合を特定することができる。 As described above, the CRUD diagram generation device 1200 according to the present embodiment does not analyze all of the enormous source code 112, but narrows down the analysis targets to functions and global variables related to tasks (functions). Thereby, the CRUD diagram generation device 1200 can efficiently identify potential failures caused by global variables.

実施の形態3.
次に、実施の形態3について説明する。本実施の形態は、実施の形態2の構成にタスク間依存抽出部1861をさらに加えたものであり、タスク間で共有する大域変数の個数をタスク間の依存度として抽出し、抽出結果をファイルとして出力する点で、実施の形態1および2とは異なる。
Embodiment 3.
Next, Embodiment 3 will be described. In this embodiment, the inter-task dependency extraction unit 1861 is added to the configuration of the second embodiment. , which is different from the first and second embodiments.

図18は、本実施の形態に従うCRUD図生成装置1850の機能構成の一例を示す図である。ある局面において、図18に示す各機能ブロックは、図2に示すハードウェアがソフトウェアと協働することにより実現され得る。 FIG. 18 is a diagram showing an example of the functional configuration of the CRUD diagram generation device 1850 according to this embodiment. In one aspect, each functional block shown in FIG. 18 can be realized by the hardware shown in FIG. 2 cooperating with software.

CRUD図生成装置1850は、CRUD図生成装置1200の構成に加えて、タスク間依存抽出部1861を備える。タスク間依存抽出部1861は、CRUD情報DB122から、解析対象のソースコード112に含まれるタスク毎のCRUD情報を取得する。次に、タスク間依存抽出部1861は、各タスク間で共有される大域変数の数をタスク間依存度として抽出する。一例として、タスク間依存抽出部1861は、タスク1とタスク2との間で共有される大域変数の数を、タスク1およびタスク2のタスク間依存度として抽出する。 The CRUD diagram generation device 1850 includes an inter-task dependency extraction unit 1861 in addition to the configuration of the CRUD diagram generation device 1200 . The inter-task dependency extraction unit 1861 acquires CRUD information for each task included in the source code 112 to be analyzed from the CRUD information DB 122 . Next, the inter-task dependency extraction unit 1861 extracts the number of global variables shared between tasks as the degree of inter-task dependency. As an example, the inter-task dependency extraction unit 1861 extracts the number of global variables shared between task 1 and task 2 as the inter-task dependency of task 1 and task 2 .

タスク間依存抽出部1861は、各タスク間で共有している大域変数の数(タスク間依存度)を抽出し、タスク間依存度の出力ファイル1851を出力する。タスク間依存度の出力ファイル1851は、大域変数が3つ以上ある場合、複数のタスク間依存度(例えば、大域変数1,2のタスク間依存度、大域変数2,3のタスク間依存度、大域変数3,1のタスク間依存度等)を含む。 The inter-task dependency extraction unit 1861 extracts the number of global variables shared between tasks (inter-task dependency) and outputs an inter-task dependency output file 1851 . If there are three or more global variables, the output file 1851 of inter-task dependencies contains a plurality of inter-task dependencies (for example, inter-task dependencies of global variables 1 and 2, inter-task dependencies of global variables 2 and 3, inter-task dependencies of global variables 3, 1, etc.).

図19は、タスク間依存度の出力ファイル1851の抽出手順の一例を示す図である。図19に示される例では、解析対象のソースコード112は、タスク1~4と、大域変数「g_val_01」、「g_val_02」、「g_val_03」、「g_val_04」および「g_val_05」とを含む。 FIG. 19 is a diagram showing an example of the procedure for extracting the inter-task dependency output file 1851. As shown in FIG. In the example shown in FIG. 19, the source code 112 to be analyzed includes tasks 1-4 and global variables "g_val_01", "g_val_02", "g_val_03", "g_val_04" and "g_val_05".

タスク間依存抽出部1861は、全てのタスクの組合わせ毎にタスク間依存度を抽出し、これらのタスク間依存度をタスク間依存度の出力ファイル1851に含める。例えば、タスク1,2は、「g_val_01」、「g_val_02」および「g_val_04」を共有している。そのため、タスク間依存抽出部1861は、タスク1およびタスク2のタスク間依存度「3」を抽出する。 The inter-task dependency extraction unit 1861 extracts inter-task dependencies for each combination of all tasks, and includes these inter-task dependencies in the inter-task dependency output file 1851 . For example, tasks 1 and 2 share 'g_val_01', 'g_val_02' and 'g_val_04'. Therefore, the inter-task dependency extraction unit 1861 extracts the inter-task dependency of task 1 and task 2 "3".

図20は、タスク間依存度の出力ファイル1851の一例を示す図である。図20に示されるタスク間依存度の出力ファイル1851は、図19に示されるCRUD情報から生成されたものである。一例として、レコード2051を参照すると、タスク1およびタスク2のタスク間依存度は「3」であり、タスク1およびタスク3のタスク間依存度は「2」であり、タスク1およびタスク4のタスク間依存度は「1」である。 FIG. 20 is a diagram showing an example of the intertask dependency output file 1851 . The inter-task dependency output file 1851 shown in FIG. 20 is generated from the CRUD information shown in FIG. As an example, referring to record 2051, task 1 and task 2 have an inter-task dependency of "3", task 1 and task 3 have an inter-task dependency of "2", and task 1 and task 4 have a degree of inter-task dependency of "3". The degree of interdependence is "1".

基本的にタスク間で依存度が高いほど(共有するタスクの数が多いほど)、大域変数の管理が複雑になり、不具合が発生しやすくなる。そのため、CRUD図生成装置1850は、タスク間依存度をユーザに提示することにより(タスク間依存度の大きい大域変数をユーザに提示することにより)、ソースコード112の不具合解析の工数を削減し得る。 Basically, the higher the degree of dependence between tasks (the greater the number of shared tasks), the more complex the management of global variables and the more likely problems will occur. Therefore, the CRUD diagram generation device 1850 can reduce the number of man-hours for failure analysis of the source code 112 by presenting the degree of dependence between tasks to the user (by presenting global variables with large degree of dependence between tasks to the user). .

図21は、CRUD図生成装置1850におけるタスク間依存度の出力ファイル1851を出力するまでの処理の手順の一例を示す図である。 FIG. 21 is a diagram showing an example of the procedure of processing up to outputting the output file 1851 of intertask dependencies in the CRUD diagram generation device 1850 .

ステップS2160において、CPU201は、全てのタスクを確認するまで、ループ内の処理を繰り返し実行する。 In step S2160, CPU 201 repeatedly executes the processing in the loop until all tasks are confirmed.

ステップS2165において、CPU201は、CRUD情報DB122から取得したCRUD情報の中から、タスクを取り出す。 In step S<b>2165 , the CPU 201 extracts tasks from the CRUD information acquired from the CRUD information DB 122 .

ステップS2170において、CPU201は、ステップS2165にて取り出したタスク以外の全てのタスクを確認するまで、ループ内の処理を繰り返し実行する。例えば、解析対象のソースコード112がタスク1~5を含んでいた場合に、ステップS2165にてタスク1が取り出されたとき、CPU201は、タスク2~5を全て確認するまでステップS2175以下の処理をループする。 In step S2170, CPU 201 repeatedly executes the processing in the loop until all tasks other than the task extracted in step S2165 are confirmed. For example, when the source code 112 to be analyzed includes tasks 1 to 5 and task 1 is extracted in step S2165, the CPU 201 repeats the processing from step S2175 until all tasks 2 to 5 are confirmed. loop.

ステップS2175において、CPU201は、取り出した2つのタスクで共有される大域変数をカウントする。例えば、ステップ2165にてタスク1が取り出され、ステップS2170にてタスク2が取り出された場合、CPU201は、タスク1およびタスク2間で共有される大域変数をカウントする。 In step S2175, CPU 201 counts the global variables shared by the two extracted tasks. For example, if task 1 is fetched at step S2165 and task 2 is fetched at step S2170, CPU 201 counts the global variables shared between task 1 and task 2. FIG.

ステップS2180において、CPU201は、取り出した2つのタスクで共有される大域変数の数をタスク間依存度として保存する。ある局面において、CPU201は、タスク間依存度を一時的に1次記憶装置202に保存してもよいし、または2次記憶装置203に保存してもよい。 In step S2180, CPU 201 saves the number of global variables shared by the extracted two tasks as inter-task dependency. In one aspect, CPU 201 may temporarily store inter-task dependencies in primary storage device 202 or secondary storage device 203 .

ステップS2185において、CPU201は、各タスク間のタスク間依存度の結果をファイル(タスク間依存度の出力ファイル1851)に出力する。 In step S2185, the CPU 201 outputs the result of the degree of dependence between tasks to a file (output file 1851 of degree of dependence between tasks).

実施の形態4.
次に、実施の形態4について説明する。本実施の形態は、ソースコード112が改変される前のCRUD図113と、ソースコード112が改変された後のCRUD図113とを比較し、不具合が潜在している可能性の高い箇所を強調表示したCRUD図の差分ファイル1815を生成する点で、実施の形態1~3とは異なる。なお、実施の形態1~3と同一の構成については同じ符号を付し、説明を繰り返さない。
Embodiment 4.
Next, Embodiment 4 will be described. This embodiment compares the CRUD diagram 113 before the source code 112 is modified with the CRUD diagram 113 after the source code 112 is modified, and emphasizes the places where there is a high possibility of latent defects. This differs from the first to third embodiments in that a differential file 1815 of the displayed CRUD diagram is generated. The same reference numerals are given to the same configurations as those of the first to third embodiments, and the description thereof will not be repeated.

図22は、本実施の形態に従うCRUD図生成装置1800の機能構成の一例を示す図である。ある局面において、図22に示す各機能ブロックは、図2に示すハードウェアがソフトウェアと協働することにより実現され得る。 FIG. 22 is a diagram showing an example of the functional configuration of CRUD diagram generation device 1800 according to the present embodiment. In one aspect, each functional block shown in FIG. 22 can be realized by the hardware shown in FIG. 2 cooperating with software.

CRUD図生成装置1800は、不具合潜在パターン入力部1801と、静的解析部102と、CRUD情報抽出部103と、不具合潜在箇所特定部104と、CRUD図生成部105と、CRUD図比較部1807とを備える。 The CRUD diagram generation device 1800 includes a potential failure pattern input unit 1801, a static analysis unit 102, a CRUD information extraction unit 103, a potential failure location identification unit 104, a CRUD diagram generation unit 105, and a CRUD diagram comparison unit 1807. Prepare.

CRUD図生成装置1800は、実施の形態1のCRUD図生成装置100と同一の処理手順により、CRUD図113を生成する。CRUD図生成装置1800は、過去に生成したCRUD図113をCRUD図履歴DB1824に格納する。ある局面において、CRUD図履歴DB1824は、CRUD図生成装置1800内にあってもよいし、外部の装置内にあってもよい。 The CRUD diagram generation device 1800 generates the CRUD diagram 113 by the same processing procedure as the CRUD diagram generation device 100 of the first embodiment. The CRUD diagram generation device 1800 stores the CRUD diagram 113 generated in the past in the CRUD diagram history DB 1824 . In one aspect, the CRUD diagram history DB 1824 may reside within the CRUD diagram generation device 1800 or within an external device.

不具合潜在パターン入力部1801は、通常の不具合潜在パターン111に加えて、ソースコード112の更新前後の差分を対象とした不具合潜在パターン1811の入力を受け付ける。 The potential defect pattern input unit 1801 receives an input of a potential defect pattern 1811 for the difference between the source code 112 before and after the update, in addition to the normal potential defect pattern 111 .

CRUD図比較部1807は、CRUD図履歴DB1824から、ソースコード112が改変される前のCRUD図113と、ソースコード112が改変された後のCRUD図113とを取得してその差分を出力する。そして、CRUD図比較部1807は、不具合潜在パターン1811に基づいて、差分に含まれる大域変数に起因する不具合潜在箇所を特定する。CRUD図比較部1807は、不具合潜在箇所を強調表示したCRUD図の差分ファイルを生成して出力する。 The CRUD diagram comparison unit 1807 acquires the CRUD diagram 113 before the source code 112 is modified and the CRUD diagram 113 after the source code 112 is modified from the CRUD diagram history DB 1824, and outputs the difference. Then, the CRUD diagram comparison unit 1807 identifies potential fault locations caused by global variables included in the difference based on the potential fault pattern 1811 . The CRUD diagram comparison unit 1807 generates and outputs a difference file of CRUD diagrams in which potential defect locations are highlighted.

図23は、不具合潜在パターン1811の一例を示す図である。不具合潜在パターン1811は、要素として、ID1901と、分類1902と、対象1903と、条件1904とを含む。 FIG. 23 is a diagram showing an example of the defect potential pattern 1811. As shown in FIG. The potential defect pattern 1811 includes an ID 1901, a category 1902, a target 1903, and a condition 1904 as elements.

ID1901は、各々の不具合を一意に示す。分類1902は、不具合の分類を示す。一例として、分類1902は、「不具合」および「警告」を含む。各不具合は、その危険度等に基づいて分類され得る。対象1903は、その分析対象を示す。対象1903は、例えば、関数(比較)、大域変数(追加)を含み得る。関数(比較)は更新された関数であり(追加または削除も含み得る)、大域変数(追加)は新たに追加された大域変数である。 ID 1901 uniquely indicates each failure. Classification 1902 indicates the classification of the defect. As an example, categories 1902 include "malfunction" and "warning." Each failure can be classified based on its degree of risk and the like. Target 1903 indicates the analysis target. Objects 1903 may include, for example, functions (compare), global variables (add). The function (comparison) is the updated function (which may also include additions or deletions) and the global variable (addition) is the newly added global variable.

条件1904は、不具合潜在箇所を検出する際の条件を示す。図23に示す例において、条件1904は、「新規追加変数参照」、「参照回数変化」および「参照箇所変化」を含む。新規追加変数参照は、新しく追加された変数を参照することを示し、参照回数変化は、変数を参照する回数が変化したことを示す。また、参照箇所変化は、変数を新規に参照、または、参照しなくなった関数が存在することを示す。 A condition 1904 indicates a condition for detecting a potential defect location. In the example shown in FIG. 23, the condition 1904 includes "newly added variable reference", "reference count change" and "reference location change". Newly added variable reference indicates that a newly added variable is referenced, and reference count change indicates that the number of times the variable is referenced has changed. Also, the change in the reference point indicates that there is a function that newly references the variable or no longer references the variable.

図24は、CRUD図の差分ファイル1815の一例を示す図である。CRUD図の差分ファイル1815は、要素として、差分種別2001と、大域変数2002と、関数2003~2006とを含む。関数2003~2006は、一例であり、ある局面において、CRUD図の差分ファイル1815は、任意の数の関数を要素として含んでもよい。 FIG. 24 is a diagram showing an example of the difference file 1815 of the CRUD diagram. The CRUD diagram difference file 1815 includes, as elements, a difference type 2001, a global variable 2002, and functions 2003-2006. Functions 2003-2006 are examples, and in certain aspects, CRUD diagram difference file 1815 may include any number of functions as elements.

差分種別2001は、ソースコード112の変更の前後における差分の種類を示す。「追加」は、ソースコード112の更新により、大域変数が追加されたことを示す。「変更」は、ソースコード112の更新により、大域変数のCRUD処理の実行回数に変化が生じたことを示す。「変更なし」は、「変更」にも「追加」にも該当しないことを示す。図24に示す例では、大域変数2002「g_val_02」において、CRUD処理の実行回数が変化しており、大域変数2002「g_val_03」が新たに追加されている。また、大域変数「g_val_04」において、CRUD処理の実行回数が変化しており、大域変数「g_val_04」は関数「funcB」から新たに参照され(2回Readされ)、関数「funcC」から更新されなくなっている(Updateされなくなっている)。 The difference type 2001 indicates the type of difference before and after the source code 112 is changed. “Added” indicates that a global variable has been added by updating the source code 112 . "Change" indicates that the update of the source code 112 has caused a change in the number of CRUD processing executions for global variables. "No change" indicates neither "change" nor "addition". In the example shown in FIG. 24, the number of CRUD process executions is changed in the global variable 2002 "g_val_02", and the global variable 2002 "g_val_03" is newly added. Also, in the global variable "g_val_04", the number of CRUD processing executions has changed, and the global variable "g_val_04" is newly referenced (read twice) from the function "funcB" and is no longer updated from the function "funcC". (no longer updated).

CRUD図の差分ファイル1815の2行目を例に説明すると、関数「funcB, funcC」は、大域変数2002「g_val_02」に対するCRUD処理の実行回数に変化が生じているため、不具合潜在箇所として強調表示される。 Taking the second line of the difference file 1815 of the CRUD diagram as an example, the function "funcB, funcC" is highlighted as a potential fault location because the number of CRUD processing executions for the global variable 2002 "g_val_02" has changed. be done.

また、CRUD図の差分ファイル1815の3行目を例に説明すると、大域変数2002「g_val_03」はソースコード112の更新により追加されている。そして、関数「funcB, funcD」は、新たに追加された大域変数2002「g_val_03」に対してCRUD処理を実行するため、不具合潜在箇所として強調表示される。 Also, taking the third line of the difference file 1815 in the CRUD diagram as an example, the global variable 2002 “g_val_03” is added by updating the source code 112 . Since the functions "funcB, funcD" execute the CRUD processing for the newly added global variable 2002 "g_val_03", they are highlighted as potential fault locations.

さらに、CRUD図の差分ファイル1815の4行目を例に説明すると、関数「funcB」は大域変数2002「g_val_04」に対するCRUD処理が新規に追加されており、また、関数「funcC」は大域変数「g_val_04」に対するCRUD処理が削除されているため、不具合潜在箇所として強調表示されている。 Furthermore, taking the fourth line of the difference file 1815 of the CRUD diagram as an example, the function "funcB" has a new CRUD process for the global variable 2002 "g_val_04", and the function "funcC" has the global variable " g_val_04” is highlighted as a potential defect location because the CRUD processing has been deleted.

新しく参照された(または参照されなくなった)大域変数と、当該大域変数を新しく参照する(または参照しなくなった)関数とが明確になることにより、排他処理の確認または大域変数の影響範囲の確認等が容易になる。CRUD図生成装置1800は、CRUD図の差分ファイル1815をユーザに提示することで、ソースコード112の不具合解析の工数を削減し得る。 By clarifying the newly referenced (or no longer referenced) global variable and the new (or no longer referenced) function that references the global variable, confirmation of exclusion processing or confirmation of the scope of influence of the global variable etc. becomes easier. The CRUD diagram generation device 1800 can reduce the man-hours for failure analysis of the source code 112 by presenting the CRUD diagram difference file 1815 to the user.

図25は、CRUD図生成装置1800におけるCRUD図の差分ファイル1815を生成する処理手順の一例を示す図である。ある局面において、CPU201は、図25の処理を行うためのプログラムを2次記憶装置203から1次記憶装置202に読み込んで、当該プログラムを実行してもよい。他の局面において、当該処理の一部または全部は、当該処理を実行するように構成された回路素子の組み合わせとしても実現され得る。ステップS2105において、CPU201は、CRUD図履歴DB1824から、ソースコード112の更新前後のCRUD図113を取得する。 FIG. 25 is a diagram showing an example of a processing procedure for generating the CRUD diagram difference file 1815 in the CRUD diagram generation device 1800 . In one aspect, CPU 201 may load a program for performing the processing of FIG. 25 from secondary storage device 203 to primary storage device 202 and execute the program. In other aspects, part or all of the process may also be implemented as a combination of circuit elements configured to perform the process. In step S2105, the CPU 201 acquires the CRUD diagram 113 before and after the update of the source code 112 from the CRUD diagram history DB 1824. FIG.

ステップS2110において、CPU201は、ソースコード112の更新前後で大域変数の数に差分があるか否かを判定する。CPU201は、ソースコード112の更新前後で大域変数の数に差分があると判定した場合(ステップS2110にてYES)、制御をステップS2115に移す。そうでない場合(ステップS2110にてNO)、CPU201は、制御をステップS2120に移す。 In step S2110, the CPU 201 determines whether there is a difference in the number of global variables before and after the source code 112 is updated. When CPU 201 determines that there is a difference in the number of global variables before and after updating source code 112 (YES in step S2110), CPU 201 shifts control to step S2115. Otherwise (NO in step S2110), CPU 201 shifts the control to step S2120.

ステップS2115において、CPU201は、差分のある大域変数およびCRUD情報を差分箇所として抽出する。ステップS2120において、CPU201は、全ての大域変数の確認を完了するまでループ内の処理を繰り返し実行する。 In step S2115, the CPU 201 extracts the global variable and the CRUD information with the difference as the difference part. In step S2120, the CPU 201 repeatedly executes the processing within the loop until confirmation of all global variables is completed.

ステップS2125において、CPU201は、ソースコード112の更新後のCRUD図113から、大域変数を取得する。ステップS2130において、CPU201は、全ての関数のCRUD情報の確認を完了するまでループ内の処理を繰り返し実行する。 In step S2125, the CPU 201 acquires global variables from the updated CRUD diagram 113 of the source code 112. FIG. In step S2130, the CPU 201 repeatedly executes the processing in the loop until the confirmation of CRUD information of all functions is completed.

ステップS2135において、CPU201は、ステップS2125で取得した大域変数のCRUD情報と、ソースコード112の更新前のCRUD図に含まれる同一変数のCRUD情報とを比較する。または、CPU201は、ソースコード112の更新後のCRUD図113から取得した関数のCRUD情報と、ソースコード112の更新前のCRUD図に含まれる同一関数のCRUD情報とを比較してもよい。 In step S2135, the CPU 201 compares the CRUD information of the global variable acquired in step S2125 with the CRUD information of the same variable included in the CRUD diagram of the source code 112 before updating. Alternatively, the CPU 201 may compare the CRUD information of the function acquired from the updated CRUD diagram 113 of the source code 112 and the CRUD information of the same function included in the CRUD diagram of the source code 112 before the update.

ステップS2140において、CPU201は、ステップS2135の比較で差分があるか否かを判定する。CPU201は、ステップS2135の比較で差分があると判定した場合(ステップS2140にてYES)、制御をステップS2145に移す。そうでない場合(ステップS2140にてNO)、CPU201は、制御をステップS2130に移す。 In step S2140, CPU 201 determines whether or not there is a difference in the comparison in step S2135. When CPU 201 determines that there is a difference in the comparison in step S2135 (YES in step S2140), control proceeds to step S2145. Otherwise (NO in step S2140), CPU 201 shifts the control to step S2130.

ステップS2145において、CPU201は、差分箇所として差分に関係する大域変数および関数を抽出する。ステップS2150において、CPU201は、不具合抽出処理を実行する。より具体的には、CPU201は、不具合潜在パターン1811に基づいて、ステップS2145で抽出された差分に含まれる潜在的な不具合を特定する。 In step S2145, the CPU 201 extracts global variables and functions related to the difference as difference points. In step S2150, CPU 201 executes defect extraction processing. More specifically, CPU 201 identifies potential defects included in the difference extracted in step S2145 based on potential defect pattern 1811 .

ステップS2155において、CPU201は、ステップS2145で抽出された差分に基づいて、CRUD図の差分ファイル1815を生成して出力する。CPU201は、ステップS2150で特定した不具合に基づいて、CRUD図の差分ファイル1815の潜在的な不具合箇所を強調表示に変更する。 In step S2155, the CPU 201 generates and outputs a CRUD diagram difference file 1815 based on the difference extracted in step S2145. Based on the defect identified in step S2150, the CPU 201 highlights the potential defect portion of the difference file 1815 of the CRUD diagram.

以上説明したように、本実施の形態に従うCRUD図生成装置1800は、ソースコード112の更新前後における差分に基づいて、CRUD図の差分ファイル1815を作成する機能を備える。当該機能により、ユーザは、CRUD図の差分ファイル1815を参照することで、ソースコード112の更新に基づく不具合箇所を特定しやすくなる。なお、各々の実施の形態に記載された内容は適宜組み合わせて使用されてもよい。 As described above, the CRUD diagram generation device 1800 according to the present embodiment has a function of creating the CRUD diagram difference file 1815 based on the difference between before and after the source code 112 is updated. This function makes it easier for the user to identify the defect location based on the update of the source code 112 by referring to the difference file 1815 of the CRUD diagram. Note that the contents described in each embodiment may be used in combination as appropriate.

今回開示された実施の形態は全ての点で例示であって制限的なものではないと考えられるべきである。本開示の範囲は上記した説明ではなくて請求の範囲によって示され、請求の範囲と均等の意味及び範囲内で全ての変更が含まれることが意図される。また、実施の形態および各変形例において説明された開示内容は、可能な限り、単独でも、組合わせても、実施することが意図される。 It should be considered that the embodiments disclosed this time are illustrative in all respects and not restrictive. The scope of the present disclosure is indicated by the scope of claims rather than the above description, and is intended to include all modifications within the meaning and scope equivalent to the scope of claims. In addition, it is intended that the disclosure content described in the embodiment and each modified example can be implemented singly or in combination as much as possible.

100,1200,1800,1850 CRUD図生成装置、101,1201,1801 不具合潜在パターン入力部、102 静的解析部、103,1203 CRUD情報抽出部、104,1204 不具合潜在箇所特定部、105,1205 CRUD図生成部、111,1211,1811 不具合潜在パターン、112 ソースコード、113,1215 CRUD図、121 解析データDB、122 CRUD情報DB、123 不具合潜在パターンDB、201 CPU、202 1次記憶装置、203 2次記憶装置、204 外部機器インターフェイス、205 入力インターフェイス、206 出力インターフェイス、207 通信インターフェイス、300 CRUD情報、301,501,1501,2002 大域変数、302,502,503,2003,2006 関数、303 作成(R)、304 参照(R)、305 更新(U)、306 削除(D)、401,1001,1401,1901 ID、402,1004,1402,1902 分類、403,1403,1903 対象、404,1404,1904 条件、1000 不具合潜在箇所のデータ、1002 不具合潜在箇所、1003 種別、1206 タスク結合部、1214 タスクリスト、1300,1310,1502,1503,1504,1505 タスク、1807 CRUD図比較部、1815 CRUD図の差分ファイル、1824 CRUD図履歴DB、1851 タスク間依存度の出力ファイル、1861 タスク間依存抽出部、2001 差分種別。 100, 1200, 1800, 1850 CRUD diagram generation device 101, 1201, 1801 Potential failure pattern input unit 102 Static analysis unit 103, 1203 CRUD information extraction unit 104, 1204 Potential failure location identification unit 105, 1205 CRUD Diagram generating unit 111, 1211, 1811 Potential failure pattern 112 Source code 113, 1215 CRUD diagram 121 Analysis data DB 122 CRUD information DB 123 Potential failure pattern DB 201 CPU 202 Primary storage device 203 2 Secondary storage device, 204 External device interface, 205 Input interface, 206 Output interface, 207 Communication interface, 300 CRUD information, 301, 501, 1501, 2002 Global variable, 302, 502, 503, 2003, 2006 Function, 303 Creation (R ), 304 reference (R), 305 update (U), 306 deletion (D), 401, 1001, 1401, 1901 ID, 402, 1004, 1402, 1902 classification, 403, 1403, 1903 target, 404, 1404, 1904 Condition 1000 Potential failure location data 1002 Potential failure location 1003 Type 1206 Task combination unit 1214 Task list 1300, 1310, 1502, 1503, 1504, 1505 Task 1807 CRUD diagram comparison unit 1815 CRUD diagram difference File 1824 CRUD diagram history DB 1851 Inter-task dependency output file 1861 Inter-task dependency extraction unit 2001 Difference type.

Claims (15)

1または複数のプロセッサによりソースコードを解析する方法であって、
プログラムの不具合パターンを取得するステップと、
前記プログラムのソースコードを取得するステップと、
前記ソースコードから大域変数に関するCRUD情報を抽出するステップと、
前記不具合パターンに基づいて、前記CRUD情報から潜在的な不具合を特定するステップと、
前記潜在的な不具合の情報を含むCRUD図を出力するステップとを含む、方法。
A method of analyzing source code by one or more processors, comprising:
obtaining a program failure pattern;
obtaining the source code of the program;
extracting CRUD information about global variables from the source code;
identifying potential defects from the CRUD information based on the defect pattern;
and C. outputting a CRUD diagram containing information of said potential failure.
前記潜在的な不具合の情報を含む前記CRUD図を出力するステップは、前記CRUD図に含まれる前記潜在的な不具合の情報を強調表示するステップを含む、請求項1に記載の方法。 2. The method of claim 1, wherein outputting the CRUD diagram containing the potential defect information comprises highlighting the potential defect information contained in the CRUD diagram. 前記不具合パターンに基づいて、前記CRUD情報から前記潜在的な不具合を特定するステップは、前記ソースコードに含まれる前記大域変数ごとに前記潜在的な不具合を特定するステップを含む、請求項1または2に記載の方法。 3. The step of identifying the potential defect from the CRUD information based on the defect pattern includes identifying the potential defect for each of the global variables included in the source code. The method described in . 前記不具合パターンに基づいて、前記CRUD情報から前記潜在的な不具合を特定するステップは、前記ソースコードに含まれる関数ごとに前記潜在的な不具合を特定するステップを含む、請求項1~3のいずれかに記載の方法。 4. The step of identifying the potential defect from the CRUD information based on the defect pattern includes identifying the potential defect for each function included in the source code. The method described in Crab. 1または複数の関数を含むタスクリストを取得するステップをさらに含み、
前記ソースコードから前記大域変数に関する前記CRUD情報を抽出するステップは、タスク単位での前記大域変数の前記CRUD情報を抽出するステップを含む、請求項1~4のいずれかに記載の方法。
further comprising obtaining a task list containing one or more functions;
The method according to any one of claims 1 to 4, wherein extracting the CRUD information about the global variables from the source code comprises extracting the CRUD information of the global variables on a task-by-task basis.
前記タスク単位での前記大域変数の前記CRUD情報を抽出するステップは、単一のタスクから参照される大域変数がある場合、前記単一のタスクから参照される大域変数を不具合潜在箇所であると特定するステップを含む、請求項5に記載の方法。 The step of extracting the CRUD information of the global variables for each task includes, if there is a global variable referenced from a single task, identifying the global variable referenced from the single task as a latent defect location . 6. The method of claim 5, comprising identifying. 各タスク間の依存度を抽出するステップと、
各タスク間の依存度をファイルとして出力するステップとをさらに含む、請求項5に記載の方法。
extracting dependencies between each task;
6. The method of claim 5, further comprising outputting the dependencies between each task as a file.
過去に生成した前記CRUD図をCRUD図保存部に保存するステップと、
前記CRUD図保存部から、更新前の前記ソースコードにおける第1のCRUD図と、更新後の前記ソースコードにおける第2のCRUD図とを取得するステップと、
前記第1のCRUD図と、前記第2のCRUD図との間の差分を特定するステップと、
前記差分に含まれる前記潜在的な不具合の情報を出力するステップとをさらに含む、請求項1~7のいずれかに記載の方法。
a step of storing the CRUD diagram generated in the past in a CRUD diagram storage unit;
obtaining a first CRUD diagram in the source code before update and a second CRUD diagram in the source code after update from the CRUD diagram storage unit;
identifying differences between the first CRUD diagram and the second CRUD diagram;
and outputting information of said potential defects contained in said difference.
前記第1のCRUD図と、前記第2のCRUD図との間の前記差分を特定するステップは、前記大域変数の数の変化を特定するステップを含む、請求項8に記載の方法。 9. The method of claim 8, wherein identifying the difference between the first CRUD diagram and the second CRUD diagram comprises identifying changes in the number of global variables. 前記第1のCRUD図と、前記第2のCRUD図との間の前記差分を特定するステップは、ある前記大域変数におけるCreate、Read、UpdateまたはDeleteの回数の変化を特定することを含む、請求項8に記載の方法。 wherein identifying the difference between the first CRUD diagram and the second CRUD diagram includes identifying a change in the number of Creates, Reads, Updates or Deletes in one of the global variables. Item 9. The method according to item 8. 前記大域変数の前記Createは、前記大域変数のインスタンスを生成する処理、または、前記大域変数に対して動的にメモリ領域を確保する処理を含む、請求項10に記載の方法。 11. The method according to claim 10, wherein said Create of said global variable includes a process of generating an instance of said global variable or a process of dynamically allocating a memory area for said global variable. 前記大域変数の前記Deleteは、前記大域変数のインスタンスを破棄する処理、または、前記大域変数に対して確保されたメモリ領域を解放する処理を含む、請求項10に記載の方法。 11. The method of claim 10, wherein said deleting said global variable comprises destroying an instance of said global variable or releasing a memory area reserved for said global variable. 前記第1のCRUD図と、前記第2のCRUD図との間の差分を特定するステップは、関数により参照される回数が変化した大域変数を不具合潜在箇所であると特定するステップを含む、請求項8に記載の方法。 wherein the step of identifying a difference between the first CRUD diagram and the second CRUD diagram includes identifying a global variable whose number of times referenced by a function has changed as a fault latent location . Item 9. The method according to item 8. 請求項1~13のいずれかに記載の方法を1または複数のプロセッサに実行させるためのプログラム。 A program for causing one or more processors to execute the method according to any one of claims 1 to 13. 請求項14に記載のプログラムを格納したメモリと、
前記プログラムを実行するためのプロセッサとを備えた、装置。
a memory storing the program according to claim 14;
and a processor for executing the program.
JP2022565049A 2020-11-30 2021-07-28 Method, program and apparatus for analyzing source code Active JP7250223B2 (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2020198372 2020-11-30
JP2020198372 2020-11-30
PCT/JP2021/027889 WO2022113425A1 (en) 2020-11-30 2021-07-28 Method, program, and device for analyzing source code

Publications (3)

Publication Number Publication Date
JPWO2022113425A1 JPWO2022113425A1 (en) 2022-06-02
JPWO2022113425A5 JPWO2022113425A5 (en) 2023-02-13
JP7250223B2 true JP7250223B2 (en) 2023-03-31

Family

ID=81754492

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2022565049A Active JP7250223B2 (en) 2020-11-30 2021-07-28 Method, program and apparatus for analyzing source code

Country Status (3)

Country Link
US (1) US20230385188A1 (en)
JP (1) JP7250223B2 (en)
WO (1) WO2022113425A1 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019109688A (en) 2017-12-18 2019-07-04 キヤノン株式会社 Software evaluation system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019109688A (en) 2017-12-18 2019-07-04 キヤノン株式会社 Software evaluation system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
加藤 正恭,CRUDマトリクスを用いた ソフトウェア設計影響分析手法,第73回(平成23年)全国大会講演論文集(1) アーキテクチャ ソフトウェア科学・工学 データベースとメディア,2011年
津村耕司,静的・動的ハイブリッドな解析によるコード・データのトレー サビリティリンクの抽出,ウィンターワークショップ2014・イン・大洗 論文集,2014年

Also Published As

Publication number Publication date
WO2022113425A1 (en) 2022-06-02
US20230385188A1 (en) 2023-11-30
JPWO2022113425A1 (en) 2022-06-02

Similar Documents

Publication Publication Date Title
CN107644286B (en) Workflow processing method and device
US9424168B2 (en) System and method for automatic generation of software test
JP5963312B2 (en) Information processing apparatus, information processing method, and program
US8359592B2 (en) Identifying groups and subgroups
US20190196947A1 (en) Application Analysis with Flexible Post-Processing
US20130275939A1 (en) Efficient file system object-based deduplication
JP7250223B2 (en) Method, program and apparatus for analyzing source code
CN110928941A (en) Data fragment extraction method and device
CN110716866A (en) Code quality scanning method and device, computer equipment and storage medium
US9286348B2 (en) Dynamic search system
US20150019600A1 (en) Computer product, file identifying apparatus, and file evaluation method
JP6665576B2 (en) Support device, support method, and program
CN111273913B (en) Method and device for outputting application program interface data represented by specifications
JP2019074966A (en) Sql sentence extraction device, sql sentence extraction method, and program
US11630662B2 (en) Software analysis device, software analysis method, and software analysis program
US9483241B2 (en) Method ranking based on code invocation
KR20230086790A (en) Provides application error data for use in third-party library development systems
JP6646699B2 (en) Search device and search method
US10649743B2 (en) Application developing method and system
CN111967769A (en) Risk identification method, device, equipment and medium
JP6945434B2 (en) Software development equipment, software development methods and software development programs
US11960560B1 (en) Methods for analyzing recurring accessibility issues with dynamic web site behavior and devices thereof
WO2021024791A1 (en) Design assistance system and design assistance method
CN112784264B (en) Jail-break state detection method, device, equipment and storage medium
CN110879722B (en) Method and device for generating logic schematic diagram and computer storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20221124

A871 Explanation of circumstances concerning accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A871

Effective date: 20221124

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230203

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230320

R150 Certificate of patent or registration of utility model

Ref document number: 7250223

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150