CN103019663B - The method and system of intermodule function interface in a kind of acquisition program - Google Patents

The method and system of intermodule function interface in a kind of acquisition program Download PDF

Info

Publication number
CN103019663B
CN103019663B CN201110287958.XA CN201110287958A CN103019663B CN 103019663 B CN103019663 B CN 103019663B CN 201110287958 A CN201110287958 A CN 201110287958A CN 103019663 B CN103019663 B CN 103019663B
Authority
CN
China
Prior art keywords
function
ifdc
executable program
call
files
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201110287958.XA
Other languages
Chinese (zh)
Other versions
CN103019663A (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.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN201110287958.XA priority Critical patent/CN103019663B/en
Publication of CN103019663A publication Critical patent/CN103019663A/en
Application granted granted Critical
Publication of CN103019663B publication Critical patent/CN103019663B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses in a kind of acquisition program intermodule function interface method and system, wherein, in acquisition program the method for intermodule function interface be used for realize obtaining intermodule function interface automatically, comprise the steps:By executable program described in static scanning, intrinsic function static call IFSC relational files, External Function Call EFC relational files, and intrinsic function dynamic call IFDC shipping bills files is generated;When the executable program is run, based on the IFDC shipping bills file, IFDC log files are generated;Based on the EFC relational files, the IFSC relational files and IFDC log files, the function calling relationship table of intermodule in the executable program is obtained.

Description

The method and system of intermodule function interface in a kind of acquisition program
Technical field
The present invention relates to intermodule function interface in the module interface technology of large software, more particularly to a kind of acquisition program Method and system.
Background technology
With the continuous development of computer technology and communication technology, user to the performance requirement of software system also increasingly Height, software system also become increasing, and then in the prior art, generate a lot of large software systems.
In large software system, the interaction between some logic modules in program, is contained, and these logic moulds Interface between block, can directly affect the module coupled relation in the program architecture of module, the combination property shadow to software system Sound is very big.
Interface between logic module is in addition to considering when system architecture is designed, in addition it is also necessary to set in follow-up in detail Meter, coding follow strictly interface specification book in realizing.Accordingly, it would be desirable to a kind of effective means, can check the software that has realized In system, the actual interface situation of module to be contrasted with Interface design, iting is found that interface difference can be repaiied in time Change.
Meanwhile, in old software system architecture transformation, in addition it is also necessary to which the module interface relation in existing program is carried out Extract, then carry out module decoupling on this basis, design new module interface.And this is also required to acquisition module interface.
Interface between program module, including function interface and data-interface.For function interface, the function in program is adjusted There are two classes with relation, be that intrinsic function calls IFC (Internal Function Calling), External Function Call EFC respectively (External Function Calling).The wherein function call of IFC point and called function all in program limit, And the called function of EFC usually calls the function in dynamic link library beyond program limit.
IFC is further divided into intrinsic function static call IFSC (Internal according to the difference for calling form Function Static Calling) and intrinsic function dynamic call IFDC (Internal Function Dynamic Calling).Static call refers to the object function for calling in compiling it has been determined that dynamic call refers to that the object function for calling exists Compiling fashion is not clear and definite, when program runs to point of invocation, just determines the object function for calling.
In the prior art, the method for acquisition module function interface is:When compiling link program, using compiler The functional dependencies of each file destination are generated, then Macro or mass analysis form the function interface relation between module.
In the embodiment of the present application is realized during technical scheme, present inventor has found at least to deposit in prior art In following technical problem:
The dependence of source code is extracted when compiling is depended on, it is impossible to suitable for the interface point of the incomplete program of source code Analysis;
In program, the dynamic call such as call back function relation can only be safeguarded by human configuration, it is impossible to automatically extracted;
Due to the disadvantages mentioned above of traditional acquisition methods of task schedule information, cause the analysis to modularity function interface always There are problems that dynamic call relationship safeguard difficulty is big, be suitable for scene.
Content of the invention
The present invention provides a kind of method and system of intermodule function interface in acquisition program, for realizing automatically to module Between the purpose that obtained of function interface.
On the one hand, the present invention is by the one embodiment in the application, there is provided following technical scheme:
A kind of method of intermodule function interface in acquisition program, connects for obtaining intermodule function in executable program Mouthful, methods described includes:
By executable program described in static scanning, intrinsic function static call IFSC relational files, external function is generated Call EFC relational files, and intrinsic function dynamic call IFDC shipping bills files;
When the executable program is run, based on the IFDC shipping bills file, IFDC log files are generated;
Based on the EFC relational files, the IFSC relational files and IFDC log files, the executable program is obtained The function calling relationship table of middle intermodule.
Alternatively, obtained based on the EFC relational files, the IFSC relational files and IFDC log files described Actual letter in the executable program after the function calling relationship table of intermodule, based on intermodule in the executable program Number interface relationship and canonical function interface relationship, obtain the function interface modification information of intermodule in the executable program.
Alternatively, the function interface modification information for obtaining intermodule in the executable program, specifically includes:
Based on the actual function call relation table and inside modules function list, module in the executable program is obtained Between actual function interface relationship;
Based on the standard module function interface configuration file of the executable program, module in the executable program is obtained Between canonical function interface relationship;
In the comparison executable program, the actual function interface relationship and canonical function interface relationship of intermodule, obtains institute State the function interface modification information file of intermodule in executable program.
Alternatively, described by executable program described in static scanning, generate intrinsic function static call IFSC relations text Part, External Function Call EFC relational files, and intrinsic function dynamic call IFDC shipping bills files, specifically include:
Extract the attribute information for characterizing each Function feature of each function in the executable program;
The reorientation section of the executable program is analyzed, the External Function Call EFC relational files are generated;
The function code section of each function of the executable program is scanned, the function call instruction of each function is obtained;
When the function call mode that specifies in the function call instruction is register form, the IFDC outlets are generated Inventory file;
When the function call mode that specifies in the function call instruction is operand form, the IFSC relations are generated File.
Alternatively, the attribute information of each function at least includes:Function name, type function, function start address Code segment size with function.
Alternatively, described when the executable program is run, based on the IFDC inventory files, generate IFDC record texts Part, specifically includes:
When the executable program runs, the extraction dynamic call relation mould in the executable program initialization segments is executed The setup code of block, to obtain the IFDC shipping bills file;
The extraction code of the dynamic call relationship module in each function head is executed, to obtain higher level's letter of each function Number calls exit address;
When in the IFDC shipping bills file exist described in call exit address when and the IFDC shipping bills file Corresponding object function list includes described when calling exit address respective function, then record and described call exit address correspondingly The IFDC information of function;
When in the IFDC shipping bills file exist described in call exit address when and the IFDC shipping bills file When exit address respective function is called described in not including in corresponding object function list, then calling exit address pair for described After answering function to set up new IFDC relations, the IFDC information of exit address respective function is called described in record;
The IFDC information of each function when the executable program end of run, is extracted, is generated under program directory The IFDC log files.
Alternatively, the extraction code for executing the dynamic call relationship module in each function head, to obtain each The step of higher level's function call exit address of function, specifically include:
From depositor, the address of next instruction of the higher level function call outlet of each function will be obtained;
The address of the next instruction is revised, higher level's function call exit address is obtained.
Alternatively, described based on the EFC relational files, the IFSC relational files and IFDC log files, obtain institute The function calling relationship table of intermodule in executable program is stated, is specifically included:
Using analytical tool, the EFC relational files, the IFSC relational files and IFDC log files are solved Analysis, obtains the function calling relationship table of intermodule in the executable program.
Alternatively, in the function calling relationship table, every function calling relationship at least includes:Father's function name, call out Port address, object function title, method of calling, father's function pair answer source file.
Additionally, the present invention also by the application in another embodiment following technical scheme is provided:
The system of intermodule function interface in a kind of acquisition program, connects for obtaining intermodule function in executable program Mouthful, the system includes:
Static scanning unit, for by executable program described in static scanning, generating intrinsic function static call IFSC Relational file, External Function Call EFC relational files, and intrinsic function dynamic call IFDC shipping bills files;
IFDC log file obtaining units, for when the executable program is run, based on the IFDC shipping bills File, generates IFDC log files;
Function calling relationship obtaining unit, for based on the EFC relational files, the IFSC relational files and IFDC note Record file, obtains the function calling relationship table of intermodule in the executable program.
Alternatively, the system also includes:Function interface modification information obtaining unit, for being based on the executable program The actual function interface relationship and canonical function interface relationship of middle intermodule, obtains the function of intermodule in the executable program Interface modification information.
Alternatively, the function interface modification information obtaining unit is specifically included:
First obtains unit, for based on the function calling relationship table, obtaining intermodule in the executable program Actual function interface relationship;
Second obtaining unit, for the standard module function interface configuration file based on the executable program, obtains institute State the canonical function interface relationship of intermodule in executable program;
Comparing unit, the actual function interface relationship and canonical function for intermodule in the comparison executable program connect Mouth relation, obtains the function interface modification information file of intermodule in the executable program.
Alternatively, the static scanning unit, specifically includes:
Extraction unit, for extracting the attribute for characterizing each Function feature of each function in the executable program Information;
Analytic unit, for analyzing the reorientation section of the executable program, generates the External Function Call EFC relations File;
Scanning element, for scanning the function code section of each function of the executable program, obtains each function Function call instruction;
First signal generating unit, the function call mode for specifying in the function call instruction are register form When, generate the IFDC shipping bills file;
Second signal generating unit, the function call mode for specifying in the function call instruction are operand form When, generate the IFSC relational files.
Alternatively, the attribute information of each function at least includes:Function name, type function, function start address Code segment size with function.
Alternatively, the IFDC log files obtaining unit, specifically includes:
First performance element, when running for the executable program, executes in the executable program initialization segments The setup code of dynamic call relationship module is extracted, to obtain the IFDC shipping bills file;
Second performance element, for executing the extraction code of the dynamic call relationship module in each function head, to obtain Obtain higher level's function call exit address of each function;
Recording unit, for when in the IFDC shipping bills file exist described in call exit address when and the IFDC The corresponding object function list of shipping bills file includes described when calling exit address respective function, then call described in record The IFDC information of exit address respective function;When in the IFDC shipping bills file exist described in call exit address when and institute State do not include in the corresponding object function list of IFDC shipping bills files described when calling exit address respective function, then for Described call exit address respective function to set up new IFDC relations after, record described in call exit address respective function IFDC information;
Extraction unit, for when the executable program end of run, the IFDC information for extracting each function writes text Part, generates the IFDC log files under program directory.
Alternatively, second performance element, specifically includes:
Acquiring unit, for from depositor, obtaining next instruction of higher level's function call outlet of each function Address;
Amending unit, for revising the address of the next instruction, obtains higher level's function call exit address.
Alternatively, the function calling relationship obtaining unit is specially:Resolution unit, for the EFC relational files, The IFSC relational files and IFDC log files are parsed, and the function call for obtaining intermodule in the executable program is closed It is table.
Alternatively, in the function calling relationship table, every function calling relationship at least includes:Father's function name, call out Port address, object function title, method of calling, father's function pair answer source file.
One or more technical schemes in above-mentioned technical proposal, have the following technical effect that or advantage:
First, pass through during intermodule function interface, to employ insertion Hook Function, static scanning in acquisition program Executable program technological means so that carry out during intrinsic function is called each time, realizing dynamic call relation in program The technique effect that easily safeguards;
2nd, pass through during intermodule function interface, to employ intermodule in executable program in acquisition program The means that contrasted of actual function interface relationship and canonical function interface relationship so that module in executable program is obtained Between function interface modification information file during, realize that dynamic call relation is suitable for scene unrestricted technique effect.
Description of the drawings
Fig. 1 is the method flow diagram of intermodule function interface in acquisition program in the embodiment of the present application;
Fig. 2 is the method flow diagram for obtaining and extracting IFDC log files in the embodiment of the present application;
Fig. 3 is the method flow diagram for extracting function calling relationship in the embodiment of the present application;
Fig. 4 is the method flow diagram for obtaining function interface modification information in the embodiment of the present application;
Fig. 5 is the system module figure of intermodule function interface in acquisition program in the embodiment of the present application;
Fig. 6 is the module map of static scanning unit in the embodiment of the present application;
Fig. 7 is the module map of IFDC log file obtaining units in the embodiment of the present application;
Fig. 8 is the module map of function interface modification information obtaining unit in the embodiment of the present application.
Specific embodiment
In order that the application the technical staff in the technical field is more clearly understood that the present invention, below in conjunction with the accompanying drawings, Technical solution of the present invention is described in detail by specific embodiment.
Fig. 1, Fig. 2, Fig. 3 and Fig. 4 is refer to, the side of intermodule function interface in the acquisition program in the embodiment of the present application one Method, comprises the steps:
Step 101, by one executable program of static scanning, generates intrinsic function static call IFSC relational files, outer Portion's function call EFC relational file, and intrinsic function dynamic call IFDC shipping bills files.
In specific implementation process, the executable program is generated as follows:Source code is compiled first, is inserted into The Hook Function of function call, the code that Hook Function can be previously implanted in a program by the step so as to can be in program The extraction of IFDC information is completed during operation.
Wherein, to implement process as follows for the Hook Function of insertion function call:
One, in the setup code that the init sections insertion dynamic call relation of program is extracted;
Each executable file in described program, all includes a corresponding init section, and the init sections are described Program is disposably run when loading.
Two, dynamic call relation is inserted at all of function entrance extract code.
According to the switch arranged in makefile during compiling, in specified file, the porch of all functions is added and is extracted The code snippet that the kinematic function is called.Higher level's function call that current function can be extracted by running the code snippet goes out Mouthful;And judge that higher level's function call is exported whether in IFDC shipping bills;And in the presence of dynamic call outlet, Generate dynamic call record.
For step 101, in specific implementation process, specifically include:
One, the attribute information for characterizing each Function feature of each function in the executable program is extracted, such as:Letter Several titles, type, address, size etc..In the Symbol sign fields of described program file, all functions and variable symbol is contained Number information.One symbol is defined as follows:
Wherein, low 4 of st_info fields are st_type information, and the st_type values of all functional symbols are STT_ FUNC.Extract all functional symbols for meeting this feature then formation function inventory.
Then, according to the st_name being present in program in SHT_STRTAB sections, the title of the symbol is extracted.According to st_ Value simultaneously combines the load address that st_shndx corresponds to section, calculates the start address of symbol.Accorded with from st_size fields Number size, i.e. the start address of the length of function, and associative function obtains the end address of function.The beginning of the function Between address and end address, then it is the code interval of function.
Two, the reorientation section of the executable program is analyzed, the External Function Call EFC relational files are generated;
Wherein, the process for generating the External Function Call EFC relational files is specially:The executable program file exists After compiling link, the symbolic reference in external dynamic storehouse can be directed to, corresponding relocation information is preserved in SHT_RELA sections.Described SHT_RELA sections are address field or code segment in the executable program file, and the form of the relocation information is:
According to the r_offset, can calculate needs the address of reorientation in code segment, i.e. call the outside to move The address of the instruction of state built-in function.The external symbol for calling is obtained according to the r_info, further inquires about st_ in symbol table Symbols of the type for STT_UNDEF, can obtain the function name in external dynamic storehouse for calling, so as to form the executable program EFC information.After completing the scanning to the executable program, can generate described under the executable program file catalogue EFC relational files.
Three, the function code section of each function of the executable program is scanned, the function call for obtaining each function refers to Order, specifically includes:
According to functional symbol inventory, the code interval of each function in described program, the code of each function is obtained It is the machine code of each instruction of each function in interval, i.e. order code, the order code are generally accorded with by command operating With groups of operands into.
For different CPU systems, instruction format be different, such as:Instruction format and AMD in the CPU systems of intel CPU systems in instruction format be different;But for the same type of CPU systems, base instruction form is solid Fixed, such as:Base instruction form in the CPU of the Pentium class of intel is fixed.
Determine the system of the CPU, and the instruction format according to corresponding CPU in the CPU systems, read in one by one described every The order code of individual function, then extracts the operation code in the order code, and judges whether the instruction of the CPU is function Call instruction.Wherein, the result of judgement includes two kinds of situations:
The first, the instruction of the CPU is not the function call instruction, then do not carry out what next step analytic function was called Process;
Second, the instruction of the CPU is the function call instruction, then determine whether which kind of function call belonged to.
When determining whether to belong to which kind of function call, the operation code of the instruction by recognizing the CPU judges described The method of calling of the call function that specifies in function call instruction, the method for calling of the call function specifically include two kinds:
The first, is called with register form;
Second, called with operand form.
When the function call mode that specifies in the function call instruction is register form, the function cannot pass through Static analyzer Code obtaining object function information, needs to be extracted in follow-up program operation process.Accordingly, it would be desirable to The call instruction outlet record of the undetermined object function, compiling when running for the executable program are embedded function Use.After completing the scanning to the executable program, under the executable program file catalogue can generate the IFDC and go out Mouth inventory file.
When the function call mode that specifies in the function call instruction is operand form, refer to from the function call Make in code, extract corresponding operand, according to addressing system, be converted into corresponding object function absolute address.Then described In functional symbol inventory, the object function title that calls is searched.
Outlet, object function is called to form an IFSC relation and recorded by described.Complete to the executable journey After the scanning of sequence, the complete IFSC relational files can be generated under the executable program file catalogue.
Step 102, when the executable program is run, based on the IFDC shipping bills file, generates IFDC records File.
In specific implementation process, when the executable program runs, first, the initialization work(embedded in init sections is executed Can, the setup code of dynamic call relationship module is extracted, to obtain the IFDC shipping bills file, then, loading is described IFDC shipping bills files, contain in the IFDC shipping bills file extraction in need function dynamic call relation, Such as:Intrinsic function static call IFSC relational files, intrinsic function dynamic call IFDC relational files, External Function Call EFC Relational file etc., executes the extraction code of the dynamic call relationship module in each function head, obtains each function Higher level's function call exit address;
Wherein, higher level's function call exit address acquisition pattern of each function is specially:The dynamic call is closed Be the extraction code of module from ra depositors, obtain current function higher level's function call outlet next instruction ground Location, obtains higher level's function call exit address CP (the Calling Point) after correction.
Further, in the IFDC inventories, search the CP and whether there is.Wherein, the result of lookup includes two kinds of feelings Condition:
The first, the CP is not present in the IFDC inventories, then it represents that the current function is called and need not be recorded, Continue other instructions of the follow-up function of analysis;
Second, the CP is present in the IFDC inventories, then it represents that it is to need record that the current function is called Dynamic call.
Now, in the corresponding function outlet entry of the IFDC inventories, object function list is searched.Wherein, lookup As a result two kinds of situations are also included:
The first, current function then calls exit address respective function described in record in the object function list IFDC information;
Second, current function then sets up a new IFDC relation not in the object function list, and record is described The IFDC information of exit address respective function is called, and the IFDC information written document is added to the object function list In.
The IFDC information of each function when program end of run, is extracted, is generated under the executable program catalogue The IFDC log files.
Step 103, based on the EFC relational files, the IFSC relational files and IFDC log files, acquisition is described can The function calling relationship table of intermodule in configuration processor.
In specific implementation process, after program operation is finished and generates IFDC log files, in conjunction with static scanning journey The IFSC files that preface part is obtained and EFC files, parse complete function calling relationship table FC (Function Calling).
Wherein, each FC packet contains multiple attribute informations, such as:Father's function name, call exit address, object function Title, method of calling, father's function pair answer source file etc., the function interface relation between module for further analysis.
In concrete analysis, based on the function calling relationship table, the reality of intermodule in the executable program is obtained Function interface relation;Wherein, detailed process is:Described parse complete function calling relationship table after, loading procedure internal mode Block allocation list IMC (Intemal Module Configuration) file, by between all functions in the executable program Call relation be converted into function calling relationship MFC (Module Function Calling) of all modules, described all On the basis of function calling relationship MFC of module, the mould for calling outlet and object function to belong to same module is filtered out Block intrinsic call relation, obtains the actual function interface relationship MFI (Module Function Interface) between module.
Based on the standard module function interface configuration file of the executable program, module in the executable program is obtained Between canonical function interface relationship;Wherein, detailed process is:Derive in slave module Interface design scheme, or obtain in scanning Carry out revising the standard module function interface configuration file for obtaining the executable program on the basis of modularity function interface message SMFIC (Standard Module Function Interface Configuration), the standard of the executable program The configuration of modularity function interface is specially a standard module function interface information, have recorded the mark between each module in software design Quasi-function interface relationship.
In the comparison executable program, the actual function interface relationship and canonical function interface relationship of intermodule, obtains institute State the function interface modification information of intermodule in executable program;Wherein, detailed process is:Analyze the executable program middle mold Actual function interface relationship between block and canonical function interface relationship, after the completion of the analysis, compare difference between the two, Described difference is function interface modification information MFICI (the Module Function of intermodule in the executable program Interface Change Information).
Fig. 5, Fig. 6, Fig. 7 and Fig. 8 is refer to, intermodule function interface is in the acquisition program in the embodiment of the present application two System, including:
Static scanning unit 201, for by executable program described in static scanning, generating intrinsic function static call IFSC relational files, External Function Call EFC relational files, and intrinsic function dynamic call IFDC shipping bills files;
Specifically, the static scanning unit 201, including:
Extraction unit 2011, for extract each function in the executable program for characterizing each Function feature Attribute information, such as:Function name, type, address, size etc..
Analytic unit 2012, for analyzing the reorientation section of the executable program, generates the External Function Call EFC Relational file, such as:The r_offset in the reorientation section is analyzed, calculating needs the address of reorientation in code segment, that is, adjust Address with the instruction of external dynamic built-in function.
Scanning element 2013, for scanning the function code section of each function of the executable program, obtains each letter Several function call instructions, such as:The Symbol sign fields of the executable program are scanned, st_size in the sign field is obtained The address of field.
First signal generating unit 2014, the function call mode for specifying in the function call instruction are depositor shape During formula, the IFDC shipping bills file is generated;
Second signal generating unit 2015, the function call mode for specifying in the function call instruction are operation number form During formula, the IFSC relational files are generated.
IFDC log files obtaining unit 202, for when the executable program is run, clear based on IFDC outlets Monofile, generates IFDC log files;
Specifically, the IFDC log files obtaining unit 202, including:
First performance element 2021, when running for the executable program, executes the executable program initialization segments The setup code of interior extraction dynamic call relationship module, is disposably run when the executableization program is loaded, To obtain the IFDC shipping bills file.
Second performance element 2022, for executing the extraction code of the dynamic call relationship module in each function head, To obtain higher level's function call exit address of each function, such as:According to the switch arranged in makefile during compiling, referring to Add the code snippet for extracting that kinematic function is called in the porch for determining all functions in file.
Recording unit 2023, for when exit address is called described in presence in the IFDC shipping bills file and described The corresponding object function list of IFDC shipping bills files includes described when calling exit address respective function, then record described Call the IFDC information of exit address respective function;When exit address is called described in presence in the IFDC shipping bills file And do not include in the corresponding object function list of the IFDC shipping bills file described when calling exit address respective function, then For described call exit address respective function to set up new IFDC relations after, record described in call exit address respective function IFDC information;
Extraction unit 2024, for when the executable program end of run, extracting the IFDC information of each function, The IFDC log files are generated under program directory.
Function calling relationship obtaining unit 203, for based on the EFC relational files, the IFSC relational files and IFDC log files, obtain the function calling relationship table of intermodule in the executable program.
Specifically, after program operation is finished and generates the IFDC log files, in conjunction with static scanning program text The IFSC files that part is obtained and EFC files, parse complete function calling relationship table FC (Function Calling).
Wherein, each FC packet contains multiple attribute informations, such as:Father's function name, call exit address, object function Title, method of calling, father's function pair answer source file etc., the function interface relation between module for further analysis.
Additionally, the system also includes:Function interface modification information obtaining unit, for based in the executable program The actual function interface relationship and canonical function interface relationship of intermodule, the function for obtaining intermodule in the executable program connect Mouth modification information.
The function interface modification information obtaining unit, specifically includes:
First obtains unit 2041, for based on the function calling relationship table, obtaining module in the executable program Between actual function interface relationship;
Specifically, in analysis, based on the function calling relationship table, intermodule in the executable program is obtained Actual function interface relationship;
Wherein, detailed process is:Described parse complete function calling relationship table after, loading procedure internal module configure List file, the function calling relationship that the call relation between all functions in the executable program is converted into all modules, On the basis of the function calling relationship of all modules, filter out and described call outlet to belong to same mould with object function The inside modules call relation of block, obtains the actual function interface relationship between module.
Second obtaining unit 2042, for the standard module function interface configuration file based on the executable program, obtains Obtain the canonical function interface relationship of intermodule in the executable program;
Specifically, in analysis, based on the standard module function interface configuration file of the executable program, institute is obtained State the canonical function interface relationship of intermodule in executable program;Wherein, detailed process is:Lead in slave module Interface design scheme Go out, or on the basis of the modularity function interface message that scanning is obtained carry out revising the standard module letter for obtaining the executable program Number interface configuration file, the standard module function interface configuration of the executable program are specially a standard module function interface Information, have recorded the canonical function interface relationship between each module in software design.
Comparing unit 2043, for the actual function interface relationship and standard letter of intermodule in the comparison executable program Number interface relationship, generates the function interface modification information file of intermodule in the executable program.
Specifically, in analysis, the actual function interface relationship of intermodule and standard in the comparison executable program Function interface relation, generates the function interface modification information file of intermodule in the executable program;Wherein, detailed process For:The actual function interface relationship and canonical function interface relationship of intermodule in the executable program is analyzed, the analysis is complete Cheng Hou, compares difference between the two, and described difference is the function interface change of intermodule in the executable program Information.
One or more technical schemes in the embodiment of the present application, at least have the following technical effect that:
First, pass through during intermodule function interface, to employ insertion Hook Function, static scanning in acquisition program The technological means of executable program so that carry out during intrinsic function is called each time in program, realize that dynamic call is closed The technique effect that system easily safeguards;
2nd, pass through during intermodule function interface, to employ intermodule in executable program in acquisition program The means that contrasted of actual function interface relationship and canonical function interface relationship so that module in executable program is obtained Between function interface modification information file during, realize that dynamic call relation is suitable for scene unrestricted technique effect;
3rd, pass through during intermodule function interface, to employ the order code for extracting function, to post in acquisition program The technological means of storage form call function so that during intrinsic function dynamic call shipping bills is obtained, realize accurate Really, efficient technique effect;
4th, pass through during intermodule function interface, to employ the order code for extracting function in acquisition program, to grasp The technological means of form of counting call function so that during intrinsic function static call relation is obtained, it is accurate, high to realize The technique effect of effect.
Obviously, those skilled in the art can carry out the essence of various changes and modification without deviating from the present invention to the present invention God and scope.So, if these modifications of the present invention and modification belong to the scope of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to comprising these changes and modification.

Claims (7)

1. in a kind of acquisition program intermodule function interface method, for obtaining intermodule function interface in executable program, Characterized in that, methods described includes:
By executable program described in static scanning, intrinsic function static call IFSC relational files, External Function Call is generated EFC relational files, and intrinsic function dynamic call IFDC shipping bills files;
When the executable program is run, based on the IFDC shipping bills file, IFDC log files are generated;
Based on the EFC relational files, the IFSC relational files and IFDC log files, the executable program middle mold is obtained Function calling relationship table between block;
Wherein, described based on the EFC relational files, the IFSC relational files and IFDC log files, acquisition is described can In configuration processor after the function calling relationship table of intermodule, also include:Based on actual function call relation table and inside modules Function list, obtains the actual function interface relationship of intermodule in the executable program;Mark based on the executable program Quasi-mode block function interface configuration file, obtains the canonical function interface relationship of intermodule in the executable program;Relatively more described The actual function interface relationship and canonical function interface relationship of intermodule in executable program, obtains the executable program middle mold Function interface modification information file between block.
2. the method for claim 1, it is characterised in that described by executable program described in static scanning, generate in Portion's function static call IFSC relational files, External Function Call EFC relational files, and intrinsic function dynamic call IFDC outlets Inventory file, specifically includes:
Extract the attribute information for characterizing each Function feature of each function in the executable program;
The reorientation section of the executable program is analyzed, the External Function Call EFC relational files are generated;
The function code section of each function of the executable program is scanned, the function call instruction of each function is obtained;
When the function call mode that specifies in the function call instruction is register form, the IFDC shipping bills is generated File;
When the function call mode that specifies in the function call instruction is operand form, the IFSC relations text is generated Part.
3. the method for claim 1, it is characterised in that described when the executable program is run, based on described IFDC shipping bills files, generate IFDC log files, specifically include:
When the executable program runs, extraction dynamic call relationship module in the executable program initialization segments is executed Setup code, to obtain the IFDC shipping bills file;
The extraction code of the dynamic call relationship module in each function head is executed, is adjusted with obtaining higher level's function of each function Use exit address;
When exist in the IFDC shipping bills file described call exit address when and the IFDC shipping bills file correspondingly Object function list include described when calling exit address respective function, then call exit address respective function described in record IFDC information;
When exist in the IFDC shipping bills file described call exit address when and the IFDC shipping bills file correspondingly Object function list in do not include described when calling exit address respective function, then calling exit address correspondingly letter for described After number sets up new IFDC relations, the IFDC information of exit address respective function is called described in record;
The IFDC information of each function when the executable program end of run, is extracted, is generated under program directory described IFDC log files.
4. in a kind of acquisition program intermodule function interface system, for obtaining intermodule function interface in executable program, Characterized in that, the system includes:
Static scanning unit, for by executable program described in static scanning, generating intrinsic function static call IFSC relations File, External Function Call EFC relational files, and intrinsic function dynamic call IFDC shipping bills files;
IFDC log file obtaining units, for when the executable program is run, based on the IFDC shipping bills file, Generate IFDC log files;
Function calling relationship obtaining unit, for based on the EFC relational files, the IFSC relational files and IFDC record text Part, obtains the function calling relationship table of intermodule in the executable program;
Wherein, function interface modification information obtaining unit, for being connect based on the actual function of intermodule in the executable program Mouth relation and canonical function interface relationship, obtain the function interface modification information of intermodule in the executable program;
Wherein, the function interface modification information obtaining unit is specifically included:First obtains unit, for being adjusted based on the function With relation table, the actual function interface relationship of intermodule in the executable program is obtained;Second obtaining unit, for being based on institute The standard module function interface configuration file of executable program is stated, the canonical function for obtaining intermodule in the executable program connects Mouth relation;Comparing unit, the actual function interface relationship and canonical function for intermodule in the comparison executable program connect Mouth relation, obtains the function interface modification information file of intermodule in the executable program.
5. system as claimed in claim 4, it is characterised in that the static scanning unit, specifically includes:
Extraction unit, believes for extracting the attribute for characterizing each Function feature of each function in the executable program Breath;
Analytic unit, for analyzing the reorientation section of the executable program, generates the External Function Call EFC relations text Part;
Scanning element, for scanning the function code section of each function of the executable program, obtains the function of each function Call instruction;
First signal generating unit, when the function call mode for specifying in the function call instruction is register form, raw Into the IFDC shipping bills file;
Second signal generating unit, when the function call mode for specifying in the function call instruction is operand form, raw Into the IFSC relational files.
6. system as claimed in claim 4, it is characterised in that the IFDC log files obtaining unit, specifically includes:
First performance element, when running for the executable program, executes the extraction in the executable program initialization segments The setup code of dynamic call relationship module, to obtain the IFDC shipping bills file;
Second performance element, for executing the extraction code of the dynamic call relationship module in each function head, every to obtain Higher level's function call exit address of individual function;
Recording unit, for when exist in the IFDC shipping bills file described call exit address when and the IFDC export The corresponding object function list of inventory file includes described when calling exit address respective function, then call outlet described in record The IFDC information of address respective function;When exit address is called described in presence in the IFDC shipping bills file and described Do not include in the corresponding object function list of IFDC shipping bills files described when calling exit address respective function, then for institute State after calling exit address respective function to set up new IFDC relations, described in record, call the IFDC of exit address respective function Information;
Extraction unit, for when the executable program end of run, extracting the IFDC information of each function, in program mesh Record is lower to generate the IFDC log files.
7. system as claimed in claim 4, it is characterised in that the function calling relationship obtaining unit is specially:Parsing is single Unit, for parsing to the EFC relational files, the IFSC relational files and IFDC log files, can hold described in acquisition The function calling relationship table of intermodule in line program.
CN201110287958.XA 2011-09-26 2011-09-26 The method and system of intermodule function interface in a kind of acquisition program Active CN103019663B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110287958.XA CN103019663B (en) 2011-09-26 2011-09-26 The method and system of intermodule function interface in a kind of acquisition program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110287958.XA CN103019663B (en) 2011-09-26 2011-09-26 The method and system of intermodule function interface in a kind of acquisition program

Publications (2)

Publication Number Publication Date
CN103019663A CN103019663A (en) 2013-04-03
CN103019663B true CN103019663B (en) 2017-03-15

Family

ID=47968305

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110287958.XA Active CN103019663B (en) 2011-09-26 2011-09-26 The method and system of intermodule function interface in a kind of acquisition program

Country Status (1)

Country Link
CN (1) CN103019663B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199984B (en) * 2014-09-26 2018-01-12 浙江中控技术股份有限公司 The method and apparatus that a kind of dynamic for realizing function library is quoted
CN106874184B (en) * 2016-12-21 2020-07-14 阿里巴巴集团控股有限公司 Java code detection method and device
CN109460250B (en) * 2018-09-25 2022-03-08 平安科技(深圳)有限公司 Application program generation method and device
CN116909627B (en) * 2023-09-13 2023-12-12 杭州笨马网络技术有限公司 Executable program analysis method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216760A (en) * 2007-12-28 2008-07-09 北京方正国际软件系统有限公司 Dynamic mapping interface calling system and method
CN101286119A (en) * 2008-05-27 2008-10-15 华耀环宇科技(北京)有限公司 Method for determining function point changing through code analysis
CN102109975A (en) * 2009-12-24 2011-06-29 华为技术有限公司 Method, device and system for determining function call relationship

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216760A (en) * 2007-12-28 2008-07-09 北京方正国际软件系统有限公司 Dynamic mapping interface calling system and method
CN101286119A (en) * 2008-05-27 2008-10-15 华耀环宇科技(北京)有限公司 Method for determining function point changing through code analysis
CN102109975A (en) * 2009-12-24 2011-06-29 华为技术有限公司 Method, device and system for determining function call relationship

Also Published As

Publication number Publication date
CN103019663A (en) 2013-04-03

Similar Documents

Publication Publication Date Title
CN102521123B (en) A kind of embedded software test pile pitching method of logic-based execution block
CN109815952A (en) Brand name recognition methods, computer installation and computer readable storage medium
CN107908631A (en) Data processing method, device, storage medium and computer equipment
CN103019663B (en) The method and system of intermodule function interface in a kind of acquisition program
CN110134400A (en) Data capture method, device, electronic equipment and computer readable storage medium
CN104899016B (en) Allocating stack Relation acquisition method and device
CN104572644B (en) Database update device and database update method
CN103297267B (en) A kind of methods of risk assessment of network behavior and system
CN104778033B (en) The construction method and device of a kind of building software
CN103631705B (en) A kind of regression testing method and device for search engine
CN103020176A (en) Data block dividing method in XML parsing and XML parsing method
CN101964062B (en) Image searching method based on user interface
CN106022568A (en) Workflow processing method and apparatus
CN102147726B (en) Script-based method for implementing service configuration
CN102647414A (en) Protocol analysis method, protocol analysis device and protocol analysis system
CN105528295A (en) Method and device for detecting abnormal behaviors of mobile application program
CN110442752A (en) Organizational structure drawing generating method, device, computer equipment and storage medium
CN107797823A (en) Business Rule Management method, apparatus, storage medium and computer equipment
CN106095413B (en) A kind of configuration method and device of bluetooth driver
CN106991196A (en) A kind of general data traceability method and system
CN103778128B (en) The method for drafting and device of a kind of list information
CN104866764B (en) A kind of Android phone malware detection method based on object reference figure
CN108491326A (en) Behavioral test recombination method, device and storage medium
CN103377116A (en) Method and device for recording and analyzing log in distributed information system
CN101770367B (en) Compressing method and compressing device of .NET file

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant