Summary of the invention
The embodiment of the present invention provides a kind of hot patch method and apparatus, for by patch function and patch functionBetween distance when long, reduce the probability that system break that hot patch process causes and the system failure occur.
The embodiment of the present invention provides a kind of hot patch method, comprising:
The distance by between patch function and patch function in the code of determining program to be repaired is greater than shortWhen the maximum jump scope of redirect, obtain redirect function information table; Wherein, redirect function information table comprises in advanceThe address of the each redirect function in the multiple redirect functions that first insert in the code of program to be repaired andService condition;
Address and the service condition of the each redirect function comprising according to redirect function information table, from redirectIn function information table, determine at least one the redirect function in unused state; Wherein, at least one jumpingTurn function and at least comprise the first redirect function; The first redirect function and being not more than by the distance between patch functionThe maximum jump scope of short redirect;
According at least one redirect function of determining, generate redirect passage; Wherein, redirect passage is with firstRedirect function is initial redirect function, and redirect passage finally jumps to patch function;
Before by patch function, add the first short redirect function, wherein, the first short redirect function is used for from being mendedFourth function jumps to the first redirect function in redirect passage, so by redirect channel hop to patch letterNumber.
Alternatively, according at least one redirect function of determining, generate redirect passage, specifically comprise:
If determine, at least one redirect function meets first condition:
In the time that definite the first redirect function is not short redirect function, be short redirect letter by the first redirect function setupNumber;
Any second jumping in N the second redirect function also comprising in definite at least one redirect functionWhen turning function and not being short redirect function, be short redirect letter by the second redirect function setup that is not short redirect functionNumber;
According to the first redirect function that is short redirect function of determining and N the 3rd redirect function, generateBy the first redirect function and N the redirect passage that the 3rd redirect function forms; Wherein, in redirect passageA rear second redirect function jumps to patch function;
Wherein, first condition is: when the first redirect function and N the second redirect function is short redirect function,For total time of implementation of the first redirect function of short redirect function and N the second redirect function is no longer than oneThe time of implementation of individual long jump function.
Alternatively, in redirect function information table, also comprise the function name of each redirect function;
According to the first redirect function that is short redirect function of determining and N the second redirect function, generateAfter the redirect passage being formed by the first redirect function and individual the second redirect function of N, also comprise:
From redirect function information table, by the function name change of the first redirect function and N the second redirect functionFor the function name of short redirect function;
From redirect function information table, by the service condition mark of the first redirect function and N the second redirect functionKnow for using state.
Alternatively, according at least one redirect function of determining, generate redirect passage, specifically comprise:
If determine, at least one redirect function does not meet first condition:
In the time that definite the first redirect function is not long jump function, be long jump letter by the first redirect function setupNumber;
According to the first redirect function that is set to long jump function, generate the redirect being formed by the first redirect functionPassage; The the first redirect function that is set to long jump function in redirect passage jumps to patch function.
Alternatively, in redirect function information table, also comprise the function name of each redirect function;
According to the first redirect function that is set to long jump function, generate the redirect being formed by the first redirect functionAfter passage, also comprise:
From redirect function information table, the function name of the first redirect function is changed to the function of long jump functionName;
From redirect function information table, the service condition of the first redirect function is designated to the state that uses.
Alternatively, before obtaining redirect function information table, also comprise:
In the code of program to be repaired, determine multiple location points;
Modify by the link script for the treatment of repair procedure, the each location point in multiple location points is insertedEnter multiple redirect functions;
Each redirect function in all redirect functions that insert in the code of unified extraction program to be repairedFunction name, address and service condition, generate redirect function information table.
Alternatively, multiple redirect functions that any location point in multiple location points inserts are short redirect functionAnd/or long jump function;
If multiple redirect functions that a location point in multiple location points inserts are short redirect function, this positionPut the shared position range of at least one redirect function in multiple redirect functions of an insertion and be one longThe position range that redirect function is shared.
Alternatively, the distance between two the adjacent location points in multiple location points is not more than short redirectLarge jump range; Or
Each location point in multiple location points be arranged in that all codes of program to be repaired comprise adjacent twoPosition in the middle of section code.
The embodiment of the present invention provides a kind of hot patch equipment, comprising:
Acquiring unit, for determine program to be repaired code by patch function and patch function betweenDistance while being greater than the maximum jump scope of short redirect, obtain redirect function information table; Wherein, redirect functionInformation table comprises the each redirect letter in the multiple redirect functions that insert in the code of program to be repaired in advanceAddress and the service condition of number;
Determining unit, for the address of each redirect function of comprising according to redirect function information table and makeBy situation, from redirect function information table, determine at least one the redirect function in unused state; ItsIn, at least one redirect function at least comprises the first redirect function; The first redirect function with by patch function itBetween distance be not more than the maximum jump scope of short redirect;
Generation unit, for according at least one redirect function of determining, generates redirect passage; Wherein,Redirect passage is taking the first redirect function as initial redirect function, and redirect passage finally jumps to patch function;
Processing unit, for add the first short redirect function before by patch function, wherein, the first short redirectFunction is used for from jumped to the first redirect function of redirect passage by patch function, and then by redirect passageJump to patch function.
Alternatively, generation unit, specifically for:
If determine, at least one redirect function meets first condition:
In the time that definite the first redirect function is not short redirect function, be short redirect letter by the first redirect function setupNumber;
Any second jumping in N the second redirect function also comprising in definite at least one redirect functionWhen turning function and not being short redirect function, be short redirect letter by the second redirect function setup that is not short redirect functionNumber;
According to the first redirect function that is short redirect function of determining and N the 3rd redirect function, generateBy the first redirect function and N the redirect passage that the 3rd redirect function forms; Wherein, in redirect passageA rear second redirect function jumps to patch function;
Wherein, first condition is: when the first redirect function and N the second redirect function is short redirect function,For total time of implementation of the first redirect function of short redirect function and N the second redirect function is no longer than oneThe time of implementation of individual long jump function.
Alternatively, in redirect function information table, also comprise the function name of each redirect function;
Processing unit, also for:
According to the first redirect function that is short redirect function of determining and N the second redirect function, rawAfter becoming the redirect passage being formed by the first redirect function and individual the second redirect function of N, from redirect function informationIn table, the function name of the first redirect function and N the second redirect function is changed to the function of short redirect functionName;
From redirect function information table, by the service condition mark of the first redirect function and N the second redirect functionKnow for using state.
Alternatively, generation unit, specifically for:
If determine, at least one redirect function does not meet first condition:
In the time that definite the first redirect function is not long jump function, be long jump letter by the first redirect function setupNumber;
According to the first redirect function that is set to long jump function, generate the redirect being formed by the first redirect functionPassage; The the first redirect function that is set to long jump function in redirect passage jumps to patch function.
Alternatively, in redirect function information table, also comprise the function name of each redirect function;
Processing unit, also for:
According to the first redirect function that is set to long jump function, generate the jumping being formed by the first redirect functionAfter turning passage, from redirect function information table, the function name of the first redirect function is changed to long jump letterThe function name of number;
From redirect function information table, the service condition of the first redirect function is designated to the state that uses.
Alternatively, also comprise extracting unit, for:
In the code of program to be repaired, determine multiple location points;
Modify by the link script for the treatment of repair procedure, the each location point in multiple location points is insertedEnter multiple redirect functions;
Each redirect function in all redirect functions that insert in the code of unified extraction program to be repairedFunction name, address and service condition, generate redirect function information table.
Alternatively, multiple redirect functions that any location point in multiple location points inserts are short redirect functionAnd/or long jump function;
If multiple redirect functions that a location point in multiple location points inserts are short redirect function, this positionPut the shared position range of at least one redirect function in multiple redirect functions of an insertion and be one longThe position range that redirect function is shared.
Alternatively, the distance between two the adjacent location points in multiple location points is not more than short redirectLarge jump range; Or
Each location point in multiple location points be arranged in that all codes of program to be repaired comprise adjacent twoPosition in the middle of section code.
In the embodiment of the present invention, determine in the code of program to be repaired by patch function and patch function itBetween distance while being greater than the maximum jump scope of short redirect, obtain redirect function information table; Wherein, redirect letterNumber information table comprises the each redirect in the multiple redirect functions that insert in the code of program to be repaired in advanceThe address of function and service condition; The address of the each redirect function comprising according to redirect function information tableAnd service condition, from redirect function information table, determine at least one the redirect letter in unused stateNumber; Wherein, at least one redirect function at least comprises the first redirect function; The first redirect function with by patchDistance between function is not more than the maximum jump scope of short redirect; According at least one redirect letter of determiningNumber, generates redirect passage; Wherein, redirect passage is taking the first redirect function as initial redirect function, and redirect is logicalRoad finally jumps to patch function; Before by patch function, add the first short redirect function, wherein, first is shortRedirect function is used for from jumped to the first redirect function of redirect passage by patch function, and then by redirectChannel hop is to patch function. Owing to being greater than short jumping definite by the distance between patch function and patch functionThe maximum jump scope turning, has set up the redirect passage that can jump to patch function in advance, afterwards by theOne short redirect function, from directly being jumped to redirect passage by patch function, so, has been avoided in prior artThe program interrupt and the system failure that are produced when being reoriented to patch function by patch function by long jumpProblem.
Detailed description of the invention
In order to make object of the present invention, technical scheme and beneficial effect clearer, below in conjunction with accompanying drawingAnd embodiment, the present invention is further elaborated. Should be appreciated that concrete enforcement described hereinExample only, in order to explain the present invention, is not intended to limit the present invention.
The first redirect function, the second redirect function in the embodiment of the present invention, be redirect function, can be shortRedirect function also can be long jump function, and the first short redirect function is short redirect function, wherein first,Two objects for distinguishing only.
Fig. 1 illustrates the schematic flow sheet of a kind of hot patch method that the embodiment of the present invention provides.
As shown in Figure 1, a kind of hot patch method that the embodiment of the present invention provides, comprising:
Step 101, determine in the code of program to be repaired by the distance between patch function and patch functionWhen being greater than the maximum jump scope of short redirect, obtain redirect function information table; Wherein, redirect function informationTable comprises each redirect function in the multiple redirect functions that insert in the code of program to be repaired in advanceAddress and service condition;
Step 102, the address of the each redirect function comprising according to redirect function information table and use feelingsCondition is determined at least one the redirect function in unused state from redirect function information table; Wherein,At least one redirect function at least comprises the first redirect function; The first redirect function and by between patch functionDistance is not more than the maximum jump scope of short redirect;
Step 103, according at least one redirect function of determining, generates redirect passage; Wherein, redirectPassage is taking the first redirect function as initial redirect function, and redirect passage finally jumps to patch function;
Step 104 is added the first short redirect function before by patch function, wherein, and the first short redirect functionBe used for from jumped to the first redirect function of redirect passage by patch function, and then by redirect channel hopTo patch function.
Owing to determining the maximum jump model that is greater than short redirect by the distance between patch function and patch functionEnclose, set up in advance the redirect passage that can jump to patch function, afterwards by the first short redirect function fromDirectly jumped to redirect passage by patch function, so, avoided in prior art by long jump from quiltThe program interrupt that patch function produces while being reoriented to patch function and the problem of the system failure.
Alternatively, in the embodiment of the present invention, before obtaining redirect function information table, also comprise:
In the code of program to be repaired, determine multiple location points; Enter by the link script for the treatment of repair procedureRow amendment, the each location point in multiple location points inserts multiple redirect functions; Unified extraction journey to be repairedFunction name, address and the use feelings of the each redirect function in all redirect functions that insert in the code of orderCondition, generates redirect function information table. Visible, in the embodiment of the present invention, without expansion compiler, only utilizeThe link script of compiler self, realize easier, the cost that has reduced exploitation and safeguarded.
Alternatively, multiple redirect functions that any location point in multiple location points inserts are short redirect functionAnd/or long jump function; If multiple redirect functions that a location point in multiple location points inserts are short redirectFunction, the shared position model of at least one redirect function in multiple redirect functions that this location point insertsEnclosing is a position range that long jump function is shared.
Give an example, such as determined three location points in the code segment of program to be repaired, in first positionThe multiple redirect functions that insert in putting are a little short redirect function, multiple jumpings of inserting in second location pointTurn function and be long jump function, the multiple redirect functions that insert in the 3rd location point comprise the short of partThe long jump function of redirect function and part. Preferably, the multiple redirect letters that insert in first location pointWhen number is short redirect function, for the later stage is convenient, the short redirect function inserting in first location point is changedFor long jump function, at least one the redirect function in multiple redirect functions that this location point inserts is sharedPosition range is a position range that long jump function is shared, that is to say, should be short at least oneThe position of redirect function reserves the position that this short redirect function can be revised as to long jump function, so thatLater stage need to be determined at primary importance point place a short redirect function can revising long jump function.
Specifically, a redirect function has been used, and now the service condition of this redirect function is this redirectFunction is in use state; When this redirect function is not used, now the service condition of this redirect function is for being somebody's turn to doRedirect function is in unused state. The address of redirect function is the chain of this redirect function in this program to be repairedSpecific address information in pin basis, can find this redirect function by this address. If in use procedureThe middle function name by a redirect function is revised, should be in redirect function information table, by this jumpingThe function name that turns function is also modified.
Alternatively, the distance between two the adjacent location points in multiple location points is not more than short redirectLarge jump range; Or all codes that the each location point in multiple location points is arranged in program to be repaired wrapPosition in the middle of adjacent two sections of codes of drawing together.
Specifically, the file of code corresponding to program to be repaired before not forming image file is called linkScript, link script comprises multistage code segment, can be in advance at connected two sections of code segments in the embodiment of the present inventionBetween insert multiple redirect functions.
Preferably, from the original position of the code of program to be repaired, insert many every first apart from lengthIndividual redirect function, first is not more than the maximum jump scope of short redirect apart from length, so, no matter to be repairedWhich part in the code of program need to be carried out hot patch, all can be true near this that need to carry out hot patchMake the first redirect function, the first redirect function and need to carry out hot patch by the distance between patch functionBe not more than the maximum jump scope of short redirect.
Another kind alternatively embodiment is to determine several positions in the link script of program to be repairedPoint, these several location points are the position that possible need to carry out hot patch in the future, in these several positions of determiningNear point, insert multiple redirect functions, so, the location point needs in several location points that this is determinedWhile carrying out hot patch, can determine the first redirect function near this that need to carry out hot patch, first jumpsThe distance by between patch function that turns function and need to carry out hot patch is not more than the maximum jump of short redirectScope.
Alternatively, in above-mentioned steps 101, definite little by the distance between patch function and patch functionIn the time of the maximum jump scope of short redirect, before by patch function, add the second short redirect function, wherein,Two short redirect functions are used for from being jumped to patch function by patch function. Specifically, before by patch functionAdd the second short redirect function by the mode of revising or increase, so, when program moves to by patch letterWhen number, carry out the second short redirect function, again because the second short redirect function jumps to patch function, therefore,Program jumps to patch function, and moves patch function, and after patch function operation finishes, quilt is returned in redirectThe ending of patch function, needs operation badly by the code after patch function.
Above-mentioned steps 103 comprises multiple implementation, and following two kinds of concrete realities are provided in the embodiment of the present inventionExecute mode.
In following manner one and mode two, need to judge whether at least one redirect function meets first condition, optionalGround, first condition is: when the first redirect function and N the second redirect function is short redirect function, for shortTotal time of implementation of the first redirect function of redirect function and N the second redirect function is long no longer than oneThe time of implementation of redirect function. Now, be not short jumping by the first redirect function and N redirect function setupTurning function, is only to judge in the time that individual the second redirect function of the first redirect function and N is short redirect function,For total time of implementation of the first redirect function of short redirect function and N the second redirect function whether not longIn the time of implementation of a long jump function, after finishing, judgement by judged result output, judging at least oneWhether redirect function meets in the step of first condition, can't be to the first redirect function and each the second redirect of NThe function name of function is carried out actual change.
In another kind of optional embodiment, can judge whether N is greater than threshold value, because N is not more than thresholdValue, when the first redirect function and N the second redirect function is short redirect function, for short redirect functionTotal time of implementation of the first redirect function and N the second redirect function is longer than a long jump letter scarcelyThe time of implementation of number. Therefore, first condition also can be, and N is not more than threshold value.
Mode one, if determine, at least one redirect function meets first condition, at definite the first redirect functionWhile not being short redirect function, be short redirect function by the first redirect function setup; In definite at least one redirectWhen in the N also comprising in function the second redirect function, any second redirect function is not short redirect function,Be short redirect function by the second redirect function setup that is not short redirect function; If determine the first redirect function andN the second redirect function is all short redirect functions, without operating.
The the first redirect function that is short redirect function that basis is determined afterwards and N the 3rd redirect function,Generate by the first redirect function and N the redirect passage that the 3rd redirect function forms; Wherein, in redirect passageLast second redirect function jump to patch function.
Alternatively, according to the first redirect function that is short redirect function of determining and N the second redirect letterNumber, after generating the redirect passage being made up of the first redirect function and individual the second redirect function of N, from redirect letterIn number information table, the function name of the first redirect function and N the second redirect function is changed to short redirect functionFunction name; From redirect function information table, by the use of the first redirect function and N the second redirect functionSituation is designated the state that uses.
Specifically, in a kind of embodiment, N is zero, now, and first according to each in redirect function information tableThe address of individual redirect function, and service condition, determine the first redirect function, now, and the first redirect letterNumber is in unused state, and the first redirect function and be not more than short redirect by the distance between patch functionMaximum jump scope, the distance between the first redirect function and patch function is not more than the maximum jump of short redirectScope. Be in redirect passage, only to comprise a first redirect function. Now in the code of program to be repairedLoad patch function, and the first redirect function is modified, so that amended the first redirect function redirectTo patch function. After redirect passage and patch function connect, before by patch function, add firstShort redirect function, wherein, the first short redirect function is for from being jumped to the of redirect passage by patch functionOne redirect function, so by redirect channel hop to patch function.
In another kind of embodiment, N is non-vanishing, now, and first according to each redirect in redirect function information tableThe address of function, and service condition, determine the first redirect function and N the second redirect function, now,The first redirect function and N the second redirect function is all in unused state. The first redirect function and NThe second redirect function is according to a sequence of positional information composition, at the first redirect function and N the second redirect letterIn (N+1) individual redirect function that array becomes, the distance on position between adjacent two redirect functions is littleIn the maximum jump scope of short redirect, so two adjacent short redirect functions can be realized redirect. By firstRedirect function and N the second redirect function composition redirect passage, now the first redirect function is redirect passageFirst short redirect function, last the second redirect function in redirect passage need to jump to patch letterNumber. And due to the first redirect function and be not more than the maximum jump model of short redirect by the distance between patch functionEnclose, after redirect passage and patch function connect, before by patch function, add the first short redirect letterNumber, wherein, the first short redirect function is used for from jumped to the first redirect letter of redirect passage by patch functionNumber, so by redirect channel hop to patch function.
Mode two, if determine, at least one redirect function does not meet first condition, at definite the first redirect letterWhen number is not long jump function, be long jump function by the first redirect function setup; At definite the first redirect letterWhen number is long jump function, do not operate.
According to the first redirect function that is set to long jump function, generation is made up of the first redirect function afterwardsRedirect passage; The the first redirect function that is set to long jump function in redirect passage jumps to patch function.
Alternatively, according to the first redirect function that is set to long jump function, generate by the first redirect group of functionsAfter the redirect passage becoming, from redirect function information table, the function name of the first redirect function is changed to lengthThe function name of redirect function; From redirect function information table, the service condition of the first redirect function is designatedUse state.
So, total time of implementation of stating the first redirect function and N the second redirect function be longer than one longThe time of implementation of redirect function, the first redirect function is revised as to long jump function, and by the first redirect letterNumber connects with patch function, and redirect passage only comprises the first redirect function, redirect passage and patchFunction connects, and so, can save program runtime.
Fig. 2 illustrates the schematic flow sheet of the another kind of hot patch method that the embodiment of the present invention provides.
Introduce said method flow process for more clear, another kind of hot patch method is provided in the embodiment of the present inventionStep, as shown in Figure 2, comprising:
Step 201, the in advance each location point in the multiple location points in the link script of program to be repairedInsert multiple redirect functions, wherein, the distance between every adjacent two location points is not more than the maximum of short redirectJump range;
Step 202, unified each jumping of extracting in all redirect functions that insert in the code of program to be repairedTurn function name, address and the service condition of function, generate redirect function information table;
Step 203 loads patch function in the code of program to be repaired;
Step 204, judge in the code of program to be repaired by the distance between patch function and patch functionWhether be greater than the maximum jump scope of short redirect, if not, perform step 205; If so, carry out stepRapid 206;
Step 205 is added the second short redirect function before by patch function, wherein, and the second short redirect functionBe used for from being jumped to patch function by patch function;
Step 206, the address of the each redirect function comprising according to redirect function information table and use feelingsCondition is determined at least one the redirect function in unused state, Qi Zhongzhi from redirect function information tableA few redirect function at least comprises the first redirect function;
Step 207, judges whether at least one redirect function meets first condition, if so, performs step208; If not, perform step 209;
Step 208, the first function at least one redirect function being comprised and N the second function all establishedBe set to short redirect function, and generate redirect passage, redirect passage is initial from the first redirect function, passes through NIndividual the second redirect function jumps to patch function; Before by patch function, add the first short redirect function, wherein,The first short redirect function is used for from jumped to the first redirect function of redirect passage, Jin Ertong by patch functionCross redirect channel hop to patch function;
Step 209, is long jump function by the first redirect function setup, and the first redirect function is jumped toPatch function; Before by patch function, add the first short redirect function, wherein, the first short redirect function is used forFrom jumped to the first redirect function redirect passage by patch function, and then extremely mend by redirect channel hopFourth function;
Step 210, operation patch function.
It can be seen from the above: determine in the code of program to be repaired by patch function and patch letterWhen distance between number is greater than the maximum jump scope of short redirect, obtain redirect function information table; Wherein, jumpTurn function information table and comprise each in the multiple redirect functions that insert in advance in the code of program to be repairedThe address of redirect function and service condition; The each redirect function comprising according to redirect function information tableAddress and service condition are determined at least one jumping in unused state from redirect function information tableTurn function; Wherein, at least one redirect function at least comprises the first redirect function; The first redirect function and quiltDistance between patch function is not more than the maximum jump scope of short redirect; According at least one jumping of determiningTurn function, generate redirect passage; Wherein, redirect passage, taking the first redirect function as initial redirect function, is jumpedTurn passage and finally jump to patch function; Before by patch function, add the first short redirect function, wherein, theOne short redirect function is used for from jumped to the first redirect function of redirect passage by patch function, and then passes throughRedirect channel hop is to patch function. Owing to being greater than by the distance between patch function and patch function definiteThe maximum jump scope of short redirect, has set up the redirect passage that can jump to patch function, Zhi Houtong in advanceCross the first short redirect function from directly being jumped to redirect passage by patch function, so, avoided existing skillThe program interrupt and the system that in art, are produced when being reoriented to patch function by patch function by long jumpThe problem of fault.
Fig. 3 illustrates the structural representation of a kind of hot patch equipment that the embodiment of the present invention provides.
Based on same idea, the embodiment of the present invention provides a kind of hot patch equipment 300, as shown in Figure 3, and bagDraw together acquiring unit 301, determining unit 302, generation unit 303, processing unit 304, alternatively, also bagDraw together extracting unit 305:
Acquiring unit, for determine program to be repaired code by patch function and patch function betweenDistance while being greater than the maximum jump scope of short redirect, obtain redirect function information table; Wherein, redirect functionInformation table comprises the each redirect letter in the multiple redirect functions that insert in the code of program to be repaired in advanceAddress and the service condition of number;
Determining unit, for the address of each redirect function of comprising according to redirect function information table and makeBy situation, from redirect function information table, determine at least one the redirect function in unused state; ItsIn, at least one redirect function at least comprises the first redirect function; The first redirect function with by patch function itBetween distance be not more than the maximum jump scope of short redirect;
Generation unit, for according at least one redirect function of determining, generates redirect passage; Wherein,Redirect passage is taking the first redirect function as initial redirect function, and redirect passage finally jumps to patch function;
Processing unit, for add the first short redirect function before by patch function, wherein, the first short redirectFunction is used for from jumped to the first redirect function of redirect passage by patch function, and then by redirect passageJump to patch function.
Alternatively, generation unit, specifically for:
If determine, at least one redirect function meets first condition:
In the time that definite the first redirect function is not short redirect function, be short redirect letter by the first redirect function setupNumber;
Any second jumping in N the second redirect function also comprising in definite at least one redirect functionWhen turning function and not being short redirect function, be short redirect letter by the second redirect function setup that is not short redirect functionNumber;
According to the first redirect function that is short redirect function of determining and N the 3rd redirect function, generateBy the first redirect function and N the redirect passage that the 3rd redirect function forms; Wherein, in redirect passageA rear second redirect function jumps to patch function;
Wherein, first condition is: when the first redirect function and N the second redirect function is short redirect function,For total time of implementation of the first redirect function of short redirect function and N the second redirect function is no longer than oneThe time of implementation of individual long jump function.
Alternatively, in redirect function information table, also comprise the function name of each redirect function;
Processing unit, also for:
According to the first redirect function that is short redirect function of determining and N the second redirect function, rawAfter becoming the redirect passage being formed by the first redirect function and individual the second redirect function of N, from redirect function informationIn table, the function name of the first redirect function and N the second redirect function is changed to the function of short redirect functionName;
From redirect function information table, by the service condition mark of the first redirect function and N the second redirect functionKnow for using state.
Alternatively, generation unit, specifically for:
If determine, at least one redirect function does not meet first condition:
In the time that definite the first redirect function is not long jump function, be long jump letter by the first redirect function setupNumber;
According to the first redirect function that is set to long jump function, generate the redirect being formed by the first redirect functionPassage; The the first redirect function that is set to long jump function in redirect passage jumps to patch function.
Alternatively, in redirect function information table, also comprise the function name of each redirect function;
Processing unit, also for:
According to the first redirect function that is set to long jump function, generate the jumping being formed by the first redirect functionAfter turning passage, from redirect function information table, the function name of the first redirect function is changed to long jump letterThe function name of number;
From redirect function information table, the service condition of the first redirect function is designated to the state that uses.
Alternatively, also comprise extracting unit, for:
In the code of program to be repaired, determine multiple location points;
Modify by the link script for the treatment of repair procedure, the each location point in multiple location points is insertedEnter multiple redirect functions;
Each redirect function in all redirect functions that insert in the code of unified extraction program to be repairedFunction name, address and service condition, generate redirect function information table.
Alternatively, multiple redirect functions that any location point in multiple location points inserts are short redirect functionAnd/or long jump function;
If multiple redirect functions that a location point in multiple location points inserts are short redirect function, this positionPut the shared position range of at least one redirect function in multiple redirect functions of an insertion and be one longThe position range that redirect function is shared.
Alternatively, the distance between two the adjacent location points in multiple location points is not more than short redirectLarge jump range; Or
Each location point in multiple location points be arranged in that all codes of program to be repaired comprise adjacent twoPosition in the middle of section code.
It can be seen from the above: determine in the code of program to be repaired by patch function and patch letterWhen distance between number is greater than the maximum jump scope of short redirect, obtain redirect function information table; Wherein, jumpTurn function information table and comprise each in the multiple redirect functions that insert in advance in the code of program to be repairedThe address of redirect function and service condition; The each redirect function comprising according to redirect function information tableAddress and service condition are determined at least one jumping in unused state from redirect function information tableTurn function; Wherein, at least one redirect function at least comprises the first redirect function; The first redirect function and quiltDistance between patch function is not more than the maximum jump scope of short redirect; According at least one jumping of determiningTurn function, generate redirect passage; Wherein, redirect passage, taking the first redirect function as initial redirect function, is jumpedTurn passage and finally jump to patch function; Before by patch function, add the first short redirect function, wherein, theOne short redirect function is used for from jumped to the first redirect function of redirect passage by patch function, and then passes throughRedirect channel hop is to patch function. Owing to being greater than by the distance between patch function and patch function definiteThe maximum jump scope of short redirect, has set up the redirect passage that can jump to patch function, Zhi Houtong in advanceCross the first short redirect function from directly being jumped to redirect passage by patch function, so, avoided existing skillThe program interrupt and the system that in art, are produced when being reoriented to patch function by patch function by long jumpThe problem of fault.
Those skilled in the art should understand, embodiments of the invention can be provided as method or computer journeyOrder product. Therefore, the present invention can adopt complete hardware implementation example, complete implement software example or in conjunction with softwareForm with the embodiment of hardware aspect. And the present invention can adopt at one or more meters that wherein includeThe computer-usable storage medium of calculation machine usable program code (include but not limited to magnetic disc store,CD-ROM, optical memory etc.) form of the upper computer program of implementing.
The present invention is that reference is according to the method for the embodiment of the present invention, equipment (system) and computer program productThe flow chart of product and/or block diagram are described. Should understand can be by computer program instructions realization flow figure and/ or block diagram in each flow process and/or flow process in square frame and flow chart and/or block diagram and/Or the combination of square frame. Can provide these computer program instructions to all-purpose computer, special-purpose computer, embeddingThe processor of formula processor or other programmable data processing device, to produce a machine, makes by calculatingThe instruction that the processor of machine or other programmable data processing device is carried out produces for realizing at flow chart oneThe device of the function of specifying in square frame of individual flow process or multiple flow process and/or block diagram or multiple square frame.
These computer program instructions also can be stored in energy vectoring computer or other programmable data processing are establishedIn the standby computer-readable memory with ad hoc fashion work, make to be stored in this computer-readable memoryInstruction produce and comprise the manufacture of command device, this command device is realized in flow process or multiple of flow chartThe function of specifying in square frame of flow process and/or block diagram or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, makeMust on computer or other programmable devices, carry out sequence of operations step to produce computer implemented placeReason, thus the instruction of carrying out on computer or other programmable devices is provided for realizing one of flow chartThe step of the function of specifying in square frame of flow process or multiple flow process and/or block diagram or multiple square frame.
Although described the preferred embodiments of the present invention, once those skilled in the art obtain cicada baseThis creative concept, can make other change and amendment to these embodiment. So appended right is wantedAsk and be intended to be interpreted as comprising preferred embodiment and fall into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification and not depart from this present inventionBright spirit and scope. Like this, if of the present invention these amendment and modification belong to the claims in the present invention andWithin the scope of its equivalent technologies, the present invention be also intended to comprise these change and modification interior.