CN109086050A - A kind of analysis method and system of module dependencies - Google Patents

A kind of analysis method and system of module dependencies Download PDF

Info

Publication number
CN109086050A
CN109086050A CN201810725653.4A CN201810725653A CN109086050A CN 109086050 A CN109086050 A CN 109086050A CN 201810725653 A CN201810725653 A CN 201810725653A CN 109086050 A CN109086050 A CN 109086050A
Authority
CN
China
Prior art keywords
module
dependence
nonsystematic
generic
modules
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810725653.4A
Other languages
Chinese (zh)
Other versions
CN109086050B (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.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
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 Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN201810725653.4A priority Critical patent/CN109086050B/en
Publication of CN109086050A publication Critical patent/CN109086050A/en
Application granted granted Critical
Publication of CN109086050B publication Critical patent/CN109086050B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/52Binary to binary
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design

Abstract

The invention discloses a kind of analysis method of module dependencies and systems, are related to field of communication technology.The analysis method of module dependencies includes: to obtain nonsystematic generic module all in software to be analyzed to construct a module group;Obtain the dependence between any two of all modules in module group;The dependence matrix for establishing the dependence between any two of all modules in representation module group judges to whether there is Circular dependency relationship in software to be analyzed between nonsystematic generic module according to dependence matrix.The present invention can determine in software to be analyzed as between the binary object file of module whether there is Circular dependency relationship.

Description

A kind of analysis method and system of module dependencies
Technical field
The present invention relates to fields of communication technology, are specifically related to the analysis method and system of a kind of module dependencies.
Background technique
Modularized design is an important method of software design, and module design should follow the principle of high cohesion lower coupling. Cohesion is a kind of measurement of correlation degree between each ingredient of inside modules, and coupling is a kind of measurement interconnected between module. The coupled relation of intermodule refers to dependence between module, including control planning, adduction relationship and data transitive relation etc..
The control of module dependencies is carried out in software design stage, and the analysis of module dependencies is then for software The rear assessment and measurement for developing institute's payment in product, when different design closes the principle of high cohesion lower coupling, or design does not cover When being executed to each single item or when development process control is ineffective, it is possible to the dependence occurred between module does not meet expection, Even there is Circular dependency relationship, does not meet the principle of high cohesion lower coupling more.The Circular dependency relationship of module can be briefly described It is as follows: such as modules A Depending module B, while module B and Depending module A.Modules A Depending module B for another example, module B rely on mould Block C, and module C Depending module A, to constitute an annular Circular dependency relationship.The Circular dependency relationship of above-mentioned annular Merely illustrative, there may be other forms or more complicated Circular dependency relationships.
When module, which is, can form the binary object file of final executable file, such as under (SuSE) Linux OS Static library .a file and dynamic base .so file etc., the dependence between module refers mainly to the function reference between module Relationship.By taking C language as an example, there are two types of function reference modes: (1) being called directly by function name;(2) indirect by function pointer It calls.For the angle of software design, when modules A calls directly module B by function name, modules A Depending module B;When When modules A is by function pointer indirect calling module B, modules A does not depend on module B, i.e., does not couple between modules A and module B. Therefore when dependence between analysis module, it is only necessary to call directly relationship by function name between analysis module.
At present can be by object code come the dependence between analysis module, such as utilize the ldd life in linux system Enable the dependence between analysis binary object file.But the order can only be directed to dynamic base, cannot be directed to static library, and And be only capable of between analysis binary object file with the presence or absence of dependence, and cannot analyze between these binary object files With the presence or absence of Circular dependency relationship etc..
Summary of the invention
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of analysis sides of module dependencies Method and system, determine in software to be analyzed as between the binary object file of module whether there is Circular dependency relationship.
The present invention provides a kind of analysis method of module dependencies comprising:
Nonsystematic generic module all in software to be analyzed is obtained to construct a module group;
Obtain the dependence between any two of all modules in module group;
The dependence matrix for establishing the dependence between any two of all modules in representation module group is closed according to relying on It is that matrix judges to whether there is Circular dependency relationship in software to be analyzed between nonsystematic generic module.
Based on the above technical solution, function name is carried out between the module in the module group to call directly point Analysis, obtains the dependence between any two of all modules;Alternatively,
When the module group includes the nonsystematic generic module of static library file type, by each static library file type Nonsystematic generic module is converted to the module of dynamic library file type, by ldd function obtain all modules between any two according to The relationship of relying;Alternatively,
When the module group includes the nonsystematic generic module of static library file type and the nonsystematic of dynamic library file type When generic module, between the module of static library file type and the module of static library file type and dynamic library file type Between module, analysis is called directly by function name and obtains the dependence between any two of module, and passes through ldd function call To the dependence between any two of the module of dynamic library file type.
Based on the above technical solution, the module M in the module groupiAnd MjBetween carry out function name call directly The method of analysis are as follows: as module MiAn external symbol and module MjA global symbol it is identical when, determination module MiTo mould Block MjExistence function adduction relationship, i.e. MiRely on Mj, wherein global symbol is the function name for being defined on inside modules, external symbol For the function name for being defined on module-external and being quoted in the module.
Based on the above technical solution, when the nonsystematic generic module of the static library file type is .a file, .a file is expanded into .obj file using compilation tool, then .obj file is compiled as .so file.
Based on the above technical solution, by i-th of module M in the module groupiWith j-th of module MjBetween any two Dependence be denoted as Rij=R (Mi, Mj) and Rji=R (Mj, Mi), Rij=0 indicates MiM is not depended onj, Rij=1 indicates MiIt relies on Mj;Rji=0 indicates MjM is not depended oni, Rji=1 indicates MjRely on Mi, 1≤i≤n, 1≤j≤n, n are the module of the module group Sum;
The dependence matrix R is n × n matrix, RijAnd RjiIt is the element of the dependence matrix R.
Based on the above technical solution, in the dependence matrix R, work as Rij=RjiWhen=1;Alternatively, working as R (Mi, Mk1)=1, R (Mk1, Mk2)=1 ..., R (Mkp, Mj)=1 and R (Mj, MiWhen)=1,1≤i, k1 ..., kp, j≤n, then table Show that there are Circular dependency relationships between the nonsystematic generic module.
Based on the above technical solution, according to the dependence matrix R, digraph G=<VG is generated, EG>, In, each node VG of digraph indicates a module of the module group, each edge EG indicate this side two end nodes it Between dependence, EG={ Mi→Mj, MiAnd Mj∈ VG, i ≠ j }, Mi→MjRepresentation module MiRely on Mj
The dependence hierarchical relationship between the nonsystematic generic module is obtained according to the digraph G.
Based on the above technical solution, when there are when directed circuit, then determining the nonsystematic in the digraph G There are Circular dependency relationships between generic module.
Based on the above technical solution, according to the dependence matrix R, each node of the digraph is calculated In-degree;
It deletes in-degree and is 0 node, and the in-degree for the node being connected with deleted node is subtracted 1, until node whole It is deleted or the in-degree of remaining node is not 0;
When the in-degree of remaining node is not 0, then determine that there are Circular dependency relationships between the nonsystematic generic module.
The present invention also provides a kind of analysis systems of module dependencies comprising:
Pretreatment unit is used to obtain nonsystematic generic module all in software to be analyzed to construct a module group;
Analytical unit is used to obtain the dependence between any two of all modules in module group;
Aggregation process unit is used to establish the dependence of the dependence between any two of all modules in representation module group Relational matrix judges to close between nonsystematic generic module with the presence or absence of Circular dependency in software to be analyzed according to dependence matrix System.
Compared with prior art, advantages of the present invention is as follows:
(1) the dependence matrix for indicating the dependence between any two of all modules is established, according to dependence square Battle array judges to whether there is Circular dependency relationship in software to be analyzed between nonsystematic generic module.It can analyze module dependencies Hierarchical relationship, and then whether there is Circular dependency relationship, the software delivered by software collaboration development block between determination module Quality provides detection foundation.
(2) source code is not depended on, so that it may analyze the binary object file in software to be analyzed as module, not only The nonsystematic generic module that can analyze dynamic library file type also can analyze the nonsystematic generic module of static library file type, And it can accurately determine nonsystematic generic module with the presence or absence of Circular dependency relationship.
(3) according to dependence matrix, the in-degree of each node of digraph is calculated;The node that in-degree is 0 is deleted, and will The in-degree for the node being connected with deleted node subtracts 1, until node is all deleted or the in-degree of residue node is not 0; When the in-degree of remaining node is not 0, then determine that calculating process is simple there are Circular dependency relationship between nonsystematic generic module, Module dependencies can be quickly obtained.
Detailed description of the invention
Fig. 1 is the analysis method flow chart of first embodiment of the invention module dependencies;
Fig. 2 is the flow chart of step S1 in first embodiment of the invention;
Fig. 3 is the flow chart of step S2 in first embodiment of the invention;
Fig. 4 is the dependence hierarchical relationship in fourth embodiment of the invention module between module;
Fig. 5 is the analysis that whether there is Circular dependency relationship in fifth embodiment of the invention module between nonsystematic generic module Method flow diagram;
Fig. 6 is the application schematic diagram of the analysis system of sixth embodiment of the invention module dependencies.
Specific embodiment
With reference to the accompanying drawing and specific embodiment the present invention is described in further detail.
The embodiment of the present invention provides a kind of analysis method of module dependencies comprising:
Nonsystematic generic module all in software to be analyzed is obtained to construct a module group;
Obtain the dependence between any two of all modules in module group;
The dependence matrix for establishing the dependence between any two of all modules in representation module group is closed according to relying on It is that matrix judges to whether there is Circular dependency relationship in software to be analyzed between nonsystematic generic module.
Module in software to be analyzed includes system generic module and nonsystematic generic module, the binary system mesh realized with C language For marking file, module is the binary object file that can form final executable file, and system generic module refers to known Library file, such as libc, nonsystematic generic module are then the customized binary object files of user.Under normal conditions, nonsystematic Generic module is dependence system generic module, and system generic module does not depend on nonsystematic generic module, therefore, to module dependencies Analysis is typically aimed at the dependence between analysis nonsystematic generic module, without analysis system generic module and nonsystematic generic module Between and system generic module between dependence.
The type of nonsystematic generic module includes static library and dynamic base, such as static library .a file and dynamic base .so text Part etc., the dependence between module refer mainly to the function reference relationship between module.I.e. nonsystematic generic module can be static state The nonsystematic generic module of library file type, the nonsystematic generic module of dynamic library file type or static library file type it is non- The nonsystematic generic module of system generic module and dynamic library file type.
First embodiment of the invention provides a kind of analysis method of module dependencies, and the present embodiment is realized with C language For binary object file, each binary object file is a module, is closed between detection module with the presence or absence of Circular dependency System.
In the present embodiment, when the nonsystematic generic module and dynamic library file that the module group includes static library file type When the nonsystematic generic module of type, between the module of static library file type and the module of static library file type and dynamic Between the module of library file type, analysis is called directly by function name and obtains the dependence between any two of module, and The dependence between any two of the module of dynamic library file type is obtained by ldd function.
It is shown in Figure 1, the analysis methods of module dependencies the following steps are included:
The pretreatment of step S1. module information: modules information in software to be analyzed is pre-processed.
The analysis of step S2. module dependencies: the dependence between any two of all modules is analyzed.
Step S3. module dependencies aggregation process: aggregation process is carried out to module dependencies, judges software to be analyzed It whether there is Circular dependency relationship between middle nonsystematic generic module.
Shown in Figure 2, step S1 is specifically included:
Step S101 module classification: obtaining all modules of software to be analyzed, obtain module collection, will be in module collection Module is divided into system generic module and nonsystematic generic module.Further, classify again to nonsystematic generic module, be divided into quiet The nonsystematic generic module of state library file type and the nonsystematic generic module of dynamic library file type.
Step S102 obtains module collection: module collection includes all system generic modules and module group, and module group includes All nonsystematic generic modules in software to be analyzed, nonsystematic generic module include the nonsystematic generic module of dynamic library file type with And the nonsystematic generic module of static library file type.
Step S103 utilizes analysis tool, to each module in the module group of step S102 output, obtains its overall situation symbol Number table and external symbol table.Analysis tool can be known binary file analysis tool, such as readelf, objdump and nm Deng.Global symbol is the function name for being defined on inside modules, and external symbol is to be defined on module-external and draw in the module Function name.
The external symbol of each module of step S104 extraction step S103 output, initialization form external symbol information Table, as shown in Table 1:
Table one: external symbol information table
Serial number Module name Symbol Label
The list item that table one is included is as follows:
Serial number: the serial number of list item is identified;
Module name: the modules title in module group;
Symbol: the external symbol table for the module extracted in step S103;
Label: whether identifier is defined in other modules, i.e., whether is present in the global symbol table of other modules In.
Step S105 initialization module dependence table: module dependencies table is indicated by the way of matrix, it is assumed that mould There is m module in block group, is then indicated with the matrix S of m × m.When initialization, each element of matrix S is 0.
In step s 2, to each modules A and B in module collection, following step is completed:
Step S21 analyzes A to the dependence of B.
Step S22 analyzes B to the dependence of A.
Due to the dependence of two intermodules be it is unidirectional, inside operating process and the step S21 of step S22 is It is consistent, only have exchanged modules A and the sequence of B.
Specifically, in the step s 21, determination module MiRely on MjMethod are as follows: as module MiAn external symbol and mould Block MjA global symbol it is identical when, determination module MiTo module MjExistence function adduction relationship, i.e. MiRely on Mj
Shown in Figure 3, step S21 is specifically included:
Whether step S2101 judgment module A is system generic module, if so, entering step S2102;If it is not, entering step S2103。
Step S2102 remembers S (A, B)=0, terminates.
Whether step S2103 determination module A and module B are dynamic library file, if so, going to step S2104;Otherwise, Go to step S2105.
Step S2104 obtains the dependence of modules A and module B using Linux ldd order or other system similar commands Relationship: if the dynamic base that modules A is relied on includes B, remembering S (A, B)=1, otherwise remembers S (A, B)=0, terminates.
Whether step S2105 judgment module A external symbol table number is 0, if so, entering step S2106;If it is not, into Enter step S2107.
Step S2106 remembers S (A, B)=0, terminates.
Whether the marker bit of the external symbol table of step S2107 judgment module A is marked, if it is not, terminating;If so, Enter step S2108.
The external symbol table of step S2108 scan module A, takes out an external symbol ESi.
Step S2109 judges that ESi whether there is in the global symbol table of module B, if so, going to step S2111;It is no Then enter step S2110.
Step S2110 remembers S (A, B)=0, enters step S2112.
Step S2111 records S (A, B)=1, enters step S2112.
The label that the external symbol table of step S2112 setup module A corresponds to ESi symbol is marked.
Step S2113 judges whether the external symbol table of spider module A, if so, terminating;If it is not, return step S2108.
By i-th of module M in module collectioniWith j-th of module MjDependence between any two is denoted as Rij=R (Mi, Mj) And Rji=R (Mj, Mi), Rij=0 indicates MiM is not depended onj, Rij=1 indicates MiRely on Mj;Rji=0 indicates MjM is not depended oni, Rji =1 indicates MjRely on Mi, 1≤i≤m, 1≤j≤m, m are the total number of modules of module collection.
Use the dependence between any two of all modules in the dependence matrix S representation module set of m × m, Rij And RjiIt is the element of dependence matrix R.Since total number of modules is m in module collection, since module collection includes system class Module and module group, therefore, m >=n.
In step s3, in dependence matrix S, work as Rij=RjiWhen=1;Alternatively, working as R (Mi, Mk1)=1, R (Mk1, Mk2)=1 ..., R (Mkp, Mj)=1 and R (Mj, MiWhen)=1,1≤i, k1 ..., kp, j≤m, then it represents that nonsystematic generic module it Between there are Circular dependency relationships.
The dependence matrix for indicating the dependence between any two of all modules is established, is sentenced according to dependence matrix Break in software to be analyzed between nonsystematic generic module with the presence or absence of Circular dependency relationship, it can be with the layer of analysis module dependence Secondary relationship, and then whether there is Circular dependency relationship, the software matter delivered by software collaboration development block between determination module Amount provides detection foundation.
Second embodiment of the invention provides a kind of analysis method of module dependencies, and the present embodiment is realized with C language For binary object file, each binary object file is a module, is closed between detection module with the presence or absence of Circular dependency System.
Second embodiment of the invention is essentially identical with first embodiment, and module collection includes all system generic modules and mould Block group, module group include nonsystematic generic module all in software to be analyzed, and nonsystematic generic module includes dynamic library file type Nonsystematic generic module and static library file type nonsystematic generic module.Second embodiment of the invention and first embodiment Difference is: in a second embodiment, carrying out function name between all modules in module group and calls directly analysis, obtain institute There is the dependence between any two of module.
Third embodiment of the invention provides a kind of analysis method of module dependencies, and the present embodiment is realized with C language For binary object file, each binary object file is a module, is closed between detection module with the presence or absence of Circular dependency System.
In the present embodiment, when module group includes the nonsystematic generic module of static library file type, by each static library The nonsystematic generic module of file type is converted to the module of dynamic library file type, obtains the two of all modules by ldd function Dependence between two.
It is shown in Figure 1, the analysis methods of module dependencies the following steps are included:
The pretreatment of step S1. module information: modules information in software to be analyzed is pre-processed.
The analysis of step S2. module dependencies: the dependence between any two of all modules is analyzed.
Step S3. module dependencies aggregation process: aggregation process is carried out to module dependencies, judges software to be analyzed It whether there is Circular dependency relationship between middle nonsystematic generic module.
Step S1 is specifically included:
Step S111 module classification: obtaining all modules of software to be analyzed, obtain module collection, will be in module collection Module is divided into system generic module and nonsystematic generic module.Further, classify again to nonsystematic generic module, be divided into quiet The nonsystematic generic module of state library file type and the nonsystematic generic module of dynamic library file type.
Step S112 module class switch: for the nonsystematic generic module of static library file type, if there is compiling work The nonsystematic generic module of static library file type, then is converted to the module of dynamic library file type, example by tool by compiler directive .a file is such as expanded into .obj file, then .obj file is compiled as .so file..a file before conversion is moved from static library It removes, module collection is then added in the .so file after conversion.
Module collection includes all system generic modules and module group, and module group includes non-system all in software to be analyzed System generic module.In a kind of example, module group includes the dynamic being converted to by the nonsystematic generic module of static library file type The module of library file type.In another example, module group includes the nonsystematic generic module of all dynamic library file types, with And the module for the dynamic library file type being converted to by the nonsystematic generic module of static library file type.
Step S113 initialization module dependence table: module dependencies table is indicated by the way of matrix, it is assumed that mould There is m module in block combination, is then indicated with the matrix S of m × m.When initialization, each element of matrix S is 0.
In step s 2, it is closed by the dependence between any two that the ldd function of (SuSE) Linux OS obtains all modules System.To each modules A and B in module group, following step is completed:
Step S211 analyzes A to the dependence of B.
Step S212 analyzes B to the dependence of A.
Since the dependence of two intermodules is unidirectional, the inside operating process and step S211 of step S212 It is consistent, only has exchanged modules A and the sequence of B.
Third embodiment of the invention is identical with the step S3 of second embodiment, repeats no more.
In another embodiment, the analysis method of module dependencies includes:
In step sl, it obtains nonsystematic generic module all in software to be analyzed and constructs a module group.
In step s 2, function name is carried out between the module in module group and call directly analysis, obtain all modules Dependence between any two.
By i-th of module M in module groupiWith j-th of module MjDependence between any two is denoted as Rij=R (Mi, Mj) and Rji=R (Mj, Mi), Rij=0 indicates MiM is not depended onj, Rij=1 indicates MiRely on Mj;Rji=0 indicates MjM is not depended oni, Rji=1 Then indicate MjRely on Mi, 1≤i≤n, 1≤j≤n, n are the total number of modules of module group.
Dependence matrix R is n × n matrix, RijAnd RjiIt is the element of dependence matrix R.
Since total number of modules is m in module collection, since module collection includes system generic module and module group, m >= n。
In step s3, in dependence matrix R, work as Rij=RjiWhen=1;Alternatively, working as R (Mi, Mk1)=1, R (Mk1, Mk2)=1 ..., R (Mkp, Mj)=1 and R (Mj, MiWhen)=1,1≤i, k1 ..., kp, j≤n, then it represents that nonsystematic generic module it Between there are Circular dependency relationships.
In one embodiment, directly logical when module group only includes the nonsystematic generic module of dynamic library file type It crosses ldd function and obtains the dependence between any two of all modules.Establish in representation module group all modules between any two Dependence dependence matrix, according to dependence matrix judge in software to be analyzed between nonsystematic generic module whether There are Circular dependency relationships.
Fourth embodiment of the invention provides a kind of analysis method of module dependencies, states any embodiment before this invention On the basis of, according to dependence matrix S, alternatively, according to dependence matrix R, generation digraph G=<VG, EG>.
Wherein, a module of each node VG representation module group of digraph, each edge EG indicate the both ends on this side Dependence between node, EG={ Mi→Mj, MiAnd Mj∈ VG, i ≠ j }, Mi→MjRepresentation module MiRely on Mj
The dependence hierarchical relationship between nonsystematic generic module is obtained according to digraph G.
For example, with reference to module dependencies schematic diagram shown in Fig. 4, A → B, B → C, B → D, E → B, E → F, F → G.
When there are when directed circuit, then determine that there are Circular dependency relationships between nonsystematic generic module in digraph G.
Dependence matrix based on foundation can not only whether there is dependence between analysis module, moreover it is possible to analyze mould The hierarchical relationship of block dependence, and then whether there is Circular dependency relationship between determination module, it is software collaboration development block The software quality delivered provides detection foundation.
Fifth embodiment of the invention provides a kind of analysis method of module dependencies, states any embodiment before this invention On the basis of, Fig. 5 show the analysis method flow chart that whether there is Circular dependency relationship between nonsystematic generic module, comprising:
S31 calculates the in-degree of each node of digraph according to dependence matrix R.
S32 deletes in-degree and is 0 node, and the in-degree for the node being connected with deleted node is subtracted 1.
S33 judges whether there is the node that in-degree is 0, if so, return step S32;If it is not, entering step S34.
S34 judges whether there is not deleted node, if it is not, entering step S35;If so, entering step S36.
Circular dependency relationship is not present in S35, terminates.
There are Circular dependency relationships by S36, terminate.
According to dependence matrix, the in-degree of each node of digraph is calculated;The node that in-degree is 0 is deleted, and will be with The in-degree for being deleted the connected node of node subtracts 1, until node is all deleted or the in-degree of residue node is not 0;When When the in-degree of remaining node is not 0, then determine that calculating process is simple there are Circular dependency relationship between nonsystematic generic module, energy Enough it is quickly obtained module dependencies.
Sixth embodiment of the invention provides a kind of analysis system of module dependencies comprising pretreatment unit, analysis Unit and aggregation process unit, for realizing the analysis method of the module dependencies of any of the above-described embodiment.
Fig. 6 show the application schematic diagram of the analysis system of module dependencies.
Pretreatment unit is for obtaining nonsystematic generic module all in software to be analyzed to construct a module group.
Analytical unit is for obtaining the dependence between any two of all modules in module group.
The dependence that aggregation process unit is used to establish the dependence between any two of all modules in representation module group is closed It is matrix, is judged to whether there is Circular dependency relationship in software to be analyzed between nonsystematic generic module according to dependence matrix.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as protection of the invention Within the scope of.The content being not described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.

Claims (10)

1. a kind of analysis method of module dependencies, characterized in that it comprises:
Nonsystematic generic module all in software to be analyzed is obtained to construct a module group;
Obtain the dependence between any two of all modules in module group;
The dependence matrix for establishing the dependence between any two of all modules in representation module group, according to dependence square Battle array judges to whether there is Circular dependency relationship in software to be analyzed between nonsystematic generic module.
2. the analysis method of module dependencies as described in claim 1, it is characterised in that: the module in the module group Between carry out function name call directly analysis, obtain the dependence between any two of all modules;Alternatively,
When the module group includes the nonsystematic generic module of static library file type, by the non-system of each static library file type System generic module is converted to the module of dynamic library file type, is closed by the dependence between any two that ldd function obtains all modules System;Alternatively,
When the module group includes the nonsystematic generic module of static library file type and the nonsystematic class mould of dynamic library file type When block, between the module of static library file type and the module of the module of static library file type and dynamic library file type Between, analysis is called directly by function name and obtains the dependence between any two of module, and is moved by ldd function The dependence between any two of the module of state library file type.
3. the analysis method of module dependencies as claimed in claim 2, which is characterized in that the module M in the module groupi And MjBetween carry out the function name method that calls directly analysis are as follows: as module MiAn external symbol and module MjOne it is complete When office's symbol is identical, determination module MiTo module MjExistence function adduction relationship, i.e. MiRely on Mj, wherein global symbol is definition In the function name of inside modules, external symbol is the function name for being defined on module-external and quoting in the module.
4. the analysis method of module dependencies as claimed in claim 2, it is characterised in that: when the static library file type Nonsystematic generic module be .a file when .a file is expanded into .obj file using compilation tool, then .obj file is compiled For .so file.
5. the analysis method of module dependencies as described in claim 1, it is characterised in that: will be i-th in the module group Module MiWith j-th of module MjDependence between any two is denoted as Rij=R (Mi, Mj) and Rji=R (Mj, Mi), Rij=0 indicates MiM is not depended onj, Rij=1 indicates MiRely on Mj;Rji=0 indicates MjM is not depended oni, Rji=1 indicates MjRely on Mi, 1≤i≤n, 1≤j≤n, n are the total number of modules of the module group;
The dependence matrix R is n × n matrix, RijAnd RjiIt is the element of the dependence matrix R.
6. the analysis method of module dependencies as claimed in claim 5, it is characterised in that: in the dependence matrix R In, work as Rij=RjiWhen=1;Alternatively, working as R (Mi, Mk1)=1, R (Mk1, Mk2)=1 ..., R (Mkp, Mj)=1 and R (Mj, Mi)=1 When, 1≤i, k1 ..., kp, j≤n, then it represents that there are Circular dependency relationships between the nonsystematic generic module.
7. the analysis method of module dependencies as claimed in claim 5, it is characterised in that: according to the dependence matrix R, generation digraph G=<VG, EG>, wherein each node VG of digraph indicates a module of the module group, each edge EG indicates the dependence between two end nodes on this side, EG={ Mi→Mj, MiAnd Mj∈ VG, i ≠ j }, Mi→MjIndicate mould Block MiRely on Mj
The dependence hierarchical relationship between the nonsystematic generic module is obtained according to the digraph G.
8. the analysis method of module dependencies as claimed in claim 7, it is characterised in that: exist when in the digraph G When directed circuit, then determine that there are Circular dependency relationships between the nonsystematic generic module.
9. the analysis method of module dependencies as claimed in claim 7, it is characterised in that: according to the dependence matrix R calculates the in-degree of each node of the digraph;
It deletes in-degree and is 0 node, and the in-degree for the node being connected with deleted node is subtracted 1, until node is all deleted It removes or the in-degree of remaining node is not 0;
When the in-degree of remaining node is not 0, then determine that there are Circular dependency relationships between the nonsystematic generic module.
10. a kind of analysis system of module dependencies, characterized in that it comprises:
Pretreatment unit is used to obtain nonsystematic generic module all in software to be analyzed to construct a module group;
Analytical unit is used to obtain the dependence between any two of all modules in module group;
Aggregation process unit is used to establish the dependence of the dependence between any two of all modules in representation module group Matrix judges to whether there is Circular dependency relationship in software to be analyzed between nonsystematic generic module according to dependence matrix.
CN201810725653.4A 2018-07-04 2018-07-04 Method and system for analyzing module dependency relationship Active CN109086050B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810725653.4A CN109086050B (en) 2018-07-04 2018-07-04 Method and system for analyzing module dependency relationship

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810725653.4A CN109086050B (en) 2018-07-04 2018-07-04 Method and system for analyzing module dependency relationship

Publications (2)

Publication Number Publication Date
CN109086050A true CN109086050A (en) 2018-12-25
CN109086050B CN109086050B (en) 2021-11-30

Family

ID=64837296

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810725653.4A Active CN109086050B (en) 2018-07-04 2018-07-04 Method and system for analyzing module dependency relationship

Country Status (1)

Country Link
CN (1) CN109086050B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112748952A (en) * 2019-10-30 2021-05-04 武汉斗鱼鱼乐网络科技有限公司 Method, device, equipment and storage medium for detecting ring dependency relationship
CN112837026A (en) * 2021-01-22 2021-05-25 山东浪潮通软信息科技有限公司 Method, device and equipment for analyzing delivery cycle dependence and storage medium
CN113326047A (en) * 2021-06-10 2021-08-31 南京大学 C language code dependency relationship extraction method based on static analysis
CN114036769A (en) * 2021-11-18 2022-02-11 中国航空无线电电子研究所 Avionics system physical architecture-oriented function deployment scheme generation method and device
CN114579349A (en) * 2022-05-09 2022-06-03 浙江太美医疗科技股份有限公司 Form annular event recognition method and device, electronic equipment and storage medium
CN114741121A (en) * 2022-04-14 2022-07-12 哲库科技(北京)有限公司 Method and device for loading module and electronic equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100100874A1 (en) * 2008-10-22 2010-04-22 Ajikumar Thaitharanikarthu Narayanan Complexity dependency change impact system and method
CN103678121A (en) * 2013-11-18 2014-03-26 杭州电子科技大学 Testing case priority ordering method for embedded binary system software
CN104063220A (en) * 2014-06-25 2014-09-24 清华大学 Linux basic software dependency relationship analysis method based on files
CN104965760A (en) * 2015-06-29 2015-10-07 广州酷狗计算机科技有限公司 Method and apparatus for managing life cycle of software function module
US20150363195A1 (en) * 2014-06-16 2015-12-17 npm, Inc. Software package management
CN106294156A (en) * 2016-08-11 2017-01-04 北京邮电大学 A kind of static code fault detection analysis method and device
CN106775705A (en) * 2016-12-12 2017-05-31 西安邮电大学 A kind of software module division methods
CN106970788A (en) * 2017-02-24 2017-07-21 中国人民解放军海军大连舰艇学院 A kind of object dependency relation based on tense finds method and system
CN107832080A (en) * 2017-10-17 2018-03-23 云南大学 Component Importance measure based on node betweenness under a kind of Software Evolution environment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100100874A1 (en) * 2008-10-22 2010-04-22 Ajikumar Thaitharanikarthu Narayanan Complexity dependency change impact system and method
CN103678121A (en) * 2013-11-18 2014-03-26 杭州电子科技大学 Testing case priority ordering method for embedded binary system software
US20150363195A1 (en) * 2014-06-16 2015-12-17 npm, Inc. Software package management
CN104063220A (en) * 2014-06-25 2014-09-24 清华大学 Linux basic software dependency relationship analysis method based on files
CN104965760A (en) * 2015-06-29 2015-10-07 广州酷狗计算机科技有限公司 Method and apparatus for managing life cycle of software function module
CN106294156A (en) * 2016-08-11 2017-01-04 北京邮电大学 A kind of static code fault detection analysis method and device
CN106775705A (en) * 2016-12-12 2017-05-31 西安邮电大学 A kind of software module division methods
CN106970788A (en) * 2017-02-24 2017-07-21 中国人民解放军海军大连舰艇学院 A kind of object dependency relation based on tense finds method and system
CN107832080A (en) * 2017-10-17 2018-03-23 云南大学 Component Importance measure based on node betweenness under a kind of Software Evolution environment

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
LAVAL J , DENIER S , DUCASSE S , ET AL.: "Identifying cycle causes with Enriched Dependency Structural Matrix", 《2009 16TH WORKING CONFERENCE ON REVERSE ENGINEERING》 *
季永炜,徐洁洁,赵浩强,黄秋霞: "基于依赖关系模型的复杂软件系统架构管理方法的研究", 《电脑编程技巧与维护》 *
田芳,曾颜,熊中柱: "EPON系统远端设备升级方案浅析", 《电视技术》 *
赫枫龄, 刘磊, 张孝志: "用有向图法解决公式循环依赖问题", 《计算机工程与设计》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112748952A (en) * 2019-10-30 2021-05-04 武汉斗鱼鱼乐网络科技有限公司 Method, device, equipment and storage medium for detecting ring dependency relationship
CN112837026A (en) * 2021-01-22 2021-05-25 山东浪潮通软信息科技有限公司 Method, device and equipment for analyzing delivery cycle dependence and storage medium
CN113326047A (en) * 2021-06-10 2021-08-31 南京大学 C language code dependency relationship extraction method based on static analysis
CN113326047B (en) * 2021-06-10 2023-11-03 南京大学 C language code dependency relation extraction method based on static analysis
CN114036769A (en) * 2021-11-18 2022-02-11 中国航空无线电电子研究所 Avionics system physical architecture-oriented function deployment scheme generation method and device
CN114036769B (en) * 2021-11-18 2023-09-08 中国航空无线电电子研究所 Avionics system physical architecture-oriented function deployment scheme generation method and device
CN114741121A (en) * 2022-04-14 2022-07-12 哲库科技(北京)有限公司 Method and device for loading module and electronic equipment
CN114741121B (en) * 2022-04-14 2023-10-20 哲库科技(北京)有限公司 Method and device for loading module and electronic equipment
CN114579349A (en) * 2022-05-09 2022-06-03 浙江太美医疗科技股份有限公司 Form annular event recognition method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109086050B (en) 2021-11-30

Similar Documents

Publication Publication Date Title
CN109086050A (en) A kind of analysis method and system of module dependencies
CN102831057B (en) Method for analyzing software function change and influence thereof by using function diagram
Langer et al. A posteriori operation detection in evolving software models
CN105159715A (en) Python code change reminding method on basis of abstract syntax tree node change extraction
Zhang et al. Analyzing and supporting adaptation of online code examples
US8255883B2 (en) Translating late bound LINQ expressions into database queries
CN102270128B (en) Storehouse consistency checker
CN103336760A (en) Method and device based on reverse engineering for automatically generating software documents
CN103279631B (en) The Java code review method of Design Mode guidance
CN103544100A (en) Method, system and client side for testing APP of portable data processing equipment
Kolovos et al. Assessing the Use of Eclipse MDE Technologies in Open-Source Software Projects.
CN106407357A (en) Engineering method for developing text data rule model
Koyuncu et al. Impact of tool support in patch construction
CN103648116B (en) The power consumption wireless sensor network optimized approach analyzed based on program
Pan et al. Class structure refactoring of object-oriented softwares using community detection in dependency networks
Shrestha et al. SLNET: A redistributable corpus of 3rd-party Simulink models
CN107480061A (en) A kind of Automation regression testing method that change module is built based on Jenkins CI
Bohluli et al. Detecting privacy leaks in android apps using inter-component information flow control analysis
CN104731705A (en) Dirty data propagation path finding method based on complex network
CN110750582A (en) Data processing method, device and system
Basha et al. A strategy to identify components using clustering approach for component reusability
Johannsen et al. Supporting knowledge elicitation and analysis for business process improvement through a modeling tool
CN104636258B (en) Towards the credible method of testing of restructural support programs
Gröner et al. Categorization and recognition of ontology refactoring pattern
Lock et al. Tool support for requirement level change management and impact analysis

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant