CN105912447B - A kind of monitoring method of embedded program execution sequence - Google Patents

A kind of monitoring method of embedded program execution sequence Download PDF

Info

Publication number
CN105912447B
CN105912447B CN201610335224.7A CN201610335224A CN105912447B CN 105912447 B CN105912447 B CN 105912447B CN 201610335224 A CN201610335224 A CN 201610335224A CN 105912447 B CN105912447 B CN 105912447B
Authority
CN
China
Prior art keywords
function
level
partial order
order mark
level function
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
CN201610335224.7A
Other languages
Chinese (zh)
Other versions
CN105912447A (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.)
Nanjing Keyuan Intelligent Technology Group Co.,Ltd.
Original Assignee
Nanjing Sciyon Automation Group 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 Nanjing Sciyon Automation Group Co Ltd filed Critical Nanjing Sciyon Automation Group Co Ltd
Priority to CN201610335224.7A priority Critical patent/CN105912447B/en
Publication of CN105912447A publication Critical patent/CN105912447A/en
Application granted granted Critical
Publication of CN105912447B publication Critical patent/CN105912447B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs

Landscapes

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

Abstract

The invention discloses a kind of monitoring methods of embedded program execution sequence, the monitoring method is by setting embedded program the corresponding partial order mark of functions at different levels, regularly change the numerical value of corresponding partial order mark after each program statement of functions at different levels performs, after the function of each level performs, the exception that sentence is not performed is judged whether according to the numerical value of corresponding partial order mark.Using monitoring method of the present invention, program monitoring coverage can be effectively increased and can be used in the monitoring of the program execution order of arbitrary calling depth.

Description

A kind of monitoring method of embedded program execution sequence
Technical field
The invention belongs to embedded software Programs to perform surveillance technology field, and in particular to a kind of embedded program performs The monitoring method of order.
Background technology
In embedded product, a program often wants continual operation for a long time, will not once generating mistake Disconnected accumulation, when restarting system next time, mistake could eliminate, and serious failure long-term accumulation results even in product Damage.Therefore the monitoring performed to program just seems extremely important, timely finds mistake, and takes effective solution, Product itself is protected, prolongs the service life, also provides convenience for the use of user.
There are many monitoring method performed to program, and some by hardware watchdog realizes and monitor that some is in software code Key position adds the judgement of some flag bits to detect the level of enforcement of program, also has plenty of and carries out piecemeal to code, only Sequential monitoring is carried out the execution block code.Often there are more failure residuals for these modes, it is impossible to which every is instructed Sentence is monitored, and in the more complicated embedded system of function call level, can not be detected by these methods, It is even more impossible to timely processings, exclude hidden danger.
The content of the invention
The purpose of the present invention is to solve defects in the prior art, and program prison can be effectively increased by providing one kind Control coverage and the monitoring method that can be used in the program execution order of arbitrary calling depth.
In order to achieve the above object, the present invention provides a kind of monitoring method of embedded program execution sequence, by right The corresponding partial order mark of each level function sets of embedded program is performed in each program statement of each level function After regularly change the numerical value of corresponding partial order mark, after the function of each level performs, according to correspondence The numerical value of partial order mark judge whether the exception that sentence is not performed.
Monitoring method of the present invention can also be by setting embedded program global sequence indicia and the corresponding office of function at different levels Portion's sequence indicia regularly changes corresponding partial order mark after each program statement of functions at different levels performs Numerical value, after the function of each level performs, sentence is judged whether according to the numerical value of corresponding partial order mark The exception not being performed;When occurring abnormal, change the global sequence indicia of embedded program, and checking global sequence indicia As abnormality processing during judgement.
The monitoring method of embedded program execution sequence of the present invention, including step in detail below:
(1)The global sequence indicia of embedded program is defined, and assigns preset value;
(2)At the function entrance that each level is performed in embedded program, judge whether global sequence indicia is default Value, if preset value, then execution sequence mistake does not occur for present procedure, continues the execution of next statement, if not preset value is then deposited Execution sequence mistake, it is necessary into exception handler;
(3)Whether inspection needs the function of execution newly to define level function:Whether discriminant function is the upper level returned Function or the defined next stage function of nesting allocation;If not, to need new definition level function, into next step;Such as It is then to enter step(5);
(4)It is new as needed to define level function, the partial order mark of the level is defined, and assigns initial value;
(5)Perform first non-program statement for sequential monitoring in current function;It determines whether that function is nested to adjust With if nothing, continuing the execution of next statement, if so, return to step(2), often return and once represent in current level letter Nested next level function in number;
(6)After a upper program statement performs, the numerical value of the partial order mark of the level function is changed;
(7)Step 4 is repeated to be finished to 6 to current level function;
(8)Whether the partial order mark that the current tail end for performing the level function completed compares the level function is correct: If there is mistake in the numerical value of partial order mark, then it represents that there is the sentence that perform and is not performed or mistakenly repeats Multiple sentence is performed, the numerical value of global sequence indicia is changed(It is allowed to not be preset value), direct return to step(2)It checks Global sequence indicia, if not preset value then enters exception handler;If the numerical value of partial order mark does not occur mistake, Represent that all sentences that should be performed all correctly have performed, into next step;
(9)Check whether currently performed function is nested in upper level function, if it is, returning to upper level letter Number, i.e. return to step(3);If it is not, then represent that this monitoring terminates.
From above-mentioned steps, pass through step(5)To step(2)It returns, next level function nesting can be continuously increased, Pass through step(9)To step(2)It returns, upper level function can be constantly returned to, in step(2)And step(9)Between can be real Existing Multi-nesting and multiple upper layer grade function return, until the last most last layer grade function that reaches is finished.Therefore, originally Monitoring method realizes multi-layer function order monitoring complicated in embedded program.
Above-mentioned overall situation sequence indicia, for judging whether whole system Program execution sequence exception, preset value occurs For arbitrary hexadecimal positive integer, such as 0x55U.
Partial order mark, for judging whether the execution sequence in current function exception occurs, initial value is arbitrarily just Integer.In general, the initial value of partial order mark can be generally assigned to 1.
The numerical value of partial order mark is sexually revised using rule, and such as regularity is incremented by(Add 1 plus 2 etc.)Or successively decrease(Subtract 1, Subtract 2)Or carry out cycling assignment.When carrying out cycling assignment, refer to cycle sequence indicia according to the numerical value in particular list Assignment, the numerical value in particular list arbitrarily set the length of list as needed, specific to cycle assignment list in concrete application It can be defined as " 1,2,3,4,5,6,7,8,9,10 ".According to the order in list after every sentence is performed to partial order mark Will changes, if the number in list is finished, first continuation for returning to list is right after every sentence of execution in sequence Partial order mark changes.
Preferred embodiment is:After each sentence performs, 1 is added to the numerical value of local sequence indicia, it so can basis The numerical value of partial order mark is judged to perform sentence quantity.
Step(8)In to making above-mentioned processing after the program statement of the function of each level of embedded program, be partial order The numerical value of mark changes sentence and covers in each program statement of each level function.
Step(2)In abnormality processing for cpu reset or into abnormal interrupt service routine or generate diagnostic message use In showing or notify third party's device and equipment.
The present invention has the following advantages compared with prior art:The present invention can carry out the execution sequence of arbitrary level function Monitoring, every sentence is contracted to the monitoring of program, local suitable to being carried out after every sentence by the function of each level The execution sequence situation that can monitor each every sentence of level under arbitrarily complicated system, this method are realized in the change of sequence mark The coverage rate to program statement is greatly improved, and can flexibly be applied under complication system, it is deep from function call The limitation of degree.
Description of the drawings
Fig. 1 is the monitoring method flow chart of embedded program execution sequence of the present invention;
Fig. 2 is the embedded program call relation schematic diagram of the application present invention;
Fig. 3 is the logic relation picture that embedded program shown in Fig. 2 carries out program execution order monitoring using the present invention.
Specific embodiment
The present invention is described in detail below in conjunction with the accompanying drawings.
As shown in Figure 1, the monitoring method of embedded program execution sequence of the present invention concretely comprises the following steps:
The judgement of global sequence indicia, such as mistake are carried out at function entrance(It is not preset value)Abnormality processing is then carried out, Correctly judging whether this function after is returned by next level function, if not then defining new partial order mark(Make To define for the first time, then the level respective function is top layer's grade function), and initial value is assigned to the new partial order mark, then Into in next step, if by the return of next level function, it is directly entered in next step;
Then, this level function is performed;If there is nesting allocation grade function in this level function, into next level letter Number still first judges global sequence indicia, such as mistake(It is not preset value)Abnormality processing is then carried out, is correctly reexamined execution Function is to need new definition level function, just directly performs this function if not, if it is the sub- grade function is defined new Partial order mark and assign initial value, then perform this level function, and perform this level function and also have nesting allocation function, then after It is continuous to enter next level function, cycle above-mentioned nesting allocation function step;If other sub- grade functions of this level function never call, It continues to execute, this grade of partial order mark is changed after each program statement execution of each level function, is entered In next step;
Judge whether that all functions of this level have all performed, check that this level partial order mark is if having performed No wrong, mistake then changes global sequence indicia numerical value, and when checking that global sequence indicia judges as abnormality processing, just It is true then check whether currently performed function is nested in upper level function, if so, returning to upper level function, that is, return to Above-mentioned Overall Steps are repeated at the function entrance of front, if it is not, then representing that this monitoring terminates, also indicate that the function of all levels Order is run correct.
As shown in Fig. 2, by taking 3 levels as an example, the division of embedded program function level and function calling relationship are shown Meaning, as seen from the figure, this method can be used in the programming system of arbitrary calling depth, define 3 levels, and each level includes N number of Function statement, each level uses a partial order mark, in a level, by the function statement in the level Afterwards plus change sequence indicia sentence, it is just suitable to the part of this grade by changing sequence indicia sentence often to have performed a function statement The numerical value of sequence mark changes once, after all sentences of the level perform, whether just to check the numerical value of the partial order mark Really, the mission function after continuing if correct, if mistake occurs in the numerical value of partial order mark, to global sequence indicia Numerical value changes, and the mistake of execution sequence can be detected in the inlet of function, and enter exception handler, at wait Reason.
As shown in figure 3, the example flow diagram of execution sequence monitoring is carried out using the present invention for embedded program in Fig. 2, it is first First judge whether global sequence indicia is correct at the function entrance, into abnormality processing if mistake, if after correctly performing Continuous function statement defines the partial order mark of level 1, assigns initial value to the partial order mark, initial value for one or arbitrary just Integer performs first function statement 1-1 in the level afterwards, because there is function nesting at this, therefore turns in level 2, still First judge global sequence indicia whether mistake, sequential monitoring process is as previously mentioned, define the partial order mark of level 2, to layer The partial order mark of grade 2 assigns initial value, performs function statement 2-1, because nested where there is function, jump to level 3, first examines Look into whether whole sequence indicias are correct, the partial order mark of level 3 defined after correct, then performs function statement 3-1,3-2, And change the numerical value of the partial order mark of this level after each sentence is performed, if there is mistake in partial order mark Change global sequence indicia value, and jump at the function entrance, global sequence indicia exception will be detected, and entered abnormal Processing, if correctly, need to return to previous 2 corresponding position of level, the function statement of level performs where continuing, and changes institute after returning Partial order flag values in level 2(Such as workflow graph frame 250), function statement 2-2 is performed, changes partial order mark, It goes at function 2-N, when going to function statement 2-N, because occurring function nesting again herein, therefore jumps in this order Level 3, continues to execute function statement 3-3 to 3-N, and every sentence changes the numerical value of the partial order mark of the level after performing Become, if mistake occurs in partial order mark, change global sequence indicia, and jump at the function entrance, will be detected Global sequence indicia is abnormal, and enters abnormality processing.If 3 all sentences of level examine the partial order mark of the level after performing After looking into correctly, the corresponding position of previous level 2 is returned to, the function statement of level performs where continuing, layer where after change return Partial order flag values in grade 2(Such as workflow graph frame 290), judge that all function statements of level are finished, check level 2 Partial order mark, correctly then return to level 1, change the partial order flag values of level 1(Such as workflow graph frame 150), hold Line function 1-2 to 1-N changes the numerical value of the partial order mark of level 1 after every function statement performs, and in the level All function statements detect partial order flag values after being finished, and mistake then changes global program's sequence indicia, jumps to At the function entrance, global sequence indicia exception will be detected, and into abnormality processing, correctly then this monitoring terminates.
It can be seen from the above description that this method is suitable for arbitrarily complicated system, from function call depth limit, energy It is enough that each sentence is monitored, reach high coverage rate, it is ensured that the correctness of each program executing sequence;Together When, partial order mark mistake is likely to occur each time for above-mentioned, and system also can according to error log when occurring abnormal The function of order of occurrence mark mistake is oriented, facilitates the inquiry, processing and correction of abnormal cause.
It is indicated except no special, the feature of method described herein can be combined with each other.
Although listing the implementation example of part herein, those skilled in the art is without departing substantially from the scope of the present invention Under, alternating combines or any equivalent alternative implementation example described herein of method for realizing the present invention.The application Any variation or change of the concrete principle method and specific embodiment that are intended to include discussed in text.Therefore, it is of the invention Only be subject to claim and its equivalent limited.

Claims (3)

1. a kind of monitoring method of embedded program execution sequence, which is characterized in that including step in detail below:
(1)The global sequence indicia of embedded program is defined, and assigns preset value;
(2)At the function entrance that each level is performed in embedded program, judge whether global sequence indicia is preset value, if For preset value, then execution sequence mistake does not occur for present procedure, continues the execution of next statement, is held if not preset value then exists The mistake of row order is, it is necessary into exception handler;
(3)Whether inspection needs the function of execution newly to define level function:Whether discriminant function is the upper level function returned Or the defined next stage function of nesting allocation;If not, to need new definition level function, into next step;If so, then It enters step(5);
(4)It is new as needed to define level function, the partial order mark of the level is defined, and assigns initial value;
(5)Perform first non-program statement for sequential monitoring in current function;Determine whether function inset call, such as Fruit is without continuing the execution of next statement, if so, return to step(2), often return and once represent embedding in current level function Next level function is covered;
(6)After a upper program statement performs, the numerical value of the partial order mark of the level function is changed, is shifted gears Using adding 1 to local sequence indicia or carry out cycling assignment;
(7)Step 4 is repeated to be finished to 6 to current level function;
(8)Whether the partial order mark that the current tail end for performing the level function completed compares the level function is correct:If office There is mistake in the numerical value of portion's sequence indicia, then it represents that there is the sentence that perform and is not performed or mistakenly repeats Multiple sentence changes the numerical value of global sequence indicia, direct return to step(2)Global sequence indicia is checked, if not default Value then enters exception handler;If the numerical value of partial order mark does not occur mistake, then it represents that all sentences that should be performed It all correctly performs, into next step;
(9)Check whether currently performed function is nested in upper level function, if it is, returning to upper level function, i.e., Return to step(3);If it is not, then represent that this monitoring terminates.
2. monitoring method according to claim 1, which is characterized in that it is described the overall situation sequence indicia preset value for 16 into Number processed;The initial value of the partial order mark is positive integer.
3. monitoring method according to claim 1, it is characterised in that:The step(2)In abnormality processing answered for CPU Position is used to showing or notifying third party's device and equipment into abnormal interrupt service routine or generation diagnostic message.
CN201610335224.7A 2016-05-19 2016-05-19 A kind of monitoring method of embedded program execution sequence Active CN105912447B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610335224.7A CN105912447B (en) 2016-05-19 2016-05-19 A kind of monitoring method of embedded program execution sequence

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610335224.7A CN105912447B (en) 2016-05-19 2016-05-19 A kind of monitoring method of embedded program execution sequence

Publications (2)

Publication Number Publication Date
CN105912447A CN105912447A (en) 2016-08-31
CN105912447B true CN105912447B (en) 2018-05-25

Family

ID=56749560

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610335224.7A Active CN105912447B (en) 2016-05-19 2016-05-19 A kind of monitoring method of embedded program execution sequence

Country Status (1)

Country Link
CN (1) CN105912447B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107665113B (en) * 2017-09-07 2020-12-04 广东博立科技有限公司 Software method for preventing program system from crashing due to pointer running
CN108646708B (en) * 2018-05-02 2020-05-22 阳光电源股份有限公司 Program flow monitoring method and system
CN109388563A (en) * 2018-09-26 2019-02-26 北京广利核***工程有限公司 Safe and reliable nuclear safe level DCS software execution sequence monitoring method and system
CN111474913B (en) * 2019-01-23 2021-07-20 北京新能源汽车股份有限公司 Program operation monitoring method and device and electric automobile
CN110727263B (en) * 2019-10-31 2021-02-26 南方电网调峰调频发电有限公司 Method for overhauling abnormal equipment action sequence and monitoring signal jitter state

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468517A (en) * 2015-11-10 2016-04-06 中国矿业大学 Statistical error positioning method based on reduction of black-box test case
CN105468505A (en) * 2014-08-12 2016-04-06 腾讯科技(深圳)有限公司 Coverage test method and coverage test device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2892261A1 (en) * 2005-10-17 2007-04-20 France Telecom METHOD AND SYSTEM FOR MANAGING APPLICATIONS OF A MOBILE TERMINAL

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468505A (en) * 2014-08-12 2016-04-06 腾讯科技(深圳)有限公司 Coverage test method and coverage test device
CN105468517A (en) * 2015-11-10 2016-04-06 中国矿业大学 Statistical error positioning method based on reduction of black-box test case

Also Published As

Publication number Publication date
CN105912447A (en) 2016-08-31

Similar Documents

Publication Publication Date Title
CN105912447B (en) A kind of monitoring method of embedded program execution sequence
CN112162878B (en) Database fault discovery method and device, electronic equipment and storage medium
Xie et al. A study of the modeling and analysis of software fault‐detection and fault‐correction processes
US10198340B2 (en) Application performance monitoring
JP6647824B2 (en) Error diagnosis system and error diagnosis method
US10861610B2 (en) Abnormality diagnosis system
US8892950B2 (en) Failure diagnosis method and apparatus using resource relationship map
KR930017047A (en) Method for monitoring the operation of the facility
CN113658414B (en) Mine equipment fault early warning method and device, terminal equipment and storage medium
CN107102929A (en) The detection method and device of failure
CN101482596B (en) Fast fault recognition method for multifactor industrial system
CN106649075A (en) Fuzzy testing method and device
CN111447167A (en) Safety protection method and device for vehicle-mounted system
CN112765161A (en) Alarm rule matching method and device, electronic equipment and storage medium
CN103383566B (en) A kind of program flow method for supervising
CN104486353B (en) A kind of security incident detection method and device based on flow
CN110704313B (en) JAVA virtual machine memory leakage detection method and device
CN112506802A (en) Test data management method and system
CN111752819A (en) Abnormity monitoring method, device, system, equipment and storage medium
CN107767977B (en) Safety control method and system for nuclear power station
CN116882695A (en) Automatic inspection method, device, computer equipment and storage medium
CN108304402A (en) Exterior chain availability monitor method and monitoring device
CN111240881A (en) Web service combination abnormity diagnosis method based on Bayesian network
CN111125720A (en) Information security and function security association analysis method
CN105827418B (en) A kind of communication network warning correlating method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: Water Pavilion Road Jiangning District moling street Nanjing City, Jiangsu province 211100 No. 1266

Patentee after: Nanjing Keyuan Intelligent Technology Group Co.,Ltd.

Address before: Water Pavilion Road Jiangning District moling street Nanjing City, Jiangsu province 211100 No. 1266

Patentee before: NANJING SCIYON AUTOMATION GROUP Co.,Ltd.

CP01 Change in the name or title of a patent holder