CN109426501A - Storehouse self checking method and device - Google Patents
Storehouse self checking method and device Download PDFInfo
- Publication number
- CN109426501A CN109426501A CN201710500180.3A CN201710500180A CN109426501A CN 109426501 A CN109426501 A CN 109426501A CN 201710500180 A CN201710500180 A CN 201710500180A CN 109426501 A CN109426501 A CN 109426501A
- Authority
- CN
- China
- Prior art keywords
- storehouse
- value
- self
- test
- numerical value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/43—Checking; Contextual analysis
Abstract
The present invention proposes a kind of capability value of unused storehouse before storehouse self checking method and device, this method include determining when;The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first numerical value;The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein default storehouse self-test subfunction reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as second value;Based on the first numerical value and second value, self-test is carried out to storehouse in program operation process.It can be realized through the invention and carry out storehouse self-test in real time in program operation process, avoid stack region failure.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of storehouse self checking methods and device.
Background technique
It in the related technology, is to increase the subfunction for being used for storehouse self-test, in the son of storehouse self-test when program starts
The local variable array of fixed size is defined in function, local variable array size is 10 times or 10 times or more of program operation,
Hexadecimal AA, 55, CC equivalence are write to local variable, then, which is read, if not equal to the value of write-in, then it is assumed that storehouse
Area fault.Under this mode, the occupied storehouse size of program actual motion is difficult to estimate, and, the size of stack region is past
Toward 10 times or 10 or more of stack region size occupied when will not be run equal to or more than program, it is possible to cause stack region
It overflows.
Summary of the invention
The present invention is directed to solve at least some of the technical problems in related technologies.
For this purpose, can be realized an object of the present invention is to provide a kind of storehouse self checking method in program operation process
In carry out storehouse self-test in real time, avoid stack region failure.
It is another object of the present invention to propose a kind of storehouse self-checking unit.
It is another object of the present invention to propose a kind of non-transitorycomputer readable storage medium.
It is another object of the present invention to propose a kind of computer program product.
In order to achieve the above objectives, the storehouse self checking method that first aspect present invention embodiment proposes, comprising: determine currently not
Use the capability value of storehouse;The local variable that numerical value is equal to the capability value is defined, and by the current of a local variable
Numerical value is as the first numerical value;The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein described default
Storehouse self-test subfunction reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as the second number
Value;Based on first numerical value and the second value, self-test is carried out to the storehouse in described program operational process.
The storehouse self checking method that first aspect present invention embodiment proposes, by the capacity for determining current unused storehouse
Value;The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first numerical value;Control journey
The principal function of sequence calls default storehouse self-test subfunction to carry out self-test, wherein default storehouse self-test subfunction is in the process of implementation
The numerical value of a local variable is read, and using obtained numerical value as second value;Based on the first numerical value and second value, in program
Self-test is carried out to storehouse in operational process, the capability value since storehouse is currently not used is the calling with subfunction and becomes in real time
Change, it is thereby achieved that carrying out storehouse self-test in real time in program operation process, avoids stack region failure.
In order to achieve the above objectives, the storehouse self-checking unit that second aspect of the present invention embodiment proposes, comprising: determining module,
For determining the capability value of current unused storehouse;Definition module becomes for defining numerical value equal to a part of the capability value
Amount, and using the current value of a local variable as the first numerical value;Control module, the principal function for controlling program are called
Default storehouse self-test subfunction carries out self-test, wherein the default storehouse self-test subfunction reads described one in the process of implementation
The numerical value of local variable, and using obtained numerical value as second value;Selftest module, for based on first numerical value and described
Second value carries out self-test to the storehouse in described program operational process.
The storehouse self-checking unit that second aspect of the present invention embodiment proposes, by the capacity for determining current unused storehouse
Value;The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first numerical value;Control journey
The principal function of sequence calls default storehouse self-test subfunction to carry out self-test, wherein default storehouse self-test subfunction is in the process of implementation
The numerical value of a local variable is read, and using obtained numerical value as second value;Based on the first numerical value and second value, in program
Self-test is carried out to storehouse in operational process, the capability value since storehouse is currently not used is the calling with subfunction and becomes in real time
Change, it is thereby achieved that carrying out storehouse self-test in real time in program operation process, avoids stack region failure.
In order to achieve the above object, third aspect present invention embodiment proposes another storehouse self-checking unit, comprising: processing
Device;For storing the memory of the processor-executable instruction;Wherein, the processor is configured to: determination do not make currently
With the capability value of storehouse;The local variable that numerical value is equal to the capability value is defined, and by the current number of a local variable
Value is used as the first numerical value;The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein the default heap
Stack self-test subfunction reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as second value;
Based on first numerical value and the second value, self-test is carried out to the storehouse in described program operational process.
The storehouse self-checking unit that third aspect present invention embodiment proposes, by the capacity for determining current unused storehouse
Value;The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first numerical value;Control journey
The principal function of sequence calls default storehouse self-test subfunction to carry out self-test, wherein default storehouse self-test subfunction is in the process of implementation
The numerical value of a local variable is read, and using obtained numerical value as second value;Based on the first numerical value and second value, in program
Self-test is carried out to storehouse in operational process, the capability value since storehouse is currently not used is the calling with subfunction and becomes in real time
Change, it is thereby achieved that carrying out storehouse self-test in real time in program operation process, avoids stack region failure.
To achieve the goals above, fourth aspect present invention embodiment proposes a kind of computer-readable storage of non-transitory
Medium, when the instruction in the storage medium is performed by the processor of server end, so that server end is able to carry out one
Kind storehouse self checking method, which comprises determine the capability value of current unused storehouse;It defines numerical value and is equal to the capability value
A local variable, and using the current value of a local variable as the first numerical value;The principal function for controlling program is called in advance
If storehouse self-test subfunction carries out self-test, wherein the default storehouse self-test subfunction is read described one innings in the process of implementation
The numerical value of portion's variable, and using obtained numerical value as second value;Based on first numerical value and the second value, described
Self-test is carried out to the storehouse in program operation process.
The non-transitorycomputer readable storage medium that fourth aspect present invention embodiment proposes is not made currently by determination
With the capability value of storehouse;The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the
One numerical value;The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein default storehouse self-test subfunction
The numerical value of a local variable is read in the process of implementation, and using obtained numerical value as second value;Based on the first numerical value and
Two numerical value carry out self-test to storehouse in program operation process, and the capability value since storehouse is currently not used is with subfunction
Calling and real-time change, it is thereby achieved that carry out storehouse self-test in real time in program operation process, avoid stack region therefore
Barrier.
To achieve the goals above, fifth aspect present invention embodiment proposes a kind of computer program product, when described
When instruction processing unit in computer program product executes, a kind of storehouse self checking method is executed, which comprises determine current
The capability value of storehouse is not used;Define the local variable that numerical value is equal to the capability value, and working as a local variable
Preceding numerical value is as the first numerical value;The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein described pre-
If storehouse self-test subfunction reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as the second number
Value;Based on first numerical value and the second value, self-test is carried out to the storehouse in described program operational process.
The computer program product that fifth aspect present invention embodiment proposes, by the capacity for determining current unused storehouse
Value;The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first numerical value;Control journey
The principal function of sequence calls default storehouse self-test subfunction to carry out self-test, wherein default storehouse self-test subfunction is in the process of implementation
The numerical value of a local variable is read, and using obtained numerical value as second value;Based on the first numerical value and second value, in program
Self-test is carried out to storehouse in operational process, the capability value since storehouse is currently not used is the calling with subfunction and becomes in real time
Change, it is thereby achieved that carrying out storehouse self-test in real time in program operation process, avoids stack region failure.
The additional aspect of the present invention and advantage will be set forth in part in the description, and will partially become from the following description
Obviously, or practice through the invention is recognized.
Detailed description of the invention
Above-mentioned and/or additional aspect and advantage of the invention will become from the following description of the accompanying drawings of embodiments
Obviously and it is readily appreciated that, in which:
Fig. 1 is the flow diagram for the storehouse self checking method that one embodiment of the invention proposes;
Fig. 2 is the flow diagram for the storehouse self checking method that another embodiment of the present invention proposes;
Fig. 3 is the flow diagram for the storehouse self checking method that another embodiment of the present invention proposes;
Fig. 4 is the structural schematic diagram for the storehouse self-checking unit that one embodiment of the invention proposes;
Fig. 5 is the structural schematic diagram for the storehouse self-checking unit that another embodiment of the present invention proposes.
Specific embodiment
The embodiment of the present invention is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end
Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached
The embodiment of figure description is exemplary, and for explaining only the invention, and is not considered as limiting the invention.On the contrary, this
The embodiment of invention includes all changes fallen within the scope of the spiritual and intension of attached claims, modification and is equal
Object.
Fig. 1 is the flow diagram for the storehouse self checking method that one embodiment of the invention proposes.
The present embodiment is configured as illustrating in storehouse self-checking unit with the storehouse self checking method.
Storehouse self-checking unit in the present embodiment can be set in C language compiler, with no restriction to this.
It should be noted that the purposes of storehouse is mainly the calling of function under C language programmed environment, storehouse is complete
Continuous dispensing and duplicate allocation.When principal function calls subfunction, C language compiler can be automatically at the end of principal function stack area
Tail is that subfunction creates one section of continuous stack area.After group function operation, C language compiler can go back to the stack area
It receives, when principal function calls other subfunctions again, it is that subfunction distributes stack region that compiler, which can reuse the region,.
It in the related technology, is to increase the subfunction for being used for storehouse self-test, in the son of storehouse self-test when program starts
The local variable array of fixed size is defined in function, local variable array size is 10 times or 10 times or more of program operation,
Hexadecimal AA, 55, CC equivalence are write to local variable, then, which is read, if not equal to the value of write-in, then it is assumed that storehouse
Area fault.Under this mode, the occupied storehouse size of program actual motion is difficult to estimate, and, the size of stack region is past
Toward 10 times or 10 or more of stack region size occupied when will not be run equal to or more than program, it is possible to cause stack region
It overflows.
Referring to Fig. 1, this method comprises:
S11: the capability value of current unused storehouse is determined.
It, can be in program operation process, in stack region in order to avoid stack region spilling in the embodiment of the present invention
Practical not used capability value is monitored, which can be in real time, can also be carried out with predetermined period, not to this
It is restricted.
It is understood that the working principle based on storehouse, with the operation of program, the capacity of storehouse is currently not used in this
Value is dynamic change.
For example, can be carried out to scatter file real-time if the storehouse self checking method is applied in the chip of ARM framework
Or periodic parsing, obtain the capability value of currently unused storehouse.
It is possible to further when main program not yet calls other subfunctions, start determination and work as in program operation process
The capability value of preceding unused storehouse, since the consumption of storehouse capability value is the calling generation with subfunction, thus, in main journey
When sequence not yet calls other subfunctions, that is, be the capability value of the determining current unused storehouse of triggering in the initial stage, can guarantee
Self-test can be carried out to it in entire storehouse use process, ensures storehouse self-test effect.
S12: the local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first number
Value.
Wherein, based in previous step currently be not used storehouse capability value a local variable is written, in turn, by this one
Local variable is stored in the default storehouse self-test subfunction called in program operation process.
Wherein, which can be referred to as the first numerical value.
In the embodiment of the present invention, first determines the capability value of current unused storehouse, then define numerical value equal to capability value
One local variable can effectively avoid blindly reading and writing storehouse to carry out self-test to storehouse, so that stack overflow is caused, meanwhile,
Define the local variable that numerical value is equal to the capability value of current unused storehouse, the capability value since storehouse is currently not used be with
Subfunction calling and real-time change, thus, allow storehouse self checking method in program operation process in real time into
Row, to carry out real-time self-test to storehouse.
S13: the principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein default storehouse self-test
Subfunction reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as second value.
It is understood that the working principle based on storehouse, a part defined in default storehouse self-test subfunction becomes
Amount is stored in storehouse, thus, default storehouse self-test subfunction is called by the principal function of control program in the present embodiment
Self-test is carried out, the numerical value of a local variable is read, the read operation to storehouse is equivalent to.
Wherein, the numerical value of the local variable read can be referred to as second value.
Wherein, which can be specially memory self-checking algorithm function.
In an embodiment of the present invention, detect storehouse by using memory self-checking algorithm function, can by coupling fault,
The undetectable storehouse fault detections of common detecting methods such as addressing mistake come out, and effectively promote storehouse self-test effect.
S14: being based on the first numerical value and second value, carries out self-test to storehouse in program operation process.
Specifically, it can be determined that whether the first numerical value and second value are identical;If they are the same, then it sends and returns to principal function
Value, and control principal function and call the subfunction for making normal program operation;If not identical, delay machine processing directly is carried out to program.
It is understood that the working principle based on storehouse, the capability value since storehouse is currently not used is with sub- letter
Several calling and real-time change, thus, if the first numerical value is identical with second value, can be determined that it is current normally to storehouse into
Row self-test can be determined that if not identical and currently carry out fail self-test to storehouse, triggering carries out delay machine processing to program.
Made by when the first numerical value is identical with second value, sending return value to principal function, and controlling principal function and call
The subfunction of normal program operation directly carries out delay machine processing to program when not identical, ensures the whole service in program
In journey can real-time perfoming storehouse self-test, avoid storehouse failure missing inspection caused by fail self-test, further ensure storehouse self-test
Effect.
Optionally, in some embodiments, referring to fig. 2, after S14, this method can also include:
S21: in program operation process, persistently the current capability value that storehouse is not used is updated.
By being persistently updated, being ensured currently not to the current capability value that storehouse is not used in program operation process
Using the capability value of storehouse with the calling of subfunction real-time change.
In the present embodiment, by the capability value for determining current unused storehouse;Define the part that numerical value is equal to capability value
Variable, and using the current value of a local variable as the first numerical value;The principal function for controlling program calls default storehouse self-test
Function carries out self-test, wherein default storehouse self-test subfunction reads the numerical value of a local variable in the process of implementation, and will obtain
Numerical value as second value;Based on the first numerical value and second value, self-test is carried out to storehouse in program operation process, due to
The capability value of current unused storehouse is the calling with subfunction and real-time change, it is thereby achieved that in program operation process
In carry out storehouse self-test in real time, avoid stack region failure.
Fig. 3 is the flow diagram for the storehouse self checking method that another embodiment of the present invention proposes.
Storehouse self checking method in the present embodiment is for detecting stack overflow.
Referring to Fig. 3, this method comprises:
S31: the address of stack boundaries is obtained.
If the storehouse self checking method is applied in the chip of ARM framework, can to scatter file carry out in real time or
Periodically parsing, obtains the address of stack boundaries.
S32: preset value is written in the boundary bit of storehouse based on address.
Such as: the last 32bit of storehouse is written as 0x0ABCDEF0.
S33: in program operation process, the value in stack boundaries position is read with predetermined period.
Alternatively, the value in stack boundaries position can also be read in real time, with no restriction to this.
It is understood that main program is during call subroutine, part that compiler can be defined according to subprogram
Stack region is sequentially extended corresponding space by the size of variable, therefore, in program process, if holding with program
It goes, when the value in the stack boundaries position of reading is not equal to the preset value being written, then shows to generate stack overflow phenomenon.
Therefore, in an embodiment of the present invention, the value in stack boundaries position can be read with predetermined period or in real time,
To carry out overflow checking to storehouse.
S34: whether judgment value is identical as preset value, if so, executing S35, otherwise, executes S36.
S35: determine that storehouse does not generate spillover.
S36: determine that storehouse generates spillover.
In the present embodiment, by the address of acquisition stack boundaries, preset value is written in the boundary bit of storehouse based on address,
In program operation process, the value in stack boundaries position is read with predetermined period, when being worth identical as preset value, determines storehouse not
Spillover is generated, when not identical, determine that storehouse generates spillover, can be realized and stack overflow is detected, in real time
The service condition for monitoring storehouse, effectively avoids stack region from overflowing.
Fig. 4 is the structural schematic diagram for the storehouse self-checking unit that one embodiment of the invention proposes.
Referring to fig. 4, which comprises determining that module 401, definition module 402, control module 403 and self-test mould
Block 404, wherein
Determining module 401, for determining the capability value of current unused storehouse.
Definition module 402, the local variable for being equal to capability value for defining numerical value, and by the current number of a local variable
Value is used as the first numerical value.
Control module 403, the principal function for controlling program call default storehouse self-test subfunction to carry out self-test, wherein
Default storehouse self-test subfunction reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as the second number
Value.
Selftest module 404 carries out certainly storehouse in program operation process for being based on the first numerical value and second value
Inspection.
Optionally, in some embodiments, referring to Fig. 5, selftest module 404, comprising:
Judging submodule 4041, for judging whether the first numerical value and second value are identical.
Self-test submodule 4042 makes program for when identical, sending return value to principal function, and controlling principal function and call
The subfunction of normal operation then directly carries out delay machine processing to program when not identical.
Optionally, in some embodiments, referring to Fig. 5, the device 400 further include:
Module 405 is obtained, for obtaining the address of stack boundaries.
Writing module 406, for preset value to be written in the boundary bit of storehouse based on address.
Read module 407, for reading the value in stack boundaries position with predetermined period in program operation process.
Whether judgment module 408 is identical for judgment value and preset value.
Selftest module 404 is also used to when identical, determines that storehouse does not generate spillover;When not identical, storehouse is determined
Generate spillover.
Update module 409, for persistently being carried out more to the current capability value that storehouse is not used in program operation process
Newly.
Optionally, presetting storehouse self-test subfunction is memory self-checking algorithm function.
It should be noted that being also suitable in earlier figures 1- Fig. 3 embodiment to the explanation of storehouse self checking method embodiment
In the storehouse self-checking unit 400 of the embodiment, realization principle is similar, and details are not described herein again.
In the present embodiment, by the capability value for determining current unused storehouse;Define the part that numerical value is equal to capability value
Variable, and using the current value of a local variable as the first numerical value;The principal function for controlling program calls default storehouse self-test
Function carries out self-test, wherein default storehouse self-test subfunction reads the numerical value of a local variable in the process of implementation, and will obtain
Numerical value as second value;Based on the first numerical value and second value, self-test is carried out to storehouse in program operation process, due to
The capability value of current unused storehouse is the calling with subfunction and real-time change, it is thereby achieved that in program operation process
In carry out storehouse self-test in real time, avoid stack region failure.
In order to realize above-described embodiment, the present invention also proposes a kind of non-transitorycomputer readable storage medium, works as storage
When instruction in medium is executed by the processor of terminal, enable the terminal to execute a kind of storehouse self checking method, method includes:
Determine the capability value of current unused storehouse;
The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first numerical value;
The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein the default sub- letter of storehouse self-test
Number reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as second value;
Based on the first numerical value and second value, self-test is carried out to storehouse in program operation process.
Non-transitorycomputer readable storage medium in the present embodiment, by the capacity for determining current unused storehouse
Value;The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first numerical value;Control journey
The principal function of sequence calls default storehouse self-test subfunction to carry out self-test, wherein default storehouse self-test subfunction is in the process of implementation
The numerical value of a local variable is read, and using obtained numerical value as second value;Based on the first numerical value and second value, in program
Self-test is carried out to storehouse in operational process, the capability value since storehouse is currently not used is the calling with subfunction and becomes in real time
Change, it is thereby achieved that carrying out storehouse self-test in real time in program operation process, avoids stack region failure.
In order to realize above-described embodiment, the present invention also proposes a kind of computer program product, when in computer program product
Instruction when being executed by processor, execute a kind of storehouse self checking method, method includes:
Determine the capability value of current unused storehouse;
The local variable that numerical value is equal to capability value is defined, and using the current value of a local variable as the first numerical value;
The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein the default sub- letter of storehouse self-test
Number reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as second value;
Based on the first numerical value and second value, self-test is carried out to storehouse in program operation process.
Computer program product in the present embodiment, by the capability value for determining current unused storehouse;Define numerical value etc.
In a local variable of capability value, and using the current value of a local variable as the first numerical value;Control the principal function tune of program
Self-test is carried out with default storehouse self-test subfunction, wherein default storehouse self-test subfunction reads a part in the process of implementation and becomes
The numerical value of amount, and using obtained numerical value as second value;It is right in program operation process based on the first numerical value and second value
Storehouse carries out self-test, and the capability value since storehouse is currently not used is calling with subfunction and real-time change, thus, it is real
Storehouse self-test is carried out in real time in present program operation process, avoids stack region failure.
It should be noted that in the description of the present invention, term " first ", " second " etc. are used for description purposes only, without
It can be interpreted as indication or suggestion relative importance.In addition, in the description of the present invention, unless otherwise indicated, the meaning of " multiple "
It is two or more.
Any process described otherwise above or method description are construed as in flow chart or herein, and expression includes
It is one or more for realizing specific logical function or process the step of executable instruction code module, segment or portion
Point, and the range of the preferred embodiment of the present invention includes other realization, wherein can not press shown or discussed suitable
Sequence, including according to related function by it is basic simultaneously in the way of or in the opposite order, Lai Zhihang function, this should be of the invention
Embodiment person of ordinary skill in the field understood.
It should be appreciated that each section of the invention can be realized with hardware, software, firmware or their combination.Above-mentioned
In embodiment, software that multiple steps or method can be executed in memory and by suitable instruction execution system with storage
Or firmware is realized.It, and in another embodiment, can be under well known in the art for example, if realized with hardware
Any one of column technology or their combination are realized: having a logic gates for realizing logic function to data-signal
Discrete logic, with suitable combinational logic gate circuit specific integrated circuit, programmable gate array (PGA), scene
Programmable gate array (FPGA) etc..
Those skilled in the art are understood that realize all or part of step that above-described embodiment method carries
It suddenly is that relevant hardware can be instructed to complete by program, the program can store in a kind of computer-readable storage medium
In matter, which when being executed, includes the steps that one or a combination set of embodiment of the method.
It, can also be in addition, each functional unit in each embodiment of the present invention can integrate in a processing module
It is that each unit physically exists alone, can also be integrated in two or more units in a module.Above-mentioned integrated mould
Block both can take the form of hardware realization, can also be realized in the form of software function module.The integrated module is such as
Fruit is realized and when sold or used as an independent product in the form of software function module, also can store in a computer
In read/write memory medium.
Storage medium mentioned above can be read-only memory, disk or CD etc..
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show
The description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or example
Point is included at least one embodiment or example of the invention.In the present specification, schematic expression of the above terms are not
Centainly refer to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be any
One or more embodiment or examples in can be combined in any suitable manner.
Although the embodiments of the present invention has been shown and described above, it is to be understood that above-described embodiment is example
Property, it is not considered as limiting the invention, those skilled in the art within the scope of the invention can be to above-mentioned
Embodiment is changed, modifies, replacement and variant.
Claims (14)
1. a kind of storehouse self checking method, which comprises the following steps:
Determine the capability value of current unused storehouse;
The local variable that numerical value is equal to the capability value is defined, and using the current value of a local variable as the first number
Value;
The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein the default sub- letter of storehouse self-test
Number reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as second value;
Based on first numerical value and the second value, self-test is carried out to the storehouse in described program operational process.
2. storehouse self checking method as described in claim 1, which is characterized in that described to be based on first numerical value and described second
Numerical value carries out self-test to the storehouse in described program operational process, comprising:
Judge whether first numerical value and the second value are identical;
If they are the same, then return value is sent to the principal function, and controlling the principal function calling operates normally described program
Subfunction;
If not identical, delay machine processing directly is carried out to described program.
3. storehouse self checking method as described in claim 1, which is characterized in that the capacity of storehouse is currently not used in the determination
Before value, further includes:
Obtain the address of the stack boundaries;
Preset value is written in the boundary bit of the storehouse based on the address.
4. storehouse self checking method as claimed in claim 3, which is characterized in that further include:
In described program operational process, the value in the stack boundaries position is read with predetermined period;
Judge whether described value is identical as the preset value;
If they are the same, then determine that the storehouse does not generate spillover;
If not identical, determine that the storehouse generates the spillover.
5. storehouse self checking method as described in claim 1, which is characterized in that further include:
In described program operational process, persistently the capability value of the current unused storehouse is updated.
6. storehouse self checking method as described in any one in claim 1-5, which is characterized in that the default storehouse self-test subfunction
For memory self-checking algorithm function.
7. a kind of storehouse self-checking unit characterized by comprising
Determining module, for determining the capability value of current unused storehouse;
Definition module, the local variable for being equal to the capability value for defining numerical value, and by the current of a local variable
Numerical value is as the first numerical value;
Control module, the principal function for controlling program call default storehouse self-test subfunction to carry out self-test, wherein described default
Storehouse self-test subfunction reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as the second number
Value;
Selftest module, for being based on first numerical value and the second value, to the heap in described program operational process
Stack carries out self-test.
8. storehouse self-checking unit as claimed in claim 7, which is characterized in that the selftest module, comprising:
Judging submodule, for judging whether first numerical value and the second value are identical;
Self-test submodule, for when identical, Xiang Suoshu principal function sends return value, and control the principal function calling make it is described
The subfunction of normal program operation then directly carries out delay machine processing to described program when not identical.
9. storehouse self-checking unit as claimed in claim 7, which is characterized in that further include:
Module is obtained, for obtaining the address of the stack boundaries;
Writing module, for preset value to be written in the boundary bit of the storehouse based on the address.
10. storehouse self-checking unit as claimed in claim 9, which is characterized in that further include:
Read module, for reading the value in the stack boundaries position with predetermined period in described program operational process;
Judgment module, for judging whether described value is identical as the preset value;
The selftest module is also used to when identical, determines that the storehouse does not generate spillover;When not identical, institute is determined
It states storehouse and generates the spillover.
11. storehouse self-checking unit as claimed in claim 7, which is characterized in that further include:
Update module, for persistently being carried out more to the capability value of the current unused storehouse in described program operational process
Newly.
12. such as the described in any item storehouse self-checking units of claim 7-11, which is characterized in that the default sub- letter of storehouse self-test
Number is memory self-checking algorithm function.
13. a kind of non-transitorycomputer readable storage medium, is stored thereon with computer program, which is characterized in that the program
Such as storehouse self checking method of any of claims 1-6 is realized when being executed by processor.
14. a kind of computer program product executes one kind when the instruction in the computer program product is executed by processor
Storehouse self checking method, which comprises
Determine the capability value of current unused storehouse;
The local variable that numerical value is equal to the capability value is defined, and using the current value of a local variable as the first number
Value;
The principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein the default sub- letter of storehouse self-test
Number reads the numerical value of a local variable in the process of implementation, and using obtained numerical value as second value;
Based on first numerical value and the second value, self-test is carried out to the storehouse in described program operational process.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710500180.3A CN109426501A (en) | 2017-06-27 | 2017-06-27 | Storehouse self checking method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710500180.3A CN109426501A (en) | 2017-06-27 | 2017-06-27 | Storehouse self checking method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109426501A true CN109426501A (en) | 2019-03-05 |
Family
ID=65497153
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710500180.3A Pending CN109426501A (en) | 2017-06-27 | 2017-06-27 | Storehouse self checking method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109426501A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114048465A (en) * | 2022-01-14 | 2022-02-15 | 苏州浪潮智能科技有限公司 | Stack state detection method, device, equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1818822A (en) * | 2005-02-07 | 2006-08-16 | 福建东方微点信息安全有限责任公司 | Buffer field overflow attack detection |
CN104572448A (en) * | 2014-12-23 | 2015-04-29 | 大唐移动通信设备有限公司 | Method and device for realizing use condition of thread stack |
CN105094991A (en) * | 2015-08-21 | 2015-11-25 | 北京经纬恒润科技有限公司 | Stack capacity setting method and system |
CN106547606A (en) * | 2016-10-25 | 2017-03-29 | 交控科技股份有限公司 | Storehouse self checking method and device |
WO2017066183A1 (en) * | 2015-10-11 | 2017-04-20 | Renesas Electronics America Inc. | Software architecture for embedded systems |
-
2017
- 2017-06-27 CN CN201710500180.3A patent/CN109426501A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1818822A (en) * | 2005-02-07 | 2006-08-16 | 福建东方微点信息安全有限责任公司 | Buffer field overflow attack detection |
CN104572448A (en) * | 2014-12-23 | 2015-04-29 | 大唐移动通信设备有限公司 | Method and device for realizing use condition of thread stack |
CN105094991A (en) * | 2015-08-21 | 2015-11-25 | 北京经纬恒润科技有限公司 | Stack capacity setting method and system |
WO2017066183A1 (en) * | 2015-10-11 | 2017-04-20 | Renesas Electronics America Inc. | Software architecture for embedded systems |
CN106547606A (en) * | 2016-10-25 | 2017-03-29 | 交控科技股份有限公司 | Storehouse self checking method and device |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114048465A (en) * | 2022-01-14 | 2022-02-15 | 苏州浪潮智能科技有限公司 | Stack state detection method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8245012B2 (en) | Adaptively preventing out of memory conditions | |
US9678867B2 (en) | Method for changing the software in the memory of an electronic control unit | |
CN110780811B (en) | Data protection method, device and storage medium | |
US8108862B2 (en) | Out-of-order thread scheduling based on processor idle time thresholds | |
CN106874103B (en) | Heartbeat implementation method and device | |
CN105045641B (en) | Method and device for starting interface of component | |
CN101515242B (en) | Method and system for searching and rewriting the task of internal memory | |
CN109426501A (en) | Storehouse self checking method and device | |
US8671248B2 (en) | Architecture support of memory access coloring | |
CN110351313A (en) | Data cache method, device, equipment and storage medium | |
KR102615806B1 (en) | Memory system and method of wear-leveling in the memory system | |
CN105556402A (en) | Method for manipulating a control program of a control device | |
CN112199240A (en) | Method for switching nodes during node failure and related equipment | |
US9658909B2 (en) | Information processing apparatus, information processing method, and information processing program | |
US10430344B2 (en) | Memory resource management method and apparatus | |
US9778969B2 (en) | Automatic memory leak detection | |
CN106547606B (en) | Storehouse self checking method and device | |
US20180232303A1 (en) | Method and Apparatus for Controlling a Non-Volatile Digital Information Memory | |
CN112559565A (en) | Abnormity detection method, system and device | |
CN116319841A (en) | Distributed storage dynamic capacity expansion method and device and electronic equipment | |
CN116126832A (en) | Database switching method, switching device, electronic equipment and storage medium | |
CN110908824A (en) | Fault identification method, device and equipment | |
CN105677487A (en) | Method and device for controlling resource occupancy | |
US9996318B2 (en) | FIFO memory having a memory region modifiable during operation | |
CN102270181B (en) | Memory access method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190305 |
|
RJ01 | Rejection of invention patent application after publication |