CN103377040B - Based on functional program comparative approach - Google Patents

Based on functional program comparative approach Download PDF

Info

Publication number
CN103377040B
CN103377040B CN201210110929.0A CN201210110929A CN103377040B CN 103377040 B CN103377040 B CN 103377040B CN 201210110929 A CN201210110929 A CN 201210110929A CN 103377040 B CN103377040 B CN 103377040B
Authority
CN
China
Prior art keywords
usability
program fragments
program
subprogram
fragments
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.)
Expired - Fee Related
Application number
CN201210110929.0A
Other languages
Chinese (zh)
Other versions
CN103377040A (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.)
MStar Software R&D Shenzhen Ltd
MStar Semiconductor Inc Taiwan
Original Assignee
MStar Software R&D Shenzhen Ltd
MStar Semiconductor Inc Taiwan
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 MStar Software R&D Shenzhen Ltd, MStar Semiconductor Inc Taiwan filed Critical MStar Software R&D Shenzhen Ltd
Priority to CN201210110929.0A priority Critical patent/CN103377040B/en
Publication of CN103377040A publication Critical patent/CN103377040A/en
Application granted granted Critical
Publication of CN103377040B publication Critical patent/CN103377040B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention relates to a kind of based on functional program comparative approach, including: setting multiple instruction set, each instruction set is associated with the instruction set handling process of a correspondence;Obtained one first usability of program fragments and one second usability of program fragments respectively by one first subprogram and one second subprogram, and respectively the first usability of program fragments and the second usability of program fragments are ranged those instruction sets one of them;Carry out a usability of program fragments and compare flow process, the instruction set classified according to the classified instruction set of the first usability of program fragments and the second usability of program fragments selects and carries out one of which instruction set handling process, to compare whether the first usability of program fragments has same functionality with the second usability of program fragments, and judge that the first subprogram is the most suitable with the second subprogram according to this.

Description

Based on functional program comparative approach
Technical field
The present invention is related to a kind of based on functional program comparative approach, and can carry out the program comparative approach of identification for function equivalent but the different program of binary (binary) content in particular to one.
Background technology
The intelligent electronic device of modernization, such as portable computer, mobile phone and various consumer electronics device etc., all have been provided with processor, and it can perform software and/or firmware program, to realize the various variation functions of electronic installation.Program can be modified easily, expands or update, and thereby improves, promotes or promote the function of electronic installation.
Shelves (objectfile) for the purpose of the source code (sourcecode) compiling (compile) that software program will describe by program language in higher through compiler (compiler), and link program library (library) and convert it to be available for the execution shelves (executablefile) of processor execution.It is said that in general, include one or more subprogram (subroutine) in program, each subprogram includes that one or more instructs (instruction), the corresponding different command function of different instruction.Purpose shelves, execution shelves include many machine codes (machinecode), make each instruction of program represent with binary bit machine code.Electronic installation configures certain storage area and deposits the most continuously with the machine code by same usability of program fragments;Processor is then to be performed the machine code of shelves by access in storage area, and is performed, to realize all functions of electronic installation.
Owing to the function of modern electronics is numerous and diverse, the logic venation of procedure operation also becomes sufficiently complex;In order to tracing program correction, correcting, upgrade, update with test, need to carry out program and compare.
In existing known technology, a kind of carry out the method that program compares and directly compare the source code of two programs.But, this kind of known technology can be limited to source code architectural difference and program language in higher syntactic analysis difference.Furthermore, in numerous applications, source code also cannot obtain;For example, if the author of source code and the user/tester performing shelves are different vendor, user/tester just cannot be carried out comparing to carry out program by source code.
Another kind of known program comparison techniques is then the comparison that the purpose shelves for two programs or execution shelves carry out binary content;It is to say, when comparing the execution shelves of two programs, this kind of known technology is first by turn or compares to tuple two purpose shelves by turn or perform the machine code in shelves.But, this kind of known technology can only the binary content of comparison program, it is impossible to identification two program the most similar or suitable (equivalent).In practice, there are many situations can make the function equivalent of two programs but binary content is different.For example, even same source code, if the optimal setting of compiler changes, compiling execution shelves out will substantial difference, although is functionally the most suitable.
Furthermore, the program section (section) performing shelves sets difference, two equivalences also can be made to perform shelves and have different binary content.For example, if a certain execution shelves being multiple functions (function) are arranged to same program section, another performs shelves and same multiple functions is arranged in two program sections respectively, then this two perform shelves binary content will difference, but be functionally still suitable.
If additionally, the function of a certain execution shelves has been revised, the machine code of neighbouring function is also possible to be affected, and extra difference occurs in the binary content performing shelves after making amendment;Suffering from this, known program comparison techniques will the amplitude of misidentification modification of program.
The machine code produced after having some instructions compiled is different, but the result performed in logic is identical;For example, numerical value 0 (is put into parameter a) different from the form of " subaa " (value of parameter a being deducted by parameter a) two instruction, but result is identical by " mova0 ".It addition, in different compilers, ignore instruction (no-operation, nop) may be compiled as A=A.If comprising these instructions in two programs, even if the execution result of two programs is identical, two programs still can be judged as different programs by the known technology compared based on binary content.
Summary of the invention
Shortcoming for known technology, the present invention proposes a kind of based on functional program comparison techniques, can compare for the purpose shelves of two subprograms (or even two programs) or execution shelves, the most whether suitable with identification the two subprogram, no matter the binary content of its machine code is the most equal.
The present invention functional program comparison techniques has many advantages, and purposes is the most quite varied.For example, carry out with old edition program after program compares, just can making software upgrade package according to this, so that old edition program is upgraded to new edition program for new edition.Program before and after revising for source code compares, then can assess the reasonability of source code amendment and structure.Furthermore, find out at the changing function of new and old program if can compare with program, program test person just can carry out target test for the change of function, reaches preferably to test coverage rate with the less time.If the author of source code is different vendor with the user/tester of purpose shelves/execution shelves, user/tester can carry out the comparison of new and old program for purpose shelves/execution shelves, to find out at the amendment of programmed logic, and the amendment purpose of inference source code.In some occasion, identical source code can be compiled as different execution shelves because of linking from different program libraries, makes the program of same version inconsistent program behavior (with function) occur;Use present procedure comparison techniques, can be that inconsistent program behavior proposes reasonable dismissal, and follow the trail of its difference source.
It is an object of the invention to provide a kind of program comparative approach, may be used to compare the functional of one first subprogram and one second subprogram.The method includes: set multiple instruction set, and each instruction set is associated with the instruction set handling process of a correspondence;It is initial value (such as 0) by one first index and one second target setting, and by the setting value of one first jump index and one second jump index to (e.g. negative value) in a preset range;Carry out one first acquisition flow process, respectively by this first subprogram and this second subprogram obtain one first usability of program fragments and one second usability of program fragments, and this first usability of program fragments and this second usability of program fragments are ranged respectively those instruction sets one of them;Carrying out a usability of program fragments and compare flow process, the instruction set classified according to the first usability of program fragments and the classified instruction set of the second usability of program fragments select an instruction set handling process, compare the first usability of program fragments the most suitable with the second usability of program fragments;If the first usability of program fragments is suitable with the second usability of program fragments, then repeat the first acquisition flow process to update the first usability of program fragments and the second usability of program fragments;If the first usability of program fragments and the second usability of program fragments have been empty the most, then judge that the first subprogram is suitable with the second subprogram;If the first usability of program fragments and the second usability of program fragments are not all sky, or the first usability of program fragments is not suitable with the second usability of program fragments, then judge that the first subprogram is the most suitable with the second subprogram.
In one embodiment, first captures flow process includes: carries out a machine code and captures flow process, if comprising: the numerical value of the first (the second) jump index is in this preset range, in the first (the second) subprogram, a machine code is obtained according to the first (the second) index, and the first (the second) index is updated, to point to time machine code in the first (the second) subprogram;If the numerical value of the first (the second) jump index is not in this preset range, in the first (the second) subprogram, a machine code is obtained according to the first (the second) jump index, and the first (the second) jump index is updated, to point to time machine code in the first (the second) subprogram;After machine code captures flow process, if obtaining machine code in the first (the second) subprogram, then the machine code obtained is added to the first (the second) usability of program fragments;If the first (the second) usability of program fragments not yet can be classified as arbitrary instruction set, then repeat machine code and capture flow process, and the machine code of acquirement is continuously added into the first (the second) usability of program fragments;If the first (the second) usability of program fragments has met one of them of those instruction sets, then carry out to usability of program fragments comparing flow process.
In one embodiment, those instruction sets can include, but is not limited to unconditional formula jump (unconditionalbranch) instruction set, subprogram recurrence (return) instruction set, constant obtains (constantload) instruction set, attonity (no-operation) instruction set, subprogram calls (subroutinecall) instruction set, conditional jumps (conditionalbranch) instruction set and other class instruction sets etc.;Each instruction set is associated with the instruction set handling process of a correspondence.If the first usability of program fragments and the second usability of program fragments are classified as same instruction set, then in usability of program fragments compares flow process, judge that the first usability of program fragments is the most identical with the second usability of program fragments according to the instruction set handling process of this same instruction set association.
For example, if the first usability of program fragments and the second usability of program fragments are all classified as subprogram call instruction set, usability of program fragments compares the corresponding instruction set handling process in flow process and may include that obtaining one first respectively according to the subprogram title of the first usability of program fragments with the second usability of program fragments calling calls subprogram title and one second calling subprogram title;If the first calling subprogram title is different with the second calling subprogram title, it is judged that this second usability of program fragments of the first usability of program fragments is the most suitable;If the first calling subprogram title is identical with the second calling subprogram title, it is judged that the first usability of program fragments and the second usability of program fragments have same functionality (quite).
In one embodiment, if the first usability of program fragments and the second usability of program fragments are all classified as constant and obtain instruction set, and compare for performing shelves, usability of program fragments compares the corresponding instruction set handling process in flow process and may include that the constant value obtained according to the first usability of program fragments and the second usability of program fragments obtains one first respectively and comes source value and a second source value;Come that source value is the most equal with second source value judges that the first usability of program fragments is the most suitable with the second usability of program fragments according to first.If comparing for purpose shelves, then the corresponding instruction set handling process during usability of program fragments compares flow process may include that the constant symbol (symbol) obtained according to the first usability of program fragments and the second usability of program fragments obtains one first source symbol and a second source symbol respectively;Judge whether the first usability of program fragments and the second usability of program fragments have same functionality according to the first source symbol is the most equal with second source symbol.
If the first usability of program fragments and the second usability of program fragments are all classified as this other class instruction sets, usability of program fragments compares the corresponding instruction set handling process in flow process and may include that to compare the first usability of program fragments the most identical with the machine code of the second usability of program fragments, to judge whether the first usability of program fragments and the second usability of program fragments have same functionality.
If the first usability of program fragments and the second usability of program fragments are all classified as subprogram and return instruction set, usability of program fragments compares the corresponding instruction set handling process in flow process and may include that by the first jump index and the second jump target setting in this preset range, and judges whether the first usability of program fragments and the second usability of program fragments have same functionality.
If the first usability of program fragments and the second usability of program fragments are not classified as same instruction set, if usability of program fragments compares may include that in flow process that the first (the second) usability of program fragments is classified as unconditional formula skip instruction set, second (the first) usability of program fragments is not classified as unconditional formula skip instruction set, and first the numerical value of jump index and the second jump index all in this preset range, then update the first (the second) jump index according to the purpose of the unconditional jump of the first (the second) usability of program fragments, the numerical value making the first (the second) jump index is no longer in this preset range;Along with the first jump index is updated, the second (the first) index is also made to be retracted into the numerical value before being updated (the most previous carry out the numerical value before the first acquisition flow process);Then, the first acquisition flow process is repeated.
In other words, if the first usability of program fragments and the second usability of program fragments are classified as different instruction set respectively, and first (the second) usability of program fragments be classified as unconditional formula skip instruction set, then repeat the first acquisition flow process, update the first (the second) usability of program fragments with the purpose of the unconditional jump according to the first (the second) usability of program fragments, and repeat usability of program fragments and compare flow process.
Compare in process step in present procedure fragment, compare the first usability of program fragments the most identical in the logic sequence of operations of this instruction set handling process with the second usability of program fragments, identical functional to judge whether the first usability of program fragments and the second usability of program fragments have.
More preferably understand in order to the above-mentioned and other aspect of the present invention is had, preferred embodiment cited below particularly, and coordinate accompanying drawing, be described in detail below.
Accompanying drawing explanation
Fig. 1 illustrates that the flow chart according to one embodiment of the invention.
Fig. 2 illustrates that and obtains the flow process of usability of program fragments in Fig. 1 flow process according to one embodiment of the invention.
Fig. 3 illustrates that the subprogram call instruction process of aggregation flow process according to one embodiment of the invention.
Fig. 4 illustrates that and obtains instruction set handling process according to the constant of one embodiment of the invention.
Fig. 5 illustrates that and returns instruction set handling process according to the subprogram of one embodiment of the invention.
Fig. 6 illustrates that other class instruction set handling processes according to one embodiment of the invention.
Fig. 7 illustrates that according to one embodiment of the invention to be the usability of program fragments of the different instruction set flow process that carries out processing.
Fig. 8 is in order to illustrate the carrying out of Fig. 1 flow process.
Main element symbol description
100,200,300,400,500,800,900: flow process
101-190,801-890,201-270,301-382,401-420,501-530,901-960: step
A1-a5, j1-j5: position
S1-S4, R, UB: usability of program fragments
A, A ': subprogram
Detailed description of the invention
Present procedure comparison techniques utilizes the purpose shelves of program or execution shelves to carry out program and compare.Purpose shelves or the execution shelves of program are to be combined by various machine codes, and each machine code takies the storage area of a unit (such as one character, word);One usability of program fragments is included in storage area one or more machine code deposited the most continuously, in order to realize a certain command function.For example, some instruction only utilizes single machine code, and this single machine code forms a usability of program fragments voluntarily.Relatively, some instruction (seeming certain unconditional formula skip instruction) then needs the machine code using two (or multiple) to deposit continuously, and the two (or multiple) machine code i.e. forms a usability of program fragments.
For realizing present procedure comparison techniques, first can define multiple instruction sets according to command function, each instruction set is associated with a command function, and comprises one or more usability of program fragments;Namely identical for one or more function/similar usability of program fragments is attributed in same instruction set.For example, all instructions may used in program can be classified as respectively by one embodiment of the invention according to function: unconditional formula skip instruction set, subprogram return instruction set, constant obtains instruction set, ignore instruction set, subprogram call instruction set, conditional skip instruction set and other class instruction sets;If necessary, it is also possible to set up more instruction set, or by comprehensive for multiple instruction sets to same instruction set.
Unconditional formula skip instruction set refers to after processor performs this type of usability of program fragments, and processor state (such as buffer numerical value etc.) is unaffected, but processor is not carried out time usability of program fragments that leaves in storage area, and other usability of program fragments of execution of jumping.For example, if a certain first usability of program fragments does not affect processor state after being performed, but processor can be made to jump and perform discontinuous a certain second usability of program fragments in position, then the first usability of program fragments can be classified as unconditional formula skip instruction set.
For subroutine call instruction set, assume that one first usability of program fragments is classified as this instruction set, then after processor performs this first usability of program fragments, another the second usability of program fragments being positioned at a certain appointment position can be first carried out, namely start to perform called subprogram;Under normally situation, after one uncertain execution period, time usability of program fragments that processor is deposited after performing the first usability of program fragments continuously, namely return from called subprogram.
For subroutine returns instruction set, after processor performs this type of usability of program fragments, next the usability of program fragments being performed can be uncertain, its reason can be (but are not limited to): the usability of program fragments being next performed can change according to one or more processor state, and this one or more processor state can be unknown.
For constant obtains instruction set, after the usability of program fragments belonging to this instruction set is performed, processor can be by obtaining a constant in storage area, the numerical value of this constant does not changes with execution process.
For ignore instruction set, after the usability of program fragments of this instruction set is performed, void value must account for or any processor state changes.
For conditional skip instruction set, after the usability of program fragments of this type of instruction set is performed, processor can determine, according to one or more processor state, the usability of program fragments that the next one is performed, and can learn that all possible next one is performed usability of program fragments in advance.
Finally, the usability of program fragments being not belonging to other instruction sets aforementioned is all classified as other class instruction sets.
In one embodiment, for purpose shelves carry out program compare time, the purpose shelves of program including, a subprogram set is reorientation (relocatable) pattern with a corresponding table of position symbol (or referred to as relocation table, relocationtable), the pattern of this position symbol correspondence table.Including one or more subprogram in subprogram set, each subprogram has a subprogram title, and includes one or more usability of program fragments (or machine code) can deposited the most continuously in storage area.Then including " position with symbol to " (pair) of one or many group in the symbol correspondence table of position, each " position with symbol to " is by interrelated corresponding with a symbol for a position;Wherein, each symbol can represent a sub-subroutine subprogram title with (but not limited to), and position then represents this subprogram address in storage area.Position can be numeral with (but not limited to);In same position symbol correspondence table, same symbol can be repetitively appearing in different " position with symbol to ", but same position will not be repetitively appearing in different " position with symbol to ".
Cooperation performs the relevant except wrong news file (debuginformationfile) of shelves, and the present invention also can carry out program for execution shelves and compare.Performing shelves and include a subprogram set, subprogram set includes one or more subprogram;Corresponding removing in wrong news file the most at least includes one " position table corresponding with subprogram title ", accordingly, a position symbol correspondence table being relevant to perform shelves can be produced, it at least includes this " position table corresponding with subprogram title ", and the pattern of this position symbol correspondence table is fixing (fixed) pattern.
Whether purpose shelves or execution shelves, as long as coordinating the position symbol correspondence table that it is relevant, can be obtained each subprogram by purpose shelves or execution shelves.Present procedure comparison techniques can be i.e. that unit is carried out with subprogram;It is to say, present procedure comparison techniques can comparison go out two subprograms the most quite, the most whether equivalence.The subprogram of the mutual comparison of the two can be the subprogram in two distinct programs with title respectively, it is also possible to is two subprograms of different names in same program;Or, it is also possible to it is the subprogram of different names in two distinct programs respectively.
When comparing two subprograms, present procedure comparison techniques can be the most suitable according to instruction set comparison two usability of program fragments belonging to two usability of program fragments by obtaining two usability of program fragments in two subprograms respectively, i.e. has identical function;According to each usability of program fragments in operational logic sequentially comparison two subprogram of subprogram, judge that two subprograms are the most suitable according to this.In the present invention, each instruction set is all associated with the instruction set handling process of a correspondence.When to compare two usability of program fragments according to the instruction set belonging to two usability of program fragments, if two usability of program fragments belong to same instruction set, just can judge that this two usability of program fragments is the most suitable according to the instruction set handling process that the association of this instruction set is corresponding;Relatively, if two usability of program fragments are not belonging to same instruction set, then judged that this two usability of program fragments is the most suitable by another exclusive handling process, and control its follow-up usability of program fragments and compare.
Refer to Fig. 1, what it was illustrated is based on the flow process 100 of one embodiment of the invention, and it can realize present procedure comparison techniques, in order to compare one first subprogram with one second subprogram the most quite (for one species function).The carrying out of flow process 100 can be described as follows.
Step 101: initialize.One first index and one second index are set to initial value (such as numerical value 0), by the setting value of one first jump index and one second jump index a to preset range, such as, say it is that to make the numerical value of the first jump index and the second jump index be negative value.First index and the first jump index are corresponding to the first subprogram, and the second index and the second jump index are corresponding to the second subprogram.When the numerical value of the first jump index or the second jump index falls in this preset range, represent and be made without a position jump, and machine code should be obtained with the position of the first corresponding index or the second index indication.Otherwise, when the numerical value of the first jump index or the second jump index does not falls within this preset range, representative need to carry out a position jump, and its numerical value of jump index i.e. carries out should obtaining time jump in this position the position of machine code.
Step 110: one of them according to the first index and the first jump index obtains a usability of program fragments, as one first usability of program fragments from the first subprogram.This step can be considered an acquisition flow process, the flow process 800 with Fig. 2 is further described.This step also can judge that the first usability of program fragments belongs to any instruction set.
Step 111: one of them according to the second index and the second jump index obtains a usability of program fragments, as one second usability of program fragments from the second subprogram.This step is carried out also according to the flow process 800 of the 2nd figure;Therefore, this step also can judge which kind of instruction set is the second usability of program fragments can be classified as.
Step 120: from step 110 with 111 the first usability of program fragments obtained with the second usability of program fragments, if one of them is empty (not including any machine code), i.e. may proceed to step 170, otherwise carry out to step 130.
Step 130: judge whether the first usability of program fragments and the second usability of program fragments the two usability of program fragments belong to same instruction set, if being judged as YES, is then carried out to step 140.If two usability of program fragments are not belonging to same instruction set, carry out step 150.
Step 140: carry out the instruction set handling process of correspondence according to the instruction set belonging to first, second usability of program fragments is the most suitable to judge first, second usability of program fragments the most in a step 160.For example, the instruction set handling process corresponding to subprogram call instruction set can be carried out according to the flow process 200 of the 3rd figure, and the instruction set handling process that constant obtains corresponding to instruction set can be carried out according to Fig. 4 flow process 300;The instruction set handling process that subprogram returns corresponding to instruction set can be carried out according to the flow process 400 of Fig. 5;Other instruction set handling processes corresponding to all instructions then can be carried out according to Fig. 6 flow process 500.
Step 150: be connected in step 130, if first, second usability of program fragments is classified as different instruction sets respectively, carries out exclusive handling process, and the flow process 900 with Fig. 7 is described further by embodiment.
Step 160: according to step 140 or 150, can determine whether that first, second usability of program fragments is the most quite (whether accessory has identical functions to i.e. two usability of program fragments);If both are suitable, repeat to step 110 and 111, next in order to the usability of program fragments compared to obtain the first subprogram and the second subprogram respectively;If both are judged as unsuitable, then carry out to step 190.Step 130,140,150 can be considered that a usability of program fragments compares flow process with 160, compare two usability of program fragments in order to the instruction set classified according to first, second usability of program fragments the most suitable.
Step 170: subsequent steps 120, it is judged that whether first, second usability of program fragments is all sky, i.e. without any machine code.If first, second usability of program fragments is all sky, then carry out to step 180, otherwise carry out to step 190.
Step 180: judge that the first subprogram and the second subprogram are quite (functionally as equivalence).
Step 190: judge that the first subprogram is the most suitable with the second subprogram.
Refer to Fig. 2, what it was illustrated is based on the flow process 800 of one embodiment of the invention;The step 110 of Fig. 1 can be carried out according to flow process 800 with 111.The carrying out of flow process 800 can be described as follows.
Step 801: start flow process 800.
Step 805: initialize a usability of program fragments, makes this usability of program fragments for sky, does not include any machine code.
Step 810: if a jump index falls into a preset range, for example, for negative value, carry out to step 820, otherwise carry out to step 825.First jump index of this i.e. step 110 of jump index or the second jump index of step 111.
Step 820: obtain a machine code in a subprogram according to the position of an index instruction, and this index is pointed to a continuous print time position in storage area.The first index in index herein and subprogram i.e. step 110 and the first subprogram, or the second index in step 111 and the second subprogram.
Step 825: obtain a machine code in this subprogram according to the position of a jump index instruction, and this jump index is pointed to a continuous print time position in storage area.The first jump index in jump index i.e. step 110 herein or the second jump index in step 111.
Step 830: in step 820 or 825, if the position that this index maybe this jump index is pointed to has not had machine code (after such as saying the tail end that this index/jump index has pointed to this subprogram) not obtain machine code, just may proceed to step 890;Otherwise, then carry out to step 840.Step 810,820,825 and 830 can be considered that a machine code captures flow process.
Step 840: step 820 or 825 machine codes obtained are added to this usability of program fragments, goes forward side by side and walk to step 850.
Step 850: if this usability of program fragments can be classified as a certain instruction set, namely this usability of program fragments has constituted a significant instruction, just may proceed to step 890;Otherwise, then step 810 is repeated.
Step 890: return this usability of program fragments, completes flow process 800, namely completes the step 110 in Fig. 1 or 111, obtains the first usability of program fragments and the second usability of program fragments respectively, to proceed step 120.
Crossing as outlined above, a usability of program fragments can include multiple machine code;By step 820(or 825) to step 830 and 840, often carry out once can a machine code being added in usability of program fragments, pulled over to step 810 more machine code can be captured to usability of program fragments by step 850.For the usability of program fragments of multiple machine codes, if the machine code number deficiency in usability of program fragments, this usability of program fragments the most also cannot be classified as any one instruction set;Therefore, flow process 800 can be repeated to step 810 by step 850, until usability of program fragments has been collected enough machine codes and can be classified as a certain instruction set smoothly.Then, flow process 800 just can terminate, and can proceed with the step 120 to flow process 100.
From flow process 800, step 110,111 not only by obtaining first, second usability of program fragments in first, second subprogram respectively, also can determine whether out, in step 850, the instruction set that first, second usability of program fragments is classified.In flow process 800, the logic that jump index operates with subprogram is relevant, such as, say it is that the unconditional formula jump with subprogram is relevant;The Detailed Operation of jump index can further illustrate in the flow process 900 of Fig. 7 in Fig. 5 flow process 400.
Refer to Fig. 3, what it was illustrated is based on the flow process 200 of one embodiment of the invention, the instruction set handling process exclusive in order to realize subprogram call instruction set in the step 140 of Fig. 1.The carrying out of flow process 200 can be described as follows.
Step 201: in Fig. 1 flow process 100, if first and second usability of program fragments comes under subprogram call instruction set (step 130), just can proceed by flow process 200 in step 140.
Step 210: if the pattern of position symbol correspondence table is fixed model, then carries out to step 220, otherwise then carry out to step 230.Fixed model represents flow process 100 and compares for performing shelves;If not fixed model, e.g. reorientation pattern, then represent flow process 100 and compare for purpose shelves.
Step 220: if comparing for performing shelves, can be calculated one first calling position and one second calling position respectively by the machine code of the machine code of the first usability of program fragments Yu the second usability of program fragments.
Step 230: if comparing for purpose shelves, available first index calls position as the first calling position with second with the position of the second index.
Step 240: utilize purpose shelves or perform position symbol correspondence table corresponding to shelves or " position table corresponding with subprogram title ", one first calling subprogram title and one second calling subprogram title can be obtained respectively according to the first calling position and the second calling position, represent the subprogram title that the first usability of program fragments is called with the second usability of program fragments.
Step 250: if the first calling subprogram title is identical with the second calling subprogram title, then carries out to step 260, otherwise then carry out to step 270.
Step 260: in step 160(Fig. 1) in judge the first usability of program fragments and the second usability of program fragments quite, to continue to the step 110 and 111 of flow process 100.In other words, if the first usability of program fragments and the second usability of program fragments come under subprogram call instruction set, and both all call the subprogram of same title, i.e. can determine whether that the first usability of program fragments is suitable with the second usability of program fragments.
Step 270: judge that in step 160 first usability of program fragments and the second usability of program fragments be not suitable, to continue to step 190.Even if the first usability of program fragments and the second usability of program fragments come under subprogram call instruction set, if both call the subprogram of different names respectively, the first usability of program fragments is the most suitable with the second usability of program fragments.
When carrying out flow process 200, the first usability of program fragments can be to call the subprogram of a certain title in the first program, and the second usability of program fragments can be then to call the subprogram of same title in the second program.Should be particularly noted that, this title subprogram in the first program may be repugnant with the same title subprogram in the second program, but this repugnant pass can be reflected in the comparison of called subprogram, and does not affect the judgement that the first usability of program fragments is the most suitable with the second usability of program fragments.In other words, first, second usability of program fragments calling same title subprogram in first, second program should be judged as quite;Until this title called subprogram compared in first, second program, nature can reflect that this title called subprogram in first, second program is the most suitable.
Refer to Fig. 4, what it was illustrated is based on the flow process 300 of one embodiment of the invention, obtains instruction set handling process in order to realize constant in the step 140 of Fig. 1.The carrying out of flow process 300 can be described as follows.
Step 301: in Fig. 1 flow process 100, if first and second usability of program fragments is all classified as constant and obtains instruction set, just can proceed by flow process 300 in step 140.
Step 310: if the first usability of program fragments is identical with the destination locations that the second usability of program fragments obtains constant, it is identical that machine code performed by after i.e. first usability of program fragments acquirement constant obtains machine code performed after constant with the second usability of program fragments, then carry out to step 320, otherwise then carry out to step 382.
Step 320: calculate one first source position and a second source position respectively according to the first usability of program fragments and the second usability of program fragments, represents first, second usability of program fragments and obtains the source position of constant.
Step 330: if the pattern of position symbol correspondence table is fixed model, then carries out to step 340, otherwise then carry out to step 360.Fixed model represents flow process 100 and compares for performing shelves;If not fixed model, e.g. reorientation pattern, then represent flow process 100 and compare for purpose shelves.
Step 340: according to the position symbol correspondence table corresponding to first, second usability of program fragments and first, second source position, can obtain first and come source value and second source value, the constant value that the respectively first usability of program fragments and the second usability of program fragments to be obtained.
Step 350: if in step 340 first to carry out source value identical with second source value, carry out to step 380, otherwise then carry out to step 382.
Step 360: according to the position symbol correspondence table corresponding to first, second usability of program fragments and first, second source position, obtain the first source symbol and second source symbol, the symbol (title) of the constant that the most corresponding first usability of program fragments and the second usability of program fragments to be obtained.
Step 370: if first, second source both symbols of step 360 are identical, carry out to step 380, otherwise then carry out to step 382.
Step 380: in step 160(Fig. 1) in judge the first usability of program fragments and the second usability of program fragments quite, to continue to 110.
Step 382: judge that the first usability of program fragments and the second usability of program fragments be not suitable, to continue to 190 in a step 160.
In flow process 300, by step 330 to 340, represent flow process 100 and carry out the comparison of subprogram for execution shelves;Owing to performing shelves and the relevant numerical value that can include constant except wrong news file, but constant title (symbol) can not be included, therefore when carrying out flow process 300 for execution shelves, can be carried out to step 340 and 350 by step 330, judge that first, second usability of program fragments is the most suitable according to the numerical value of constant is the most equal.Relatively, purpose shelves can include the symbol (title) of constant, but can not include the numerical value of constant, therefore when carrying out flow process 300 for purpose shelves, can be carried out to step 360 and 370 by step 330, judge that first, second usability of program fragments is the most suitable according to the symbol of constant is the most equal.
Refer to Fig. 5, what it was illustrated is based on the flow process 400 of one embodiment of the invention, returns the instruction set handling process of instruction set in order to realize subprogram in the step 140 of Fig. 1.The running of flow process 400 can be described as follows.
Step 401: in Fig. 1 flow process 100, if first and second usability of program fragments comes under subprogram and returns instruction set, just can carry out flow process 400 in step 140.
Step 410: be negative value by the first jump index and the second jump target setting.Before the first jump index and the second jump target setting are negative value, if the first jump index is not negative value, can be by numerical value that the first target setting is the first jump index;In like manner, if the second jump index is not negative value, can be by numerical value that the second target setting is the second jump index.
Step 420: in step 160(Fig. 1) in judge the first usability of program fragments and the second usability of program fragments quite, to continue to 110 and 111.
In other words, if first and second usability of program fragments comes under subprogram and returns instruction set, first jump index and the second jump index can be returned back to the initial value of step 101 by step 410, and the first index and the second index are optionally respectively directed to the first jump index and the numerical value of the second jump index indication.That is, flow process 400 a priori judges when first and second usability of program fragments comes under subprogram recurrence instruction set, first and second usability of program fragments is suitable, and is only used as setting the first jump index second and jumps index, and optionally sets the first index and the second index is used.
Refer to Fig. 6, what it was illustrated is based on the flow process 500 of one embodiment of the invention, in order to realize the instruction set handling process of other class instruction sets in the step 140 of Fig. 1.The running of flow process 500 can be described as follows.
Step 501: in Fig. 1 flow process 100, if first and second usability of program fragments comes under other class instruction sets, just can carry out flow process 500 in step 140.
Step 510: if the first usability of program fragments is the most identical with all machine codes of the second usability of program fragments, carries out to step 520, otherwise then carry out to step 530.
Step 520: judge that in Fig. 1 step 160 first usability of program fragments is suitable with the second usability of program fragments, to proceed to the step 110 and 111 of flow process 100.
Step 530: judge that in Fig. 1 step 160 first usability of program fragments and the second usability of program fragments be not suitable, to continue to 190.
That is, when first and second usability of program fragments comes under other class instruction sets, the machine code that flow process 500 can directly compare both is the most equal, uses and judges that first and second usability of program fragments is the most suitable.
Refer to Fig. 7, what it was illustrated is based on the flow process 900 of one embodiment of the invention, in order to realize handling process in the step 150 of Fig. 1.The running of flow process 500 can be described as follows.
Step 901: if first, second usability of program fragments is classified as different instruction sets respectively, can be in flow process 100(Fig. 1) step 150 in carry out flow process 900.
Step 910: if one of any of which of the first jump index and the second jump index is not negative value, then carry out to step 960;Otherwise, if the first jump index and the second jump index are negative value, then carry out to step 920.
Step 920: if the first usability of program fragments belongs to unconditional formula skip instruction set, then calculate the destination locations of unconditional jump according to the first usability of program fragments, and the first jump index is updated to this destination locations;It is to say, if the first usability of program fragments belongs to unconditional formula skip instruction set, the first jump index will be no longer negative value.Furthermore, also the second index is retracted into the preceding value before step 111 is carried out.In Fig. 1 flow process 100, if being carried out to flow process 900 by step 150, representing step 111 and the most first carrying out once;When carrying out step 111, the second index can be updated (Fig. 2 step 820).And in step 920, it is simply that the numerical value of the second index to be recovered the numerical value before carrying out to step 111.
4 steps 930: if the second usability of program fragments belongs to unconditional formula skip instruction set, then calculating the destination locations jumped according to the second usability of program fragments, and the second jump value mark is updated to this destination locations, making the second jump index is no longer negative value.Furthermore, also the first index is retracted into the preceding value before step 110 is carried out.In flow process 100, step 150 carry out to flow process 900, represent step 110 and the most first carried out once;When carrying out step 110, the first index can be updated (Fig. 2 step 820).And in step 930, it is simply that the numerical value of the first index to be recovered the numerical value before carrying out to step 110.
Step 940: if any of which one of the first jump index and the second jump index is not negative value, carries out to step 950, otherwise then carry out to step 960.
Step 950: judge that in Fig. 1 step 160 first usability of program fragments is suitable with the second usability of program fragments, to repeat to step 110.
Step 960: judge that the first usability of program fragments and the second usability of program fragments be not suitable in a step 160, to repeat to step 190.
When flow process 900 is carried out to step 910, it is assumed that the first jump index is not negative value, representing flow process 900 and carried out once, the first usability of program fragments is the jump purpose of previous a certain usability of program fragments in the first subprogram.Therefore, if the first usability of program fragments and the second usability of program fragments are not belonging to same instruction set, so that it may judge the first usability of program fragments and the second usability of program fragments for not quite, i.e. step 960.
When flow process 900 is carried out to step 920 and 930 by step 910, assume that the first usability of program fragments is classified as unconditional formula skip instruction set, second usability of program fragments is not belonging to unconditional formula skip instruction set, then the first jump index can be set to the jump purpose of the first usability of program fragments, and the second index is then retracted into the numerical value before step 111 is carried out.Then, flow process 900 will be carried out to step 950 via step 940, and Fig. 1 flow process 100 will repeat to step 110 and 111.When repeating step 110 according to Fig. 2 flow process 800, the first usability of program fragments can be updated to the usability of program fragments of jump purpose because of the carrying out of step 825.When repeating step 111 according to flow process 800, identical during owing to time carrying out step 111 in front of the second index, the second usability of program fragments can with front once carry out step 111 time acquired usability of program fragments identical (step 820).When flow process 100 by step 110,111 continue to step 130 time, namely the jump object program fragment in the first usability of program fragments is made comparisons with the second usability of program fragments.In other words, the logic sequence of operations (and the sequence of positions in nonstorage space) according to first, second subprogram is compared by flow process 100, ignores and has more a unconditional jump instruction itself and compare with the usability of program fragments of jump purpose;In response to first, second subprogram belongs to the usability of program fragments of unconditional jump instruction set, step 110, in 111 the position of capturing program fragment also can with jump.
Refer to Fig. 8, the situation of two subprogram A and A ' is compared in its citing signal with flow process 100.In this instance, including continuously arranged usability of program fragments S1, S2, S3, S4 and R in subprogram A ', the initial position of each usability of program fragments is respectively 0, a1, a2, a3 and a4.Wherein, usability of program fragments R belongs to subprogram recurrence instruction set, between a4 and a5 of position.Then including usability of program fragments S1, S2, UB, S3, S4 and R in subprogram A, the initial position of each usability of program fragments is respectively 0, a1, a2, j2, j3 and j4, also has other usability of program fragments, between usability of program fragments UB between j1 and j2 of position.Wherein, usability of program fragments UB belongs to unconditional formula skip instruction set, and its purpose jumped is position j2.Subprogram A and A ' all includes usability of program fragments S1 to S4;For convenience of description, it is assumed that usability of program fragments S1 to S4 is all not belonging to unconditional formula skip instruction set.
When subroutine A and A ' carries out flow process 100, it is assumed that subprogram A is the first subprogram, subprogram A ' is the second subprogram.After step 101, flow process 100 carries out step 110 and step 111;After step 110 terminates, it is the first usability of program fragments that usability of program fragments S1 in subprogram A can be subtracted, and the position that the first index is pointed to is updated to position a1 by position 0, and the first jump index is negative value.After step 111 terminates, it is the second usability of program fragments that usability of program fragments S1 in subprogram A ' can be subtracted, and the second index is updated to position a1 by position 0, and the second jump index is still negative value.Owing to first, second usability of program fragments is identical, flow process 100 may proceed to carry out step 120,130,140 and 160, and repeats to step 110 and 111.
When second time carries out step 110, flow process 100 captures machine code according to the first index by the a1 of position;After terminating etc. step 110, it is the first usability of program fragments that usability of program fragments S2 in subprogram A can be subtracted, and the first index is updated to position a2 by position a1, and the first jump index is maintained negative value.In like manner, after step 111 terminates, it is the second usability of program fragments that usability of program fragments S2 in subprogram A ' can be subtracted, and the second index is updated to position a2 by position a1, and the second jump index is still negative value.Owing to first, second usability of program fragments is identical, flow process 100 can repeat to step 110 and 111 via step 120,130,140 and 160 once again.
When third time carries out step 110, flow process 100 captures machine code according to the first index by the a2 of position;After terminating etc. step 110, it is the first usability of program fragments that usability of program fragments UB in subprogram A can be subtracted, and the first index is updated to position j1 by position a2, and the first jump index is maintained negative value.In like manner, when step 111 is carried out, machine code can be captured according to the second index by the a2 of position;After step 111 completes, it is the second usability of program fragments that usability of program fragments S3 in subprogram A ' can be subtracted, and the second index is updated to position a3 by position a2, and the second jump index is still negative value.Owing to the first usability of program fragments and the second usability of program fragments are not belonging to same instruction set, flow process 100 can be carried out to step 150 via step 120 and 130, to carry out figureFlow process 900.Because usability of program fragments UB in the first usability of program fragments belongs to unconditional formula skip instruction, step 920 can make the first jump index point to position j2, is no longer negative value;Second index then can be retracted into position a2, the position before namely third time carries out step 111.After flow process 900 terminates, flow process 100 is carried out to step 110 and 111 once again by step 160.In other words, although usability of program fragments UB in the first usability of program fragments is different from usability of program fragments S3 in the second usability of program fragments, but flow process 100 can first assume that both are quite, in order to repeating to step 110 and 111, the logic venation being performed according to subprogram continues to compare.
When carrying out step 110 according to flow process 800 the 4th time, flow process 800 can start to capture machine code from position j2 according to the first jump index in step 825;After step 110 terminates, it is the first usability of program fragments that usability of program fragments S3 in subprogram A is subtracted, and the first jump index is then updated to position j3 by position j2.When carrying out step 111, flow process 100 can be captured machine code by position a2 once again according to the second index;After step 111 completes, the second index is updated to position a3 by position a2, and the second usability of program fragments is still usability of program fragments S3, and the second jump index is maintained negative value.Then, owing to the first usability of program fragments is equal with the second usability of program fragments, flow process 100 is pulled over to step 110 and 111 once again via step 120,130,140 and 160.
Carry out step 110 for 5th time, can start to capture machine code from position j3 according to the first jump index;After step 110 completes, it is the first usability of program fragments that usability of program fragments S4 in subprogram A is subtracted, and the first jump index is then updated to position j4 by position j3.When carrying out step 111 the 5th time, then can start to obtain machine code from position a3 according to the second index;After step 111 completes, the second index is updated to position a4 by position a3, and it is the second usability of program fragments that usability of program fragments S4 is subtracted, and the second jump index is maintained negative value.Because the first usability of program fragments equal with the second usability of program fragments (being usability of program fragments S4), flow process 100 is pulled over to step 110 and 111 via step 120,130,140 and 160 again.
According to the first jump index, when carrying out step 110 the 6th time, can start to capture machine code from position j4;After step 110 completes, it is the first usability of program fragments that usability of program fragments R in subprogram A is subtracted, and the first jump index is updated to position j5 by position j4.When carrying out step 114 the 6th time, then can start to obtain machine code from position a4 according to the second index;After step 111 completes, the second index is updated to position a5 by position a4, and it is the second usability of program fragments that usability of program fragments R in subprogram A ' is subtracted, and the second jump index is maintained negative value.Because the first usability of program fragments is equal with the second usability of program fragments, belong to subprogram and return instruction set, therefore flow process 100 can be carried out to step 140 via step 120 and step 130, carries out the 5th workflow graph 400 in step 140, makes first, second jump index all revert to negative value.After flow process 400 completes, 110 and 111 can be continued to via step 160.But, step 110 and step 111 all cannot capture machine code again, therefore first, second usability of program fragments is sky, and flow process 100 will via step 120,170 and carry out to step 180, it is judged that subprogram A and A ' is suitable.
After carrying out the step 110 and 111 of flow process 100, if first, second usability of program fragments has one for empty and another is for sky, represent the first subprogram and can use different number usability of program fragments in logic venation respectively from the second subprogram, therefore flow process 100 can be carried out to step 190 by step 170, it is judged that two subprograms are the most suitable.
As shown in Figure 8, the binary content of subprogram A and A ' differs in fact.But, for the logical order of subprogram running, when When subroutine A and A ' is performed, both the most sequentially perform usability of program fragments S1, S2, S3, S4 and R.Therefore, the running result of subprogram A and A ' is identical, and both functionally should belong to equivalence;Accordingly, flow process 100 of the present invention also correctly judges, and both are suitable.By described above it can be appreciated that the program comparison techniques of flow process 100 of the present invention can positively pick out two subprograms the most suitable, no matter the machine code binary content of the two subprogram is the most identical.Owing to the comparison of flow process 100 is based on what logic venation was carried out, the usability of program fragments being positioned between j1 with j2 of position in subprogram A is not required to be compared.
The most suitable with one second program to comparison one first program, can be the first subprogram and the second subprogram automatically the same title subprogram in the first program and the second program is captured respectively via proper arrangement, and carry out flow process 100 for the first subprogram and the second subprogram.If the first program has equal number of subprogram with the second program, each subprogram in first program all has the corresponding subprogram of same title in the second program, and by flow process 100, the same title subprogram that first in program and the second program is all judged as that quite, then first program that can determine whether is suitable with the second program.
In summary, compared to known program comparison techniques, present procedure comparison techniques can compare for the functional of program, be not required to source code, and the binary content being also not limited to machine code is the most equal.Therefore, the present invention can derive the application that known technology cannot realize, such as: assessment source code amendment and the reasonability of structure, demarcate the changing function of new and old program and sentence streamline procedures test process and/or Software for producing AKU, find out at the amendment of programmed logic, find out the root of difference for two programs that behavior is different, etc..The program comparison techniques of the present invention can realize with software.
In sum, although the present invention discloses as above with preferred embodiment, and so it is not limited to the present invention.Persond having ordinary knowledge in the technical field of the present invention, without departing from the spirit and scope of the present invention, when being used for a variety of modifications and variations.Therefore, protection scope of the present invention ought be defined by tbe claims and be as the criterion.

Claims (13)

1. a program comparative approach, compares the functional of one first subprogram and one second subprogram, and the method comprises:
Setting multiple instruction set, respectively this instruction set is associated with the instruction set handling process of a correspondence;
Carry out one first acquisition flow process, respectively by this first subprogram and this second subprogram obtain one first usability of program fragments and one second usability of program fragments, and this first usability of program fragments and this second usability of program fragments are ranged respectively one of them of those instruction sets, wherein shelves or perform shelves for the purpose of this first subprogram and this second subprogram;And
Carry out a usability of program fragments and compare flow process, this instruction set classified with this second usability of program fragments according to this instruction set that this first usability of program fragments is classified selects and carries out one of those instruction set handling processes, to compare whether this first usability of program fragments and this second usability of program fragments have identical functional.
2. program comparative approach as claimed in claim 1, it is characterised in that this usability of program fragments compares flow process and comprises:
If this first usability of program fragments and this second usability of program fragments are classified as same instruction set, judge whether this first usability of program fragments and this second usability of program fragments have according to this instruction set handling process of this same instruction set association identical functional.
3. program comparative approach as claimed in claim 1, it is characterised in that comprise a unconditional formula skip instruction set in those instruction sets, and this usability of program fragments compares flow process and comprises:
If the different instruction set that this first usability of program fragments and this second usability of program fragments are classified as in those instruction sets respectively, and this first usability of program fragments is classified as this unconditional formula skip instruction set, then update this first usability of program fragments according to a destination locations of the unconditional jump of this first usability of program fragments, and repeat this usability of program fragments and compare flow process.
4. program comparative approach as claimed in claim 1, it is characterised in that comprise a subprogram call instruction set in those instruction sets, and this usability of program fragments compares flow process and comprises:
If this first usability of program fragments and this second usability of program fragments are all classified as this subprogram call instruction set, then obtain one first calling subprogram title and one second calling subprogram title respectively according to the subprogram title of this first usability of program fragments with the calling of this second usability of program fragments;
If this first calling subprogram title is different with this second calling subprogram title, it is judged that this first usability of program fragments is the most suitable with this second usability of program fragments;And
If this first calling subprogram title is with this, second to call subprogram title identical, it is judged that this first usability of program fragments and this second usability of program fragments have identical functional.
5. program comparative approach as claimed in claim 1, it is characterised in that comprise a constant in those instruction sets and obtain instruction set, and this usability of program fragments compares flow process and comprises:
If this first usability of program fragments and this second usability of program fragments are all classified as this constant and obtain instruction set, then the constant value to be obtained according to this first usability of program fragments and this second usability of program fragments obtains one first respectively and comes source value and a second source value;And
First carry out source value according to this most equal with this second source value to judge whether this first usability of program fragments and this second usability of program fragments have identical functional.
6. program comparative approach as claimed in claim 1, it is characterised in that comprise a constant in those instruction sets and obtain instruction set, and this usability of program fragments compares flow process and comprises:
If this first usability of program fragments and this second usability of program fragments are all classified as this constant and obtain instruction set, the constant symbol obtained according to this first usability of program fragments and this second usability of program fragments obtains one first source symbol and a second source symbol respectively;And
According to this first source symbol, the most equal with this second source symbol to judge whether this first usability of program fragments and this second usability of program fragments have identical functional.
7. program comparative approach as claimed in claim 1, it is characterised in that comprise other class instruction sets in those instruction sets, and this usability of program fragments compares flow process and comprises:
If this first usability of program fragments and this second usability of program fragments are all classified as this other class instruction sets, then compare this first usability of program fragments the most identical with the machine code of this second usability of program fragments, identical functional to judge whether this first usability of program fragments and this second usability of program fragments have.
8. program comparative approach as claimed in claim 1, it is characterised in that also comprise:
By in the setting value of one first jump index a to preset range;
Wherein, this first acquisition flow process comprises:
Carry out a machine code and capture flow process, comprise: if the numerical value of this first jump index is in this preset range, in this first subprogram, obtain a machine code according to one first index, and this first index is updated, to point to time machine code in this first subprogram;If the numerical value of this first jump index is not in this preset range, in this first subprogram, obtains a machine code according to this first jump index, and this first jump index is updated, to point to time machine code in this first subprogram;
After obtaining this machine code in this first subprogram, this machine code is added to this first usability of program fragments;And
If this first usability of program fragments not yet can one of any of which that be classified as those instruction sets, then repeat this machine code and capture flow process.
9. program comparative approach as claimed in claim 8, it is characterised in that comprise a unconditional formula skip instruction set in those instruction sets, and this usability of program fragments compares flow process and comprises:
If this first usability of program fragments is classified as this unconditional formula skip instruction set, this second usability of program fragments is not classified as this unconditional formula skip instruction set, and the numerical value of this first jump index is in this preset range, then update this first jump index according to the destination locations of the unconditional jump of this first usability of program fragments, make the numerical value of this first jump index be no longer in this preset range;And
Repeat this first acquisition flow process.
10. program comparative approach as claimed in claim 9,
It is characterized in that, this usability of program fragments compares flow process and also comprises:
If this first usability of program fragments is classified as this unconditional formula skip instruction set, this second usability of program fragments is not classified as this unconditional formula skip instruction set, and this first jump index is updated, then the numerical value before making one second index be retracted into renewal.
11. program comparative approach as claimed in claim 8, it is characterised in that also comprise a subprogram in those instruction sets and return instruction set, and this usability of program fragments compares flow process and comprises:
If this first usability of program fragments and this second usability of program fragments are all classified as this subprogram and return instruction set, then by this first jump target setting in this preset range, and it is identical functional to judge that this first usability of program fragments and this second usability of program fragments have.
12. program comparative approach as claimed in claim 1, it is characterised in that also comprise:
If this first usability of program fragments is suitable with this second usability of program fragments, then repeat this first acquisition flow process to update this first usability of program fragments and this second usability of program fragments;
If this first usability of program fragments and this second usability of program fragments are all sky, it is judged that this first subprogram and this second subprogram have identical functional;
If this first usability of program fragments and this second usability of program fragments are not all sky, or this first usability of program fragments is not suitable with this second usability of program fragments, then judge that this first subprogram is the most suitable with this second subprogram.
13. program comparative approach as claimed in claim 1, it is characterized in that, this usability of program fragments compares in process step, relatively this first usability of program fragments is the most identical in the logic sequence of operations of this instruction set handling process with this second usability of program fragments, identical functional to judge whether this first usability of program fragments and this second usability of program fragments have.
CN201210110929.0A 2012-04-16 2012-04-16 Based on functional program comparative approach Expired - Fee Related CN103377040B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210110929.0A CN103377040B (en) 2012-04-16 2012-04-16 Based on functional program comparative approach

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210110929.0A CN103377040B (en) 2012-04-16 2012-04-16 Based on functional program comparative approach

Publications (2)

Publication Number Publication Date
CN103377040A CN103377040A (en) 2013-10-30
CN103377040B true CN103377040B (en) 2016-08-03

Family

ID=49462207

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210110929.0A Expired - Fee Related CN103377040B (en) 2012-04-16 2012-04-16 Based on functional program comparative approach

Country Status (1)

Country Link
CN (1) CN103377040B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200917089A (en) * 2007-10-02 2009-04-16 Iti Scotland Ltd Anti-tampering method and system thereof and integrity checking method
CN101520737A (en) * 2008-02-27 2009-09-02 三星电子株式会社 Compiling method and processor using the same
CN101894236A (en) * 2010-07-28 2010-11-24 北京华夏信安科技有限公司 Software homology detection method and device based on abstract syntax tree and semantic matching

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060041873A1 (en) * 2004-08-19 2006-02-23 Cisco Technology, Inc. Computer system and method for verifying functional equivalence

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200917089A (en) * 2007-10-02 2009-04-16 Iti Scotland Ltd Anti-tampering method and system thereof and integrity checking method
CN101520737A (en) * 2008-02-27 2009-09-02 三星电子株式会社 Compiling method and processor using the same
CN101894236A (en) * 2010-07-28 2010-11-24 北京华夏信安科技有限公司 Software homology detection method and device based on abstract syntax tree and semantic matching

Also Published As

Publication number Publication date
CN103377040A (en) 2013-10-30

Similar Documents

Publication Publication Date Title
CN112733137B (en) Binary code similarity analysis method for vulnerability detection
CN107608677B (en) Compiling processing method and device and electronic equipment
CN111177733B (en) Software patch detection method and device based on data flow analysis
CN101697131B (en) Method and device for dynamically loading relocatable file
Wang et al. Uroboros: Instrumenting stripped binaries with static reassembling
US20160357519A1 (en) Natural Language Engine for Coding and Debugging
CN102200924B (en) Modulus-scheduling-based compiling method and device for realizing circular instruction scheduling
CN110990019B (en) Java class analysis method and device, storage medium and electronic equipment
US20230004368A1 (en) Multi-chip compatible compiling method and device
Raychev et al. Refactoring with synthesis
US20160098346A1 (en) Assisted garbage collection in a virtual machine
CN103559123B (en) Based on function call stack analytical approach and the device of vxworks operating system
CN103164334A (en) System and method for detecting breaking point in web application automatic test case
US7721250B2 (en) System and method for interactive and integrated software development process and phases
CN103885770A (en) Implementation method for retrieving assembly files from executable files for single chip microcomputer
CN102364433B (en) Method for realizing Wine construction tool transplanting on ARM (Advanced RISC Machines) processor
US8117604B2 (en) Architecture cloning for power PC processors
CN103377040B (en) Based on functional program comparative approach
US20090125873A1 (en) Using compiler commentary for configuring an integrated development environment
KR100834676B1 (en) Method for building software project
TWI484413B (en) Function-based software comparison method
CN112463139A (en) Programming method and device based on electronic building blocks, electronic equipment and storage medium
CN103617049A (en) Code moving method based on complementary predicates
CN105893104A (en) Code compiling method and device
Matosevic et al. Efficient bottom-up heap analysis for symbolic path-based data access summaries

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
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160803

Termination date: 20190416