CN112230980A - Dependency relationship detection method and device, electronic equipment and storage medium - Google Patents

Dependency relationship detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112230980A
CN112230980A CN202011044096.3A CN202011044096A CN112230980A CN 112230980 A CN112230980 A CN 112230980A CN 202011044096 A CN202011044096 A CN 202011044096A CN 112230980 A CN112230980 A CN 112230980A
Authority
CN
China
Prior art keywords
symbol table
file
detected
symbol
external
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.)
Pending
Application number
CN202011044096.3A
Other languages
Chinese (zh)
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.)
Beijing 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology 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 Beijing 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN202011044096.3A priority Critical patent/CN112230980A/en
Publication of CN112230980A publication Critical patent/CN112230980A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention provides a dependency relationship detection method and device, electronic equipment and a storage medium. The method comprises the following steps: traversing and analyzing each file to be detected, and acquiring a symbol table in each target file contained in the file to be detected, wherein the file to be detected comprises at least one of a static library and the target file; according to the symbol table in each target file contained in each file to be detected, constructing an internal symbol table and an external symbol table of each file to be detected, wherein the internal symbol table comprises internal symbols in the file to be detected, and the external symbol table comprises external symbols in the file to be detected; and acquiring the dependency relationship among the files to be detected according to the internal symbol table and the external symbol table of each file to be detected. Therefore, the method has the advantages that the complexity of manually analyzing the binary file is avoided, a large amount of repeated work is avoided, and the detection efficiency of the dependency relationship is improved.

Description

Dependency relationship detection method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a dependency relationship detection method and apparatus, an electronic device, and a storage medium.
Background
In the Development process, some third-party-provided SDKs (Software Development Kit) are often used, such as a map navigation function provided by a third-party SDK having a navigation function, a user chat function provided by a third-party SDK having a chat function, and so on. Moreover, the third-party SDK may provide more than one static library, each static library often has a certain dependency relationship, and the combing of the dependency relationship of the static libraries plays an important role in framework adjustment.
In the related art, the main technical means for combing the dependency relationship between the static libraries is to access the static libraries one by one in the test project for compiling. Assuming that a SDK has 2 static libraries, each A, B, it needs to access a and B independently in a test project (e.g. an empty APP project created randomly), and then compile separately, which indicates that the currently accessed static library does not depend on any static library if compiling link is successful, and indicates that it has a dependent static library if error is reported. If the independent access A can compile and link successfully and the independent access B fails, the method shows that A does not depend on any static library and B has a dependent static library. And then accessing A into the project of B, and if the compiling link is converted from failure to success, indicating that B depends on A.
However, if a certain SDK contains more static library files, the testing procedure will grow explosively, and if there is a dependency relationship between the SDK and the SDK, the technical cost of the above carding will increase dramatically. Therefore, the technical problems of complex operation, long time consumption and the like exist in the dependency relationship detection process.
Disclosure of Invention
Embodiments of the present invention provide a dependency relationship detection method, an apparatus, an electronic device, and a storage medium, so as to solve the problems of complex operation and long time consumption in the existing dependency relationship detection process.
In order to solve the technical problem, the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a dependency relationship detection method, including:
traversing and analyzing each file to be detected, and acquiring a symbol table in each target file contained in the file to be detected, wherein the file to be detected comprises at least one of a static library and the target file;
according to the symbol table in each target file contained in each file to be detected, constructing an internal symbol table and an external symbol table of each file to be detected, wherein the internal symbol table comprises internal symbols in the file to be detected, and the external symbol table comprises external symbols in the file to be detected;
and acquiring the dependency relationship among the files to be detected according to the internal symbol table and the external symbol table of each file to be detected.
Optionally, the step of constructing an internal symbol table and an external symbol table of each file to be detected according to a symbol table in each target file included in each file to be detected includes:
under the condition that the file to be detected is a static library, generating an internal symbol table and an external symbol table of each target file contained in the static library according to the symbol table in each target file contained in the static library;
generating an internal symbol table and an external symbol table of the static library according to the internal symbol table and the external symbol table of each target file contained in the static library;
and under the condition that the file to be detected is the target file, generating an internal symbol table and an external symbol table of the target file according to the symbol table in the target file.
Optionally, the step of generating an internal symbol table and an external symbol table of each target file included in the static library according to the symbol table in each target file included in the static library includes:
aiming at any target file contained in the static library, obtaining symbols contained in the target file and symbol types of the symbols according to a symbol table in the target file;
obtaining a symbol with a symbol type as a target type, taking the symbol as an external symbol of the target file, and generating an external symbol table of the target file based on the external symbol of the target file, wherein the target type comprises an undefined type;
obtaining symbols with other types of symbol types as internal symbols of the target file, and generating an internal symbol table of the target file based on the internal symbols of the target file, wherein the other types are other symbol types except the target type.
Optionally, the step of generating the internal symbol table and the external symbol table of the static library according to the internal symbol table and the external symbol table of each target file included in the static library includes:
creating the internal symbol table of the static library, and integrating and archiving the internal symbol tables of all target files under the static library into the internal symbol table of the static library;
and creating the external symbol table of the static library, and integrating and archiving the external symbol tables of all target files under the static library into the external symbol table of the static library.
Optionally, the step of constructing an internal symbol table and an external symbol table of each file to be detected according to a symbol table in each target file included in each file to be detected includes:
acquiring an internal symbol table and an initial external symbol table of each file to be detected according to the symbol table in each target file contained in each file to be detected;
and aiming at any file to be detected, acquiring a target symbol which is simultaneously present in an internal symbol table and an initial external symbol table of the file to be detected, and removing the target symbol from the initial external symbol table to obtain the external symbol table of the file to be detected.
Optionally, the step of traversing and analyzing each file to be detected and obtaining a symbol table in each target file included in the file to be detected includes:
traversing and analyzing each file to be detected, and acquiring a target file contained in each file to be detected;
and traversing each target file, and acquiring a symbol table of the target file from the target file according to format conditions met by the symbol table.
Optionally, the step of obtaining the dependency relationship between the files to be detected according to the internal symbol table and the external symbol table of each file to be detected includes:
for any file to be detected, if at least one symbol exists in the external symbol table of the file to be detected and the internal symbol tables of other files to be detected, confirming that the file to be detected depends on the other files to be detected;
and the other files to be detected are other files to be detected except the current file to be detected.
In a second aspect, an embodiment of the present invention provides a dependency relationship detection apparatus, including:
the symbol table acquisition module is used for traversing and analyzing each file to be detected and acquiring a symbol table in each target file contained in the file to be detected, wherein the file to be detected comprises at least one of a static library and a target file;
an internal and external symbol table construction module, configured to construct an internal symbol table and an external symbol table of each to-be-detected file according to a symbol table in each target file included in each to-be-detected file, where the internal symbol table includes internal symbols in the to-be-detected file, and the external symbol table includes external symbols in the to-be-detected file;
and the dependency relationship detection module is used for acquiring the dependency relationship among the files to be detected according to the internal symbol table and the external symbol table of each file to be detected.
Optionally, the internal and external symbol table constructing module includes:
the first file symbol table constructing sub-module is used for generating an internal symbol table and an external symbol table of each target file contained in the static library according to the symbol table in each target file contained in the static library under the condition that the file to be detected is the static library;
the static library symbol table constructing submodule is used for generating an internal symbol table and an external symbol table of the static library according to the internal symbol table and the external symbol table of each target file contained in the static library;
and the second file symbol table constructing submodule is used for generating an internal symbol table and an external symbol table of the target file according to the symbol table in the target file under the condition that the file to be detected is the target file.
Optionally, the first file symbol table constructing sub-module is specifically configured to:
aiming at any target file contained in the static library, obtaining symbols contained in the target file and symbol types of the symbols according to a symbol table in the target file;
obtaining a symbol with a symbol type as a target type, taking the symbol as an external symbol of the target file, and generating an external symbol table of the target file based on the external symbol of the target file, wherein the target type comprises an undefined type;
obtaining symbols with other types of symbol types as internal symbols of the target file, and generating an internal symbol table of the target file based on the internal symbols of the target file, wherein the other types are other symbol types except the target type.
Optionally, the static library symbol table constructing sub-module is specifically configured to:
creating the internal symbol table of the static library, and integrating and archiving the internal symbol tables of all target files under the static library into the internal symbol table of the static library;
and creating the external symbol table of the static library, and integrating and archiving the external symbol tables of all target files under the static library into the external symbol table of the static library.
Optionally, the internal and external symbol table constructing module is specifically configured to:
acquiring an internal symbol table and an initial external symbol table of each file to be detected according to the symbol table in each target file contained in each file to be detected;
and aiming at any file to be detected, acquiring a target symbol which is simultaneously present in an internal symbol table and an initial external symbol table of the file to be detected, and removing the target symbol from the initial external symbol table to obtain the external symbol table of the file to be detected.
Optionally, the symbol table obtaining module includes:
the target file acquisition submodule is used for traversing and analyzing each file to be detected and acquiring a target file contained in each file to be detected;
and the symbol table acquisition submodule is used for traversing each target file and acquiring the symbol table of the target file from the target file according to the format condition met by the symbol table.
Optionally, the dependency relationship detection module is specifically configured to:
for any file to be detected, if at least one symbol exists in the external symbol table of the file to be detected and the internal symbol tables of other files to be detected, confirming that the file to be detected depends on the other files to be detected;
and the other files to be detected are other files to be detected except the current file to be detected.
In a third aspect, an embodiment of the present invention additionally provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the dependency detection method according to the first aspect.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the steps of the dependency detection method according to the first aspect.
In the embodiment of the invention, the symbol tables in each target file contained in the file to be detected are integrated through the analysis of the binary file, the work of the linker is simulated, and the dependency relationship between the files to be detected is further analyzed. Therefore, the method has the advantages that the complexity of manually analyzing the binary file is avoided, a large amount of repeated work is avoided, the detection efficiency of the dependency relationship is improved, and meanwhile, a convenient detection method can be provided for framework adjustment of programs such as APP.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without inventive labor.
FIG. 1 is a flow chart of steps of a method for dependency detection in an embodiment of the present invention;
FIG. 2 is a flow chart of steps of another dependency detection method in an embodiment of the present invention;
FIG. 3 is a schematic flow chart illustrating a process of obtaining a dependency relationship between two static libraries according to an embodiment of the present invention;
FIG. 4 is a flow chart of steps of another dependency detection method in an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a dependency relationship detection apparatus in an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of another dependency relationship detection apparatus in an embodiment of the present invention;
fig. 7 is a schematic diagram of a hardware structure of an electronic device in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a flowchart illustrating steps of a dependency detection method according to an embodiment of the present invention is shown.
Step 110, traversing and analyzing each file to be detected, and acquiring a symbol table in each target file contained in the file to be detected, wherein the file to be detected comprises at least one of a static library and the target file;
step 120, according to the symbol table in each target file contained in each file to be detected, constructing an internal symbol table and an external symbol table of each file to be detected, wherein the internal symbol table comprises internal symbols in the file to be detected, and the external symbol table comprises external symbols in the file to be detected;
and step 130, obtaining the dependency relationship among the files to be detected according to the internal symbol table and the external symbol table of each file to be detected.
As mentioned above, in practical application, a Linker (Linker) can be used to perform static library, target file and wait for the dependency relationship combing of the detected files. A linker may be understood as a program that links one or more object files generated by a compiler or assembler, plus the library, into an executable file. If the A static library does not exist in the item, the linker cannot find the symbol on which the B depends in work, and thus an error is reported. A static library is understood to be a collection of object files, which are the compiled products of the code source files.
When dependency relationship detection is performed based on the linker, executable files need to be generated for each file to be detected through the linker, but if a certain SDK contains more static library files, the testing steps will increase explosively, and if a dependency relationship exists between the SDK and the SDK, the technical cost of the carding will increase sharply.
Therefore, in the embodiment of the invention, the working flow of the linker can be imitated, the dependency relationship between the static libraries can be determined according to the symbol table of each target file of each static library, the complexity of manually analyzing the binary file can be avoided, a large amount of repeated work can be saved, and the detection efficiency of the dependency relationship can be improved. Also, as described above, the static library is composed of one or more object files and is arranged in sequence. In addition, a symbol table is present in the target file, and the symbol table is used for recording symbol information such as the type of the symbol contained in the target file and the address corresponding to the symbol. Therefore, specifically, in the embodiment of the present invention, each file to be detected may be traversed and analyzed, and a symbol table in each target file included in the file to be detected is obtained, where the file to be detected includes at least one of a static library and a target file.
And then, an internal symbol table and an external symbol table of each file to be detected can be established according to the symbol table in each target file contained in each file to be detected, wherein the internal symbol table comprises internal symbols in the file to be detected, and the external symbol table comprises external symbols in the file to be detected, so that the internal symbol table and the external symbol table of each file to be detected can be obtained, the work of a linker can be simulated, the dependency relationship between the files to be detected can be analyzed, and an executable file does not need to be generated for each file to be detected through the linker.
The specific format of the symbol table of the target file may be different in different operating systems, and the symbol table in the target file may be identified in any available manner, which is not limited in this embodiment of the present invention. Moreover, the external symbol may be understood as a symbol used in the file to be detected but not defined in the file, the internal symbol may be understood as a symbol defined in the current file to be detected, and it may be assisted to confirm whether each symbol is an internal symbol or an external symbol based on the symbol type, where the symbol is actually data such as a variable name, a function name, and the like in a program such as a target file.
For example, the symbol table information is recorded in the section of symtab of the target file, the symbol represents a structure array, and the structure of each table entry (16 bytes) can be as follows:
Typedefstruct{
elf32_ Word st _ name; v symbol corresponds to the offset of the string in strtab section +
Elf32_ Addr st _ value; v offset in corresponding byte, or virtual address +
Elf32_ Addr st _ size; v symbol corresponds to the number of target bytes +
Unogned char st _ info; /' indicates the Type of symbol (Type) and binding attribute (Bind)/
Unsigned char st_other;
Elf32_ Half st _ shndx; the symbol/corresponds to the node on which the target is located, or else
}Elf32_Sym;
Also, readelf-s may be used to view symbol table information of the target file, and so on.
After obtaining the symbol table in each target file included in each file to be detected, the internal symbol and the external symbol of each file to be detected may be obtained according to the symbol information included in the symbol table in each target file included in each file to be detected, and further, for each file to be detected, an internal symbol table may be generated based on all internal symbols thereof, and an external symbol table may be generated based on all external symbols thereof, which is not limited in the embodiment of the present invention. The specific formats of the internal symbol table and the external symbol table can be set by self-definition according to requirements, and the embodiment of the invention is not limited.
After the internal symbol table and the external symbol table of each file to be detected are generated, because the internal symbol table includes the internal symbols in the files to be detected and the external symbol table includes the external symbols in the files to be detected, the dependency relationship between the files to be detected can be obtained based on the internal symbol table and the external symbol table of each file to be detected.
For example, if there is a symbol in both the external symbol table of the current file to be detected (assuming that the current file to be detected is a) and the internal symbol table of another file to be detected (assuming that the another file to be detected is B), then it can be confirmed that the current a depends on B; conversely, if there is a symbol in both the external symbol table of B and the internal symbol table of a, then B can be confirmed to be dependent on a; and so on.
Referring to fig. 2, in the embodiment of the present invention, the step 120 may further include:
step 121, under the condition that the file to be detected is a static library, generating an internal symbol table and an external symbol table of each target file contained in the static library according to the symbol table in each target file contained in the static library;
step 122, generating an internal symbol table and an external symbol table of the static library according to the internal symbol table and the external symbol table of each target file contained in the static library;
and 123, under the condition that the file to be detected is the target file, generating an internal symbol table and an external symbol table of the target file according to the symbol table in the target file.
As described above, in practical applications, the files to be detected may be static libraries, target files, and the like, so as to detect the dependency relationship between the static libraries, the dependency relationship between the target files, or the dependency relationship between the static libraries and the target files, and the like. Moreover, the static library may be a set of target files, and in order to ensure accuracy of the dependency relationship, the obtained internal symbol table of the static library needs to include an internal symbol in each target file included in the static library, and correspondingly, the obtained external symbol table of the static library needs to include an external symbol in each target file included in the static library, so that when the file to be detected is the static library, and when the internal symbol table and the external symbol table of the static library are obtained, the internal symbol table and the external symbol table of the static library may be used as a unit of the target file, and according to the symbol table in each target file included in the static library, the internal symbol table and the external symbol table of the static library may be further generated according to the internal symbol table and the external symbol table of each target file included in the static library. And if the file to be detected is the target file, an internal symbol table and an external symbol table of the corresponding target file can be generated directly according to the symbol text of the corresponding target file.
Of course, in the embodiment of the present invention, when the file to be detected is a static library, the internal symbol and the external symbol of each target file included in the corresponding static library may also be directly obtained, without generating the internal symbol table and the external symbol table of each target file included in the corresponding static library, and further, the internal symbol table and the external symbol table of the corresponding static library are directly generated based on the internal symbol and the external symbol of each target file included in the corresponding static library, which is not limited in the embodiment of the present invention.
Moreover, in the embodiment of the present invention, when obtaining the internal symbol and the external symbol of each target file included in the corresponding static library, the symbol table in each target file included in the corresponding static library may be obtained according to the symbol table in each target file by using the target file as a unit, and further, the external symbol and the internal symbol corresponding to each target file may be obtained according to the symbol information, such as each symbol included in the symbol table of each target file and the symbol type of each symbol.
Fig. 3 is a schematic flow chart illustrating a process of obtaining a dependency relationship between two static libraries when a file to be detected is a static library. One of the static libraries contains object file a.o, object file b.o, object file c.o, object file d.o, etc., the other static library contains object file e.o, object file f.o, object file g.o, object file h.o, etc., the internal symbol and external symbol of each object file can be obtained according to the symbol table in each object file contained in the static libraries, respectively, so as to integrate the symbols, obtain the internal symbol and external symbol of the static libraries, and before determining the dependency relationship, further symbol check can be performed on the internal symbol and external symbol of each static library (for example, whether the symbol format is correct, for the same static library, if a symbol is both an external symbol and an internal symbol, it is taken as an internal symbol and removed from the external symbol, etc.), and finally the internal symbol and external symbol of each static library can be based on, and obtaining the dependency relationship among the static libraries, and outputting the dependency relationship in the form of a dependency relationship table.
Optionally, in an embodiment of the present invention, the step 121 may further include:
step 1211, aiming at any target file contained in the static library, obtaining symbols contained in the target file and symbol types of the symbols according to a symbol table in the target file;
step 1212, obtaining a symbol with a symbol type as a target type, as an external symbol of the target file, and generating an external symbol table of the target file based on the external symbol of the target file, where the target type includes an undefined type;
step 1213, obtaining a symbol with a symbol type of other types as the internal symbol of the target file, and generating an internal symbol table of the target file based on the internal symbol of the target file, where the other types are other symbol types except the target type.
As described above, the symbol table in the target file can be used to record symbol information such as the type of the symbol and the address corresponding to the symbol in the corresponding target file. Therefore, in the embodiment of the present invention, the symbol information, such as the symbol included in the corresponding target file, and the symbol type of each symbol, may be obtained according to the symbol table in the target file.
For example, taking a symbol table of a target file in an iOS system as an example, the symbol table may include one or more structures, and in general, one structure may correspond to one symbol, and it is assumed that a certain structure is as follows:
Figure BDA0002707463980000111
where n _ type of symbols in iOS, i.e. symbol type, can be classified as: n _ undif (undefined), N _ ABS (absolute), N _ search (defined), N _ PBUD (defined in dynamic library), N _ INDR (indirect type) are 5 types in total. Wherein, the symbol with N _ type as N _ undif type belongs to the external symbol, and the other symbols are internal symbols. Therefore, in the IOS system, each symbol with N _ type N _ UNDF in the symbol table can be put into the external symbol table, and other types of symbols can be put into the internal symbol table. Of course, if in other application scenarios, the symbol type specifically included in the target type may also be customized or adjusted according to the requirement, which is not limited in this embodiment of the present invention.
Of course, in the embodiment of the present invention, for the static library, if the internal symbol table and the external symbol table of each target file included in the static library are not generated, but the internal symbol table and the external symbol table of each target file included in the static library are directly obtained, and the internal symbol table and the external symbol table of the static library are directly generated, then for each target file included in the static library, the above-mentioned step 1211 and 1213 may be performed to obtain the internal symbol and the external symbol of each target file included in the static library.
Optionally, in an embodiment of the present invention, the step 122 further includes:
step 1221, creating the internal symbol tables of the static library, and integrating and archiving the internal symbol tables of all target files in the static library into the internal symbol tables of the static library;
step 1222, creating the external symbol tables of the static library, and integrating and archiving the external symbol tables of all target files under the static library into the external symbol tables of the static library.
After obtaining the internal symbol table and the external symbol table of each target file contained in the static library, in order to obtain the internal symbol table and the external symbol table of the static library, the internal symbol table of the static library may be further created, and the internal symbol tables of all target files in the static library are integrated and filed in the internal symbol table of the static library; and simultaneously, creating the external symbol table of the static library, and integrating and archiving the external symbol tables of all target files under the static library into the external symbol table of the static library.
For example, the target files a1 and a2 are included in the static library a, after the internal symbol tables and the external symbol tables of a1 and a2 are obtained, the internal symbol tables of a1 and a2 may be further integrated and archived into the internal symbol tables of the static library, that is, the internal symbols included in the internal symbol tables of a1 and a2 are integrated and archived into the internal symbol tables of the static library, and if there are coincident internal symbols in the internal symbol tables of a1 and a2, the internal symbols included in the internal symbol tables of the static library may be further subjected to a deduplication processing, so that each symbol appears only once. Accordingly, the external symbol tables of a1 and a2 are integrated and archived into the external symbol tables of the static library, that is, the external symbols contained in the external symbol tables of a1 and a2 are integrated and archived into the external symbol tables of the static library, and if there are coincident external symbols in the external symbol tables of a1 and a2, then in the external symbol tables of the static library, the external symbols contained therein can also be subjected to deduplication processing, so that each symbol appears only once. Of course, in the embodiment of the present invention, the deduplication processing may not be performed according to the requirement, and the embodiment of the present invention is not limited.
Referring to fig. 2, in an embodiment of the present invention, the step 110 may further include:
step 111, traversing and analyzing each file to be detected, and acquiring a target file contained in each file to be detected;
and step 112, traversing each target file, and acquiring a symbol table of the target file from the target file according to format conditions met by the symbol table.
As described above, a static library is composed of one or more object files and is arranged in sequence. Furthermore, a symbol table is present in the target file, and the symbol table is used for recording symbol information such as the type of the symbol and the address corresponding to the symbol. Therefore, in the embodiment of the present invention, in order to more accurately and comprehensively obtain the symbol table in each target file in the file to be detected, it is necessary to first obtain each target file included in the file to be detected. Specifically, each file to be detected may be traversed and analyzed, and a target file included in each file to be detected may be obtained. In addition, in the embodiment of the invention, the existence form of the target file may be different under different application scenes, so that the target file in the binary file serving as the file to be detected can be analyzed and traversed according to a certain rule under the current application scene. The rules in different application scenarios can be set by user according to requirements, and the embodiment of the invention is not limited.
And then, each target file can be traversed, and the symbol table of the target file is obtained from the target file according to the format condition met by the symbol table. Under different application scenarios, the format conditions met by the symbol table can be set by self-definition according to requirements, and the embodiment of the invention is not limited.
In addition, in the embodiment of the present invention, if the file to be detected is the target file, the step 112 may be directly executed to obtain the symbol table in the target file without parsing the file to be detected to obtain the target file.
Referring to fig. 2, in an embodiment of the present invention, the step 130 may further include: for any file to be detected, if at least one symbol exists in the external symbol table of the file to be detected and the internal symbol tables of other files to be detected, confirming that the file to be detected depends on the other files to be detected; and the other files to be detected are other files to be detected except the current file to be detected.
After the internal symbol table and the external symbol table of each file to be detected are obtained, in order to detect the dependency relationship between the files to be detected, the external symbol table of each file to be detected can be traversed, and for any file to be detected, if at least one symbol exists in the external symbol table of the file to be detected and the internal symbol tables of other files to be detected, the file to be detected is determined to depend on the other files to be detected, and the other files to be detected are other files to be detected except the current file to be detected.
For example, the external symbol table of each static library may be traversed, and a static library A is considered dependent on a static library B if there is at least one symbol both in the external symbol table of the current static library (assuming the current static library is A) and in the internal symbol table of some static library (assuming the static library is B).
Referring to fig. 4, in an embodiment of the present invention, the step 120 further includes:
step 124, obtaining an internal symbol table and an initial external symbol table of each file to be detected according to the symbol table in each target file contained in each file to be detected;
step 125, for any file to be detected, obtaining a target symbol existing in both the internal symbol table and the initial external symbol table of the file to be detected, and removing the target symbol from the initial external symbol table to obtain the external symbol table of the file to be detected.
As described above, when the internal symbol and the external symbol are distinguished, the internal symbol and the external symbol are analyzed based on the symbol information contained in the symbol table contained in the target file, and thus an error may occur, thereby affecting the accuracy of the detection result, and for the static library, if a plurality of target files are corresponded thereto, there may also be a dependency relationship between the target files contained in the same static library, for example, for the static library a, in which the target file a1 and the target file a2 are contained, there may exist a symbol fh1 both in the internal symbol table of the target file a1 and in the external symbol table of a2, when the internal symbol table and the external symbol table of the static library a are generated based on the internal symbol table and the external symbol table of the target file a1 and the internal symbol table and the external symbol table of the target file a2, the corresponding symbol fh1 may both exist in the internal symbol table and the external symbol table of the static library a, thereby affecting the accuracy of the subsequent dependency detection result.
Therefore, in the embodiment of the present invention, in order to further improve the accuracy of the dependency detection result, after the internal symbol table and the external symbol table of each file to be detected are generated, the external symbol table of each file to be detected may be further filtered, and symbols existing in both the internal symbol table and the external symbol table are deleted from the external symbol table. Specifically, for any file to be detected, a target symbol existing in both an internal symbol table and an initial external symbol table of the file to be detected may be obtained, and the target symbol may be removed from the initial external symbol table to obtain an external symbol table of the file to be detected. Moreover, in the embodiment of the present invention, the internal symbol table and the initial external symbol table of the file to be detected in step 124 may be obtained by any one of the above-mentioned methods for obtaining the internal symbol table and the external symbol table of the file to be detected, which is not limited to this embodiment of the present invention. For example, for static library A described above, each symbol in the external symbol table of static library A may be traversed, and if a symbol is simultaneously present in the internal symbol table of static library A during the traversal process, that symbol is removed from the external symbol table of static library A.
In the embodiment of the invention, the symbol tables in each target file contained in the file to be detected are integrated through the analysis of the binary file, the work of the linker is simulated, and the dependency relationship between the files to be detected is further analyzed. Therefore, the method has the advantages that the complexity of manually analyzing the binary file is avoided, a large amount of repeated work is avoided, the detection efficiency of the dependency relationship is improved, and meanwhile, a convenient detection method can be provided for framework adjustment of programs such as APP.
Referring to fig. 5, a schematic structural diagram of a dependency relationship detection apparatus in an embodiment of the present invention is shown.
The dependency relationship detection device of the embodiment of the invention comprises: a symbol table obtaining module 210, an internal and external symbol table constructing module 220 and a dependency relationship detecting module 230.
The functions of the modules and the interaction relationship between the modules are described in detail below.
The symbol table obtaining module 210 is configured to traverse and analyze each file to be detected, and obtain a symbol table in each target file included in the file to be detected, where the file to be detected includes at least one of a static library and a target file;
an internal and external symbol table constructing module 220, configured to construct an internal symbol table and an external symbol table of each to-be-detected file according to a symbol table in each target file included in each to-be-detected file, where the internal symbol table includes internal symbols in the to-be-detected file, and the external symbol table includes external symbols in the to-be-detected file;
the dependency relationship detecting module 230 is configured to obtain a dependency relationship between the files to be detected according to the internal symbol table and the external symbol table of each file to be detected.
Referring to fig. 6, in the embodiment of the present invention, the internal and external symbol table constructing module 220 may further include:
the first file symbol table constructing sub-module 221 is configured to, when the file to be detected is a static library, generate an internal symbol table and an external symbol table of each target file included in the static library according to a symbol table in each target file included in the static library;
a static library symbol table constructing sub-module 222, configured to generate an internal symbol table and an external symbol table of the static library according to the internal symbol table and the external symbol table of each target file included in the static library;
the second file symbol table constructing sub-module 223 is configured to, when the file to be detected is the target file, generate an internal symbol table and an external symbol table of the target file according to the symbol table in the target file.
Optionally, in this embodiment of the present invention, the first file symbol table constructing sub-module 221 may be specifically configured to:
aiming at any target file contained in the static library, obtaining symbols contained in the target file and symbol types of the symbols according to a symbol table in the target file;
obtaining a symbol with a symbol type as a target type, taking the symbol as an external symbol of the target file, and generating an external symbol table of the target file based on the external symbol of the target file, wherein the target type comprises an undefined type;
obtaining symbols with other types of symbol types as internal symbols of the target file, and generating an internal symbol table of the target file based on the internal symbols of the target file, wherein the other types are other symbol types except the target type.
Optionally, in this embodiment of the present invention, the static library symbol table constructing sub-module 222 may be specifically configured to:
creating the internal symbol table of the static library, and integrating and archiving the internal symbol tables of all target files under the static library into the internal symbol table of the static library;
and creating the external symbol table of the static library, and integrating and archiving the external symbol tables of all target files under the static library into the external symbol table of the static library.
Optionally, in this embodiment of the present invention, the internal and external symbol table constructing module 220 may be further configured to:
acquiring an internal symbol table and an initial external symbol table of each file to be detected according to the symbol table in each target file contained in each file to be detected;
and aiming at any file to be detected, acquiring a target symbol which is simultaneously present in an internal symbol table and an initial external symbol table of the file to be detected, and removing the target symbol from the initial external symbol table to obtain the external symbol table of the file to be detected.
Referring to fig. 6, in the embodiment of the present invention, the symbol table obtaining module 210 further includes:
the target file obtaining sub-module 211 is configured to traverse and analyze each to-be-detected file, and obtain a target file included in each to-be-detected file;
and the symbol table obtaining submodule 212 is configured to traverse each target file, and obtain a symbol table of the target file from the target file according to a format condition satisfied by the symbol table.
Optionally, in this embodiment of the present invention, the dependency relationship detecting module 230 may be specifically configured to: for any file to be detected, if at least one symbol exists in the external symbol table of the file to be detected and the internal symbol tables of other files to be detected, confirming that the file to be detected depends on the other files to be detected; and the other files to be detected are other files to be detected except the current file to be detected.
The dependency relationship detection apparatus provided in the embodiment of the present invention can implement each process implemented in the method embodiments of fig. 1 to fig. 2, and is not described here again to avoid repetition.
Preferably, an embodiment of the present invention further provides an electronic device, including: the processor, the memory, and the computer program stored in the memory and capable of running on the processor, when executed by the processor, implement each process of the above-mentioned dependency detection method embodiment, and can achieve the same technical effect, and are not described herein again to avoid repetition.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program implements each process of the above-mentioned dependency detection method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
Fig. 7 is a schematic diagram of a hardware structure of an electronic device implementing various embodiments of the present invention.
The electronic device 500 includes, but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, a processor 510, and a power supply 511. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 7 does not constitute a limitation of the electronic device, and that the electronic device may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. In the embodiment of the present invention, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like.
It should be understood that, in the embodiment of the present invention, the radio frequency unit 501 may be used for receiving and sending signals during a message sending and receiving process or a call process, and specifically, receives downlink data from a base station and then processes the received downlink data to the processor 510; in addition, the uplink data is transmitted to the base station. In general, radio frequency unit 501 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 501 can also communicate with a network and other devices through a wireless communication system.
The electronic device provides wireless broadband internet access to the user via the network module 502, such as assisting the user in sending and receiving e-mails, browsing web pages, and accessing streaming media.
The audio output unit 503 may convert audio data received by the radio frequency unit 501 or the network module 502 or stored in the memory 509 into an audio signal and output as sound. Also, the audio output unit 503 may also provide audio output related to a specific function performed by the electronic apparatus 500 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 503 includes a speaker, a buzzer, a receiver, and the like.
The input unit 504 is used to receive an audio or video signal. The input Unit 504 may include a Graphics Processing Unit (GPU) 5041 and a microphone 5042, and the Graphics processor 5041 processes image data of a still picture or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 506. The image frames processed by the graphic processor 5041 may be stored in the memory 509 (or other storage medium) or transmitted via the radio frequency unit 501 or the network module 502. The microphone 5042 may receive sounds and may be capable of processing such sounds into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 501 in case of the phone call mode.
The electronic device 500 also includes at least one sensor 505, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor includes an ambient light sensor that can adjust the brightness of the display panel 5061 according to the brightness of ambient light, and a proximity sensor that can turn off the display panel 5061 and/or a backlight when the electronic device 500 is moved to the ear. As one type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of an electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors 505 may also include fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which are not described in detail herein.
The display unit 506 is used to display information input by the user or information provided to the user. The Display unit 506 may include a Display panel 5061, and the Display panel 5061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 507 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device. Specifically, the user input unit 507 includes a touch panel 5071 and other input devices 5072. Touch panel 5071, also referred to as a touch screen, may collect touch operations by a user on or near it (e.g., operations by a user on or near touch panel 5071 using a finger, stylus, or any suitable object or attachment). The touch panel 5071 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 510, and receives and executes commands sent by the processor 510. In addition, the touch panel 5071 may be implemented in various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 5071, the user input unit 507 may include other input devices 5072. In particular, other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein.
Further, the touch panel 5071 may be overlaid on the display panel 5061, and when the touch panel 5071 detects a touch operation thereon or nearby, the touch operation is transmitted to the processor 510 to determine the type of the touch event, and then the processor 510 provides a corresponding visual output on the display panel 5061 according to the type of the touch event. Although in fig. 7, the touch panel 5071 and the display panel 5061 are two independent components to implement the input and output functions of the electronic device, in some embodiments, the touch panel 5071 and the display panel 5061 may be integrated to implement the input and output functions of the electronic device, and is not limited herein.
The interface unit 508 is an interface for connecting an external device to the electronic apparatus 500. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 508 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the electronic apparatus 500 or may be used to transmit data between the electronic apparatus 500 and external devices.
The memory 509 may be used to store software programs as well as various data. The memory 509 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 509 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The processor 510 is a control center of the electronic device, connects various parts of the whole electronic device by using various interfaces and lines, performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 509 and calling data stored in the memory 509, thereby performing overall monitoring of the electronic device. Processor 510 may include one or more processing units; preferably, the processor 510 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 510.
The electronic device 500 may further include a power supply 511 (e.g., a battery) for supplying power to various components, and preferably, the power supply 511 may be logically connected to the processor 510 via a power management system, so as to implement functions of managing charging, discharging, and power consumption via the power management system.
In addition, the electronic device 500 includes some functional modules that are not shown, and are not described in detail herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (16)

1. A dependency detection method, comprising:
traversing and analyzing each file to be detected, and acquiring a symbol table in each target file contained in the file to be detected, wherein the file to be detected comprises at least one of a static library and the target file;
according to the symbol table in each target file contained in each file to be detected, constructing an internal symbol table and an external symbol table of each file to be detected, wherein the internal symbol table comprises internal symbols in the file to be detected, and the external symbol table comprises external symbols in the file to be detected;
and acquiring the dependency relationship among the files to be detected according to the internal symbol table and the external symbol table of each file to be detected.
2. The method according to claim 1, wherein the step of constructing an internal symbol table and an external symbol table of each file to be detected according to a symbol table in each target file contained in each file to be detected comprises:
under the condition that the file to be detected is a static library, generating an internal symbol table and an external symbol table of each target file contained in the static library according to the symbol table in each target file contained in the static library;
generating an internal symbol table and an external symbol table of the static library according to the internal symbol table and the external symbol table of each target file contained in the static library;
and under the condition that the file to be detected is the target file, generating an internal symbol table and an external symbol table of the target file according to the symbol table in the target file.
3. The method according to claim 2, wherein the step of generating an internal symbol table and an external symbol table for each target file contained in the static library from the symbol table in each target file contained in the static library comprises:
aiming at any target file contained in the static library, obtaining symbols contained in the target file and symbol types of the symbols according to a symbol table in the target file;
obtaining a symbol with a symbol type as a target type, taking the symbol as an external symbol of the target file, and generating an external symbol table of the target file based on the external symbol of the target file, wherein the target type comprises an undefined type;
obtaining symbols with other types of symbol types as internal symbols of the target file, and generating an internal symbol table of the target file based on the internal symbols of the target file, wherein the other types are other symbol types except the target type.
4. The method according to claim 2, wherein the step of generating the internal symbol table and the external symbol table of the static library from the internal symbol table and the external symbol table of each target file included in the static library comprises:
creating the internal symbol table of the static library, and integrating and archiving the internal symbol tables of all target files under the static library into the internal symbol table of the static library;
and creating the external symbol table of the static library, and integrating and archiving the external symbol tables of all target files under the static library into the external symbol table of the static library.
5. The method according to claim 1, wherein the step of constructing an internal symbol table and an external symbol table of each file to be detected according to a symbol table in each target file contained in each file to be detected comprises:
acquiring an internal symbol table and an initial external symbol table of each file to be detected according to the symbol table in each target file contained in each file to be detected;
and aiming at any file to be detected, acquiring a target symbol which is simultaneously present in an internal symbol table and an initial external symbol table of the file to be detected, and removing the target symbol from the initial external symbol table to obtain the external symbol table of the file to be detected.
6. The method according to any one of claims 1 to 5, wherein the step of traversing and parsing each file to be detected and obtaining the symbol table in each target file included in the file to be detected comprises:
traversing and analyzing each file to be detected, and acquiring a target file contained in each file to be detected;
and traversing each target file, and acquiring a symbol table of the target file from the target file according to format conditions met by the symbol table.
7. The method according to any one of claims 1 to 5, wherein the step of obtaining the dependency relationship between the files to be detected according to the internal symbol table and the external symbol table of each file to be detected comprises:
for any file to be detected, if at least one symbol exists in the external symbol table of the file to be detected and the internal symbol tables of other files to be detected, confirming that the file to be detected depends on the other files to be detected;
and the other files to be detected are other files to be detected except the current file to be detected.
8. A dependency detection apparatus, comprising:
the symbol table acquisition module is used for traversing and analyzing each file to be detected and acquiring a symbol table in each target file contained in the file to be detected, wherein the file to be detected comprises at least one of a static library and a target file;
an internal and external symbol table construction module, configured to construct an internal symbol table and an external symbol table of each to-be-detected file according to a symbol table in each target file included in each to-be-detected file, where the internal symbol table includes internal symbols in the to-be-detected file, and the external symbol table includes external symbols in the to-be-detected file;
and the dependency relationship detection module is used for acquiring the dependency relationship among the files to be detected according to the internal symbol table and the external symbol table of each file to be detected.
9. The apparatus of claim 8, wherein the inner and outer symbol table construction module comprises:
the first file symbol table constructing sub-module is used for generating an internal symbol table and an external symbol table of each target file contained in the static library according to the symbol table in each target file contained in the static library under the condition that the file to be detected is the static library;
the static library symbol table constructing submodule is used for generating an internal symbol table and an external symbol table of the static library according to the internal symbol table and the external symbol table of each target file contained in the static library;
and the second file symbol table constructing submodule is used for generating an internal symbol table and an external symbol table of the target file according to the symbol table in the target file under the condition that the file to be detected is the target file.
10. The apparatus according to claim 9, wherein the first file symbol table constructing submodule is specifically configured to:
aiming at any target file contained in the static library, obtaining symbols contained in the target file and symbol types of the symbols according to a symbol table in the target file;
obtaining a symbol with a symbol type as a target type, taking the symbol as an external symbol of the target file, and generating an external symbol table of the target file based on the external symbol of the target file, wherein the target type comprises an undefined type;
obtaining symbols with other types of symbol types as internal symbols of the target file, and generating an internal symbol table of the target file based on the internal symbols of the target file, wherein the other types are other symbol types except the target type.
11. The apparatus according to claim 9, wherein the static library symbol table construction submodule is specifically configured to:
creating the internal symbol table of the static library, and integrating and archiving the internal symbol tables of all target files under the static library into the internal symbol table of the static library;
and creating the external symbol table of the static library, and integrating and archiving the external symbol tables of all target files under the static library into the external symbol table of the static library.
12. The apparatus according to claim 8, wherein the internal and external symbol table constructing module is specifically configured to:
acquiring an internal symbol table and an initial external symbol table of each file to be detected according to the symbol table in each target file contained in each file to be detected;
and aiming at any file to be detected, acquiring a target symbol which is simultaneously present in an internal symbol table and an initial external symbol table of the file to be detected, and removing the target symbol from the initial external symbol table to obtain the external symbol table of the file to be detected.
13. The apparatus according to any one of claims 8-12, wherein the symbol table acquisition module comprises:
the target file acquisition submodule is used for traversing and analyzing each file to be detected and acquiring a target file contained in each file to be detected;
and the symbol table acquisition submodule is used for traversing each target file and acquiring the symbol table of the target file from the target file according to the format condition met by the symbol table.
14. The apparatus according to any one of claims 8 to 12, wherein the dependency detection module is specifically configured to:
for any file to be detected, if at least one symbol exists in the external symbol table of the file to be detected and the internal symbol tables of other files to be detected, confirming that the file to be detected depends on the other files to be detected;
and the other files to be detected are other files to be detected except the current file to be detected.
15. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, carries out the steps of the dependency detection method according to any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the dependency detection method according to any one of claims 1 to 7.
CN202011044096.3A 2020-09-28 2020-09-28 Dependency relationship detection method and device, electronic equipment and storage medium Pending CN112230980A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011044096.3A CN112230980A (en) 2020-09-28 2020-09-28 Dependency relationship detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011044096.3A CN112230980A (en) 2020-09-28 2020-09-28 Dependency relationship detection method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112230980A true CN112230980A (en) 2021-01-15

Family

ID=74121189

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011044096.3A Pending CN112230980A (en) 2020-09-28 2020-09-28 Dependency relationship detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112230980A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742002A (en) * 2021-09-10 2021-12-03 上海达梦数据库有限公司 Method, device, equipment and storage medium for acquiring dependency relationship of dynamic library

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106469049A (en) * 2015-08-19 2017-03-01 腾讯科技(深圳)有限公司 A kind of method and device of file scan
US20180203676A1 (en) * 2015-04-09 2018-07-19 Longsand Limited Removing library objects from a static library
CN111666206A (en) * 2020-04-30 2020-09-15 北京百度网讯科技有限公司 Method, device, equipment and storage medium for acquiring influence range of change code

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180203676A1 (en) * 2015-04-09 2018-07-19 Longsand Limited Removing library objects from a static library
CN106469049A (en) * 2015-08-19 2017-03-01 腾讯科技(深圳)有限公司 A kind of method and device of file scan
CN111666206A (en) * 2020-04-30 2020-09-15 北京百度网讯科技有限公司 Method, device, equipment and storage medium for acquiring influence range of change code

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
皮拉夫大王在此: "从探索到时间,58动态库懒加载实录", pages 1 - 5, Retrieved from the Internet <URL:www.jianshu.com/p/3063053a6114> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742002A (en) * 2021-09-10 2021-12-03 上海达梦数据库有限公司 Method, device, equipment and storage medium for acquiring dependency relationship of dynamic library

Similar Documents

Publication Publication Date Title
CN109656827B (en) Control tree generation method and terminal equipment
CN108089977B (en) Application program exception handling method and device and mobile terminal
CN111142930B (en) Installation package file packaging method and device, terminal device and storage medium
CN111381992B (en) Crash log processing method and device, electronic equipment and storage medium
CN109947650B (en) Script step processing method, device and system
CN109857297B (en) Information processing method and terminal equipment
CN112084747A (en) Resource management method and device, electronic equipment and storage medium
CN110069407B (en) Function test method and device for application program
CN112650498B (en) Static library integration method and device, electronic equipment and storage medium
CN110928797B (en) Code coupling detection method and device, terminal equipment and storage medium
CN110879709A (en) Detection method and device of useless codes, terminal equipment and storage medium
CN112230980A (en) Dependency relationship detection method and device, electronic equipment and storage medium
CN112667223A (en) Method and device for generating component configuration table, electronic equipment and storage medium
CN109871324B (en) Control operation method and device
CN109739758B (en) Test case conversion method and device
CN108595104B (en) File processing method and terminal
CN112433721B (en) Application modularization processing method and device, electronic equipment and storage medium
CN111601035B (en) Image processing method and electronic equipment
CN115328770A (en) Application program testing method and device, electronic equipment and storage medium
CN115904367A (en) Front-end scaffold processing method and device, electronic equipment and storage medium
CN109783379B (en) Script execution exception determining method and device
CN112650530A (en) Multi-class library integration method and device, electronic equipment and readable storage medium
CN109325003B (en) Application program classification method and system based on terminal equipment
CN109413276B (en) Information display method and terminal equipment
CN112230979A (en) Dependency relationship detection method and device, electronic equipment and storage medium

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