CN106547606B - Storehouse self checking method and device - Google Patents

Storehouse self checking method and device Download PDF

Info

Publication number
CN106547606B
CN106547606B CN201610942165.XA CN201610942165A CN106547606B CN 106547606 B CN106547606 B CN 106547606B CN 201610942165 A CN201610942165 A CN 201610942165A CN 106547606 B CN106547606 B CN 106547606B
Authority
CN
China
Prior art keywords
test
subfunction
self
default
storehouse
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610942165.XA
Other languages
Chinese (zh)
Other versions
CN106547606A (en
Inventor
王伟
郜春海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Traffic Control Technology TCT Co Ltd
Original Assignee
Traffic Control Technology TCT Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Traffic Control Technology TCT Co Ltd filed Critical Traffic Control Technology TCT Co Ltd
Priority to CN201610942165.XA priority Critical patent/CN106547606B/en
Publication of CN106547606A publication Critical patent/CN106547606A/en
Application granted granted Critical
Publication of CN106547606B publication Critical patent/CN106547606B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention provides a kind of storehouse self checking method and device, wherein, the described method includes: in program starting, the principal function for controlling program calls default storehouse self-test subfunction to carry out self-test, wherein, default storehouse self-test subfunction defines the value of all local variables in the local variable array and the local variable array of default size, and the default size is much larger than the size of used storehouse when the subfunction for operating normally described program is called;After default storehouse self-test subfunction sends return value to principal function, control principal function calls the subfunction for operating normally described program, and compiler is that the subfunction for operating normally described program distributes the default used stack region of storehouse self-test subfunction;It is obstructed out-of-date in default storehouse self-test subfunction self-test, program is in idle loop dead state, is not returned again to.The present invention can carry out effectively and rapidly self-test to C language storehouse, and will not influence system reliability of operation, improve program operational efficiency.

Description

Storehouse self checking method and device
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
The crucial control equipment used under the environment such as rail traffic, nuclear power, aircraft needs to meet the requirement of SIL4 security level, According to standard requirements such as IEC 61508, EN50129, the product for meeting the requirement of SIL4 security level is needed to using in the equipment The used memory of processor carry out self-test.
Under C language translation and compiling environment, the memory that processor uses mainly includes following several spaces: (1) stack area (stack), for store the parameter value of function, local variable, critical registers region;(2) heap area (heap), generally by journey Sequence person according to use voluntarily distribute, discharge;(3) static zones (static), for storing the region of global variable and static variable; (4) literal constant area, for storing constant character string etc.;(5) program code area, for storing the binary code of function body. Wherein, when stack area is that C language calls function, need to save principal function critical registers, local variable, load transfer function coefficient value Region, the correctness which executes function is most important, but the region be by compiler automatic identification, distribution, Programmer is difficult to operate the region.
Currently, for stack region self-test there are two types of mode:
The first be system during initialization, self-test is carried out to entire region of memory using assembler language, self-test is complete Cheng Hou restarts C language principal function.This method can effectively detect all memories, but only hold in initialization Row is primary, and the storehouse failure problems occurred during program long-play can not be detected effectively.
Second is in C programmer normal course of operation, exclusively with a storehouse self-test function to stack region Self-test is carried out, which moves heap area for all variables of stack region, carries out self-test to stack region After, the data of former stack region are being moved back into former stack region.Although this method may be implemented real-time self-test, but the heap Stack self-test function needs to write using assembler language, in the storehouse self-test function implementation procedure, needs to close all interruptions, Influence whether system reliability of operation.
In consideration of it, how to carry out effective self-test to C language storehouse, and it will not influence system reliability of operation as mesh The preceding technical issues that need to address.
Summary of the invention
In order to solve the above technical problems, the present invention provides a kind of storehouse self checking method and device, can be to C language storehouse Effectively and rapidly self-test is carried out, and will not influence system reliability of operation, improves program operational efficiency.
In a first aspect, the present invention provides a kind of storehouse self checking method, comprising:
In program starting, the principal function for controlling described program calls default storehouse self-test subfunction to carry out self-test, wherein The default storehouse self-test subfunction defines all offices in the local variable array and the local variable array of default size The value of portion's variable, the default size are much larger than used storehouse when the subfunction for operating normally described program is called Size;
After the default storehouse self-test subfunction sends return value to the principal function, controlling the principal function calling makes The subfunction that described program operates normally, compiler are that the subfunction for operating normally described program distributes the default heap The used stack region of stack self-test subfunction;
It is obstructed out-of-date in the default storehouse self-test subfunction self-test, described program is in idle loop dead state, no It returns again to.
Optionally, the method is to carry out self-test to C language storehouse.
Optionally, the default size is the big of used storehouse when the subfunction for operating normally described program is called Small 10 times or 10 times or more.
Optionally, described in program starting, control described program principal function call default storehouse self-test subfunction into Row self-test, comprising:
In program starting, the principal function for controlling described program calls default storehouse self-test subfunction;
Each local variable correspondence in local variable array defined in the default storehouse self-test subfunction is successively read to deposit The numerical value that storage address is stored;
Judge that read each local variable corresponds to the numerical value that storage address is stored and the local variable described default Whether the value being defined in storehouse self-test subfunction is consistent;
If read each local variable corresponds to the numerical value that storage address is stored and the local variable in the default heap The value being defined in stack self-test subfunction is consistent, it is determined that the default storehouse self-test subfunction self-test passes through, to the master Function sends return value;
If read each local variable corresponds to the numerical value that storage address is stored and the local variable in the default heap The value being defined in stack self-test subfunction is inconsistent, it is determined that the default storehouse self-test subfunction self-test does not pass through.
Optionally, the method also includes:
After the default storehouse self-test subfunction self-test passes through, by all parts of the default storehouse self-test subfunction Variable is adjusted to stationary state.
Second aspect, the present invention provide a kind of storehouse self-checking unit, comprising:
First control module, the principal function in program starting, controlling described program call default storehouse self-test Function carry out self-test, wherein the default storehouse self-test subfunction define default size local variable array and the office The value of all local variables in portion's variable array, the default size are much larger than the subfunction quilt for operating normally described program The size of used storehouse when calling;
Second control module, for controlling after the default storehouse self-test subfunction sends return value to the principal function It makes the principal function and calls the subfunction for operating normally described program, compiler is the son for operating normally described program Function distributes the default used stack region of storehouse self-test subfunction;
Third control module, it is obstructed out-of-date in the default storehouse self-test subfunction self-test to be used for, and described program is in Idle loop dead state, does not return again to.
Optionally, described device is used to carry out self-test to C language storehouse.
Optionally, the default size is the big of used storehouse when the subfunction for operating normally described program is called Small 10 times or 10 times or more.
Optionally, first control module, is specifically used for
In program starting, the principal function for controlling described program calls default storehouse self-test subfunction;
Each local variable correspondence in local variable array defined in the default storehouse self-test subfunction is successively read to deposit The numerical value that storage address is stored;
Judge that read each local variable corresponds to the numerical value that storage address is stored and the local variable described default Whether the value being defined in storehouse self-test subfunction is consistent;
If read each local variable corresponds to the numerical value that storage address is stored and the local variable in the default heap The value being defined in stack self-test subfunction is consistent, it is determined that the default storehouse self-test subfunction self-test passes through, to the master Function sends return value;
If read each local variable corresponds to the numerical value that storage address is stored and the local variable in the default heap The value being defined in stack self-test subfunction is inconsistent, it is determined that the default storehouse self-test subfunction self-test does not pass through.
Optionally, first control module, is also used to
After the default storehouse self-test subfunction self-test passes through, by all parts of the default storehouse self-test subfunction Variable is adjusted to stationary state.
As shown from the above technical solution, storehouse self checking method and device of the invention, by controlling journey when program starts The principal function of sequence calls default storehouse self-test subfunction to carry out self-test, which defines default size The value of all local variables in local variable array and the local variable array, the default size, which is much larger than, makes described program The size of the subfunction of normal operation used storehouse when called;It sends and returns to principal function in default storehouse self-test subfunction After value, control principal function calls the subfunction for operating normally described program, and compiler is the son for operating normally described program Function distributes the default used stack region of storehouse self-test subfunction;It is obstructed out-of-date in default storehouse self-test subfunction self-test, Program is in idle loop dead state, is not returned again to, thereby, it is possible to carry out effectively and rapidly self-test to C language storehouse, and It will not influence system reliability of operation, improve program operational efficiency.
Detailed description of the invention
Fig. 1 be the prior art C language compiler after principal function end is called subfunction distribution storehouse letter The structural schematic diagram of number stack area;
Fig. 2 is the flow diagram for the storehouse self checking method that one embodiment of the invention provides;
It at principal function end is called default storehouse self-test that Fig. 3, which is C language compiler provided in an embodiment of the present invention, Subfunction distributes the structural schematic diagram of default storehouse self-test subfunction stack area after storehouse;
Fig. 4 is the structural schematic diagram for the storehouse self-checking unit that one embodiment of the invention provides.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, the technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only It is only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiment of the present invention, ordinary skill people Member's every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
It should be noted that the purposes of storehouse is mainly the calling of function under C language programmed environment, storehouse is to connect completely Continuous distribution and duplicate allocation.When principal function calls subfunction, C language compiler can be automatically at the end of principal function stack area One section of continuous stack area is created for subfunction, as shown in Figure 1, C language storehouse distributes.The subfunction stack area includes following 3 Part:
(1) parameter returned after the parameter and subfunction that principal function calls subfunction to transmit;
(2) local variable that subfunction defines, compiler define the size of local variable according to subfunction, sequentially by storehouse Area extends corresponding space;
(3) critical registers of principal function are restored for principal function, subfunction are not acted on.
After group function operation, C language compiler can recycle the stack area;Principal function calls other sub- letters again When number, it is that subfunction distributes stack region that compiler, which can reuse the region,.
Fig. 2 shows the flow diagrams for the storehouse self checking method that one embodiment of the invention provides, as shown in Fig. 2, this reality The storehouse self checking method for applying example is as described below.
201, when program starts, the principal function for controlling described program calls default storehouse self-test subfunction to carry out self-test.
Wherein, the default storehouse self-test subfunction define default size local variable array and the local variable The value of all local variables in array, the default size are much larger than when keeping the subfunction of described program normal operation called The size of used storehouse, as shown in Figure 3.
In a particular application, made when the default size can be called by the subfunction for operating normally described program With 10 times or 10 times or more of the size of storehouse.For example, the when institute if the subfunction for operating normally described program is called Size using storehouse is 1K BYTE (i.e. 1024 bytes), then the default size of the default storehouse self-test subfunction can be 10K BYTE is greater than 10K BYTE.
Specifically, the logic of the default storehouse self-test subfunction operation can refer to IEC61508 or EN50129 specification Requirement, for example, can successively value be that 55, AA, CC are equivalent by the local variable array.
In a particular application, the default storehouse self-test subfunction is write using C/C++ language.
In a particular application, the step 201 may include the step 201a-201e being not shown in the figure:
201a, in program starting, the principal function for controlling described program calls default storehouse self-test subfunction, can refer to figure 3。
201b, it is successively read each local variable pair in local variable array defined in the default storehouse self-test subfunction Answer the numerical value that storage address is stored.
Specifically, it can be successively read by pointer in local variable array defined in the default storehouse self-test subfunction Each local variable corresponds to the numerical value that storage address is stored.
201c, judge that read each local variable corresponds to the numerical value that storage address is stored and the local variable described Whether the value being defined in default storehouse self-test subfunction is consistent.
If 201d, read each local variable correspond to numerical value and the local variable that storage address is stored described pre- If the value being defined in storehouse self-test subfunction is consistent, it is determined that the default storehouse self-test subfunction self-test passes through, to institute It states principal function and sends return value.
It is understood that the default storehouse self-test subfunction self-test passes through, represents region of memory and do not break down.
If 201e, read each local variable correspond to numerical value and the local variable that storage address is stored described pre- If the value being defined in storehouse self-test subfunction is inconsistent, it is determined that the default storehouse self-test subfunction self-test does not pass through.
202, after the default storehouse self-test subfunction sends return value to the principal function, the principal function tune is controlled With the subfunction for operating normally described program, compiler is that the subfunction distribution for operating normally described program is described pre- If the used stack region of storehouse self-test subfunction.
In a particular application, the present embodiment is after the default storehouse self-test subfunction self-test passes through, can also will be described pre- If all local variables of storehouse self-test subfunction are adjusted to stationary state.Such as 0XFF, it can prevent region of memory from occurring random number According to.
203, obstructed out-of-date in the default storehouse self-test subfunction self-test, described program is in idle loop and stagnates shape State does not return again to.
It is understood that the default storehouse self-test subfunction self-test does not pass through, represents region of memory and failure occurs, Described program is in idle loop dead state, is not returned again to, it is ensured that the safety of system.
It is understood that the size of the local variable array defined due to the default storehouse self-test subfunction of the present embodiment The size of used storehouse when called much larger than the subfunction for operating normally described program, generally 10 times or 10 times with On, therefore do not need to call primary default storehouse self-test when calling the subfunction for each making described program normal operation Function can run the subfunction operated normally several times it is, calling a self-test subfunction.Programmer can basis The program itself write flexibly calls the default storehouse self-test subfunction.
It should be noted that the present embodiment the method is to carry out self-test to C language storehouse.
The storehouse self checking method of the present embodiment devises a default storehouse self-test subfunction, since this presets storehouse certainly Inspection subfunction does not need shielding when executing and interrupts, and does not need the variable for moving former stack region, no input, output parameter are also fixed The value of all local variables in the justice local variable array of default size and the local variable array, can by making journey Before the subfunction that sequence operates normally is called, the stack region used in advance is carried out using a default storehouse self-test subfunction Self-test recalls the subfunction for making normal program operation after self-test success.The default storehouse self-test subfunction of the present embodiment is only right The stack region used carries out self-test, can be improved program operational efficiency, the present embodiment the method can be in real time to C language letter The storehouse that number uses carries out effectively and rapidly self-test, does not need shielding and interrupts, does not need to move internal storage data, and will not influence System reliability of operation can guarantee the stability of system.The present embodiment the method can be realized by processor.
Fig. 4 shows the structural schematic diagram of the storehouse self-checking unit of one embodiment of the invention offer, as shown in figure 4, this reality Apply the storehouse self-checking unit of example, comprising: the first control module 41, the second control module 42 and third control module 43;Wherein:
First control module 41, the principal function in program starting, controlling described program call default storehouse Self-test subfunction carries out self-test;
Second control module 42, for sending return value to the principal function in the default storehouse self-test subfunction Afterwards, it controls the principal function and calls the subfunction for operating normally described program, compiler transports described program normally to be described Capable subfunction distributes the default used stack region of storehouse self-test subfunction;
The third control module 43, for obstructed out-of-date in the default storehouse self-test subfunction self-test, by the journey Sequence is in idle loop dead state, does not return again to.
Wherein, the default storehouse self-test subfunction define default size local variable array and the local variable The value of all local variables in array, the default size are much larger than when keeping the subfunction of described program normal operation called The size of used storehouse.
In a particular application, made when the default size can be called by the subfunction for operating normally described program With 10 times or 10 times or more of the size of storehouse.For example, the when institute if the subfunction for operating normally described program is called Size using storehouse is 1K BYTE (i.e. 1024 bytes), then the default size of the default storehouse self-test subfunction can be 10K BYTE is greater than 10K BYTE.
Specifically, the logic of the default storehouse self-test subfunction operation can refer to IEC61508 or EN50129 specification Requirement, for example, can successively value be that 55, AA, CC are equivalent by the local variable array.
In a particular application, the default storehouse self-test subfunction is write using C/C++ language.
In a particular application, first control module 41, can be specifically used for
In program starting, the principal function for controlling described program calls default storehouse self-test subfunction;
Each local variable correspondence in local variable array defined in the default storehouse self-test subfunction is successively read to deposit The numerical value that storage address is stored;
Judge that read each local variable corresponds to the numerical value that storage address is stored and the local variable described default Whether the value being defined in storehouse self-test subfunction is consistent;
If read each local variable corresponds to the numerical value that storage address is stored and the local variable in the default heap The value being defined in stack self-test subfunction is consistent, it is determined that the default storehouse self-test subfunction self-test passes through, to the master Function sends return value;
If read each local variable corresponds to the numerical value that storage address is stored and the local variable in the default heap The value being defined in stack self-test subfunction is inconsistent, it is determined that the default storehouse self-test subfunction self-test does not pass through.
Specifically, first control module 41 can be successively read the default storehouse self-test subfunction by pointer and be determined Each local variable corresponds to the numerical value that storage address is stored in the local variable array of justice.
It is understood that the default storehouse self-test subfunction self-test passes through, represents region of memory and do not break down.
It is understood that the default storehouse self-test subfunction self-test does not pass through, represents region of memory and failure occurs, Described program is in idle loop dead state by the third control module 43, is not returned again to, it is ensured that the safety of system.
In a particular application, first control module 41, it may also be used for
After the default storehouse self-test subfunction self-test passes through, by all parts of the default storehouse self-test subfunction Variable is adjusted to stationary state.Such as 0XFF, it can prevent region of memory from occurring random data.
It is understood that the size of the local variable array defined due to the default storehouse self-test subfunction of the present embodiment The size of used storehouse when called much larger than the subfunction for operating normally described program, generally 10 times or 10 times with On, therefore do not need to call primary default storehouse self-test when calling the subfunction for each making described program normal operation Function.The program that programmer can write according to itself flexibly calls the default storehouse self-test subfunction.
It should be noted that the present embodiment described device can be used for carrying out self-test to C language storehouse.
The storehouse self-checking unit of the present embodiment, can be improved program operational efficiency, can use in real time C language function Storehouse carries out effectively and rapidly self-test, does not need shielding and interrupts, does not need to move internal storage data, and will not influence system operation Reliability, can guarantee the stability of system.The present embodiment described device can be realized by processor.
The storehouse self-checking unit of the present embodiment can be used for executing the technical solution of preceding method embodiment, realize former Reason is similar with technical effect, and details are not described herein again.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.Term " on ", "lower" etc. refer to The orientation or positional relationship shown is to be based on the orientation or positional relationship shown in the drawings, and is merely for convenience of the description present invention and simplifies Description, rather than the device or element of indication or suggestion meaning must have a particular orientation, constructed and grasped with specific orientation Make, therefore is not considered as limiting the invention.Unless otherwise clearly defined and limited, term " installation ", " connected ", " connection " shall be understood in a broad sense, for example, it may be being fixedly connected, may be a detachable connection, or be integrally connected;It can be Mechanical connection, is also possible to be electrically connected;It can be directly connected, two can also be can be indirectly connected through an intermediary Connection inside element.For the ordinary skill in the art, above-mentioned term can be understood at this as the case may be Concrete meaning in invention.
In specification of the invention, numerous specific details are set forth.Although it is understood that the embodiment of the present invention can To practice without these specific details.In some instances, well known method, structure and skill is not been shown in detail Art, so as not to obscure the understanding of this specification.Similarly, it should be understood that disclose in order to simplify the present invention and helps to understand respectively One or more of a inventive aspect, in the above description of the exemplary embodiment of the present invention, each spy of the invention Sign is grouped together into a single embodiment, figure, or description thereof sometimes.However, should not be by the method solution of the disclosure Release is in reflect an intention that i.e. the claimed invention requires more than feature expressly recited in each claim More features.More precisely, as the following claims reflect, inventive aspect is less than single reality disclosed above Apply all features of example.Therefore, it then follows thus claims of specific embodiment are expressly incorporated in the specific embodiment, It is wherein each that the claims themselves are regarded as separate embodiments of the invention.It should be noted that in the absence of conflict, this The feature in embodiment and embodiment in application can be combined with each other.The invention is not limited to any single aspect, It is not limited to any single embodiment, is also not limited to any combination and/or displacement of these aspects and/or embodiment.And And can be used alone each aspect and/or embodiment of the invention or with other one or more aspects and/or its implementation Example is used in combination.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The range of scheme should all cover within the scope of the claims and the description of the invention.

Claims (6)

1. a kind of storehouse self checking method characterized by comprising
In program starting, the principal function for controlling described program calls default storehouse self-test subfunction to carry out self-test, comprising: in journey When sequence starts, the principal function for controlling described program calls default storehouse self-test subfunction;It is successively read the default storehouse self-test Each local variable corresponds to the numerical value that storage address is stored in local variable array defined in subfunction;Judge read each Local variable corresponds to the numerical value that storage address is stored and is defined in the default storehouse self-test subfunction with the local variable Value it is whether consistent;If read each local variable corresponds to numerical value that storage address is stored with the local variable described The value being defined in default storehouse self-test subfunction is consistent, it is determined that and the default storehouse self-test subfunction self-test passes through, to The principal function sends return value;If read each local variable corresponds to the numerical value and the local variable that storage address is stored The value being defined in the default storehouse self-test subfunction is inconsistent, it is determined that the default storehouse self-test subfunction self-test Do not pass through;Wherein, the default storehouse self-test subfunction define default size local variable array and the local variable The value of all local variables in array, the default size are made when called by the subfunction for operating normally described program With 10 times or 10 times or more of the size of storehouse;
After the default storehouse self-test subfunction sends return value to the principal function, control principal function calling make it is described The subfunction of normal program operation, compiler are that the subfunction for operating normally described program distributes the default storehouse certainly Examine the used stack region of subfunction;
It is obstructed out-of-date in the default storehouse self-test subfunction self-test, described program is in idle loop dead state, is no longer returned It returns.
2. the method according to claim 1, wherein the method is to carry out self-test to C language storehouse.
3. the method according to claim 1, wherein the method also includes:
After the default storehouse self-test subfunction self-test passes through, by all local variables of the default storehouse self-test subfunction It is adjusted to stationary state.
4. a kind of storehouse self-checking unit characterized by comprising
First control module, the principal function in program starting, controlling described program call default storehouse self-test subfunction Carry out self-test, comprising: in program starting, the principal function for controlling described program calls default storehouse self-test subfunction;Successively read Each local variable in local variable array defined in the default storehouse self-test subfunction is taken to correspond to what storage address was stored Numerical value;Judge that read each local variable corresponds to the numerical value that storage address is stored and the local variable in the default storehouse Whether the value being defined in self-test subfunction is consistent;If read each local variable corresponds to the numerical value that storage address is stored It is consistent with the value that the local variable is defined in the default storehouse self-test subfunction, it is determined that the default storehouse self-test Subfunction self-test passes through, and Xiang Suoshu principal function sends return value;If read each local variable corresponds to storage address and is stored The value that is defined in the default storehouse self-test subfunction of numerical value and the local variable it is inconsistent, it is determined that it is described default Storehouse self-test subfunction self-test does not pass through;Wherein, the default storehouse self-test subfunction defines the local variable of default size The value of all local variables, the default size are to operate normally described program in array and the local variable array Subfunction is 10 times or 10 times or more of the size of used storehouse when called;
Second control module, for controlling institute after the default storehouse self-test subfunction sends return value to the principal function It states principal function and calls the subfunction for operating normally described program, compiler is the subfunction for operating normally described program Distribute the default used stack region of storehouse self-test subfunction;
Third control module, it is obstructed out-of-date in the default storehouse self-test subfunction self-test to be used for, and described program is followed in sky Ring dead state, does not return again to.
5. device according to claim 4, which is characterized in that described device is used to carry out self-test to C language storehouse.
6. device according to claim 4, which is characterized in that first control module is also used to
After the default storehouse self-test subfunction self-test passes through, by all local variables of the default storehouse self-test subfunction It is adjusted to stationary state.
CN201610942165.XA 2016-10-25 2016-10-25 Storehouse self checking method and device Active CN106547606B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610942165.XA CN106547606B (en) 2016-10-25 2016-10-25 Storehouse self checking method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610942165.XA CN106547606B (en) 2016-10-25 2016-10-25 Storehouse self checking method and device

Publications (2)

Publication Number Publication Date
CN106547606A CN106547606A (en) 2017-03-29
CN106547606B true CN106547606B (en) 2019-07-02

Family

ID=58392504

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610942165.XA Active CN106547606B (en) 2016-10-25 2016-10-25 Storehouse self checking method and device

Country Status (1)

Country Link
CN (1) CN106547606B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109426501A (en) * 2017-06-27 2019-03-05 比亚迪股份有限公司 Storehouse self checking method and device
CN109214169B (en) * 2017-06-30 2023-12-08 芜湖美的厨卫电器制造有限公司 Stack overflow detection method and device and household appliance
CN112948000B (en) * 2021-03-17 2023-03-03 星汉智能科技股份有限公司 Stack space statistical method, device and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102214147A (en) * 2011-06-29 2011-10-12 深圳市五巨科技有限公司 Method and device for detecting transborder memory access
CN202177891U (en) * 2010-12-10 2012-03-28 北京旋极信息技术股份有限公司 Device for operating embedded computer system developing tool
CN102629231A (en) * 2012-04-24 2012-08-08 迈普通信技术股份有限公司 Method for detecting task stack
CN104331370A (en) * 2014-11-26 2015-02-04 上海斐讯数据通信技术有限公司 Stack security detection method and system
CN104714885A (en) * 2015-02-13 2015-06-17 小米科技有限责任公司 Method and device for detecting stack overflow position

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8200853B2 (en) * 2010-01-14 2012-06-12 Microsoft Corporation Extensions for USB driver interface functions

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN202177891U (en) * 2010-12-10 2012-03-28 北京旋极信息技术股份有限公司 Device for operating embedded computer system developing tool
CN102214147A (en) * 2011-06-29 2011-10-12 深圳市五巨科技有限公司 Method and device for detecting transborder memory access
CN102629231A (en) * 2012-04-24 2012-08-08 迈普通信技术股份有限公司 Method for detecting task stack
CN104331370A (en) * 2014-11-26 2015-02-04 上海斐讯数据通信技术有限公司 Stack security detection method and system
CN104714885A (en) * 2015-02-13 2015-06-17 小米科技有限责任公司 Method and device for detecting stack overflow position

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
VS2005堆栈检查函数解析;figaro;《http://blog.sing.com.cn/s/blog_4e48dbddOl000b7t.html》;20071012;第1-3页

Also Published As

Publication number Publication date
CN106547606A (en) 2017-03-29

Similar Documents

Publication Publication Date Title
CN100489778C (en) Method for implementing dynamic update of Java program
CN100432931C (en) Method for implementing long jumping dynamic patch in embedded system
US9513911B2 (en) Method of detecting stack overflows and processor for implementing such a method
CN105911885B (en) Industrial control unit (ICU) for improving industrial control system
CN106547606B (en) Storehouse self checking method and device
CN110663006B (en) Method for performing failover of programmable logic controller and controlling physical system
CN102222037A (en) Method and equipment for positioning bottleneck of JAVA program
CN101025698A (en) Apparatus for forcibly terminating thread blocked on input/output operation and method for the same
CN103927187A (en) Program execution method of embedded system
US8595726B2 (en) Apparatus and method for parallel processing
CN103389939A (en) Detection method and detection system for controlled heap allocation bug
CN103309796A (en) Monitoring method and device of component object model (COM) object
CN104298512A (en) OSGi-based (open service gateway initiative) functional unit type integrated development system
Greenwood et al. Using dynamic aspect-oriented programming to implement an autonomic system
CN106528893A (en) Data synchronization method and device
CN103324582A (en) Memory migration method, memory migration device and equipment
CN105589729A (en) Dynamic compiling method and device based on embedded virtual machine
CN100538644C (en) The method of computer program, computing equipment
CN103226499A (en) Method and device for restoring abnormal data in internal memory
CN109614153A (en) Multi core chip and system
CN105630581A (en) Task processing method and device, and computer storage medium
CN105164642A (en) Operating system support for contracts
CN107679423A (en) Partition integrity inspection method and device
CN103049374A (en) Automatic testing method and device
CN107368498A (en) The lock for optimizing MySQL Pessimistic Lockings waits the method and device of time-out time

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
GR01 Patent grant
GR01 Patent grant