CN103383566A - Program stream monitoring method - Google Patents
Program stream monitoring method Download PDFInfo
- Publication number
- CN103383566A CN103383566A CN2013102537609A CN201310253760A CN103383566A CN 103383566 A CN103383566 A CN 103383566A CN 2013102537609 A CN2013102537609 A CN 2013102537609A CN 201310253760 A CN201310253760 A CN 201310253760A CN 103383566 A CN103383566 A CN 103383566A
- Authority
- CN
- China
- Prior art keywords
- subroutine
- program flow
- circulation
- identification code
- supervising
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 17
- 238000012544 monitoring process Methods 0.000 title claims abstract description 16
- 238000004891 communication Methods 0.000 claims description 3
- 238000012163 sequencing technique Methods 0.000 claims description 3
- 230000006870 function Effects 0.000 description 4
- 238000013461 design Methods 0.000 description 2
- 230000004913 activation Effects 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention relates to a program stream monitoring method which solves the problem of monitoring operation of a plurality of subprograms inside engine control software. Existing engines are all controlled in an electronic mode through engine controllers, and the control software of the engine controllers is generally composed of the subprograms. Due to the fact the operation of the engines is a circulating working condition which runs in cycles. For example, a four-stroke engine works continuously in a circulating mode in the four strokes of air inlet, compressing, acting and air exhausting. Therefore, the corresponding control software is used for conducting circulating calling on a series of subprograms in a corresponding engine four-stroke operation cycle to realize the control function. The order in which the subprograms in each cycle are called and the times for which the subprograms in each cycle are called are fixed.
Description
Technical field
The present invention relates to a kind of program flow method for supervising.
Background technology
The software program of engine controller is increasingly sophisticated, often formed by a plurality of subroutines, in the regular hour loop cycle, there are a plurality of subroutines to carry out by certain sequencing and number of times, whether how to monitor these subroutines carries out with number of times in the correct order, in order to can in time detect in software generation run time fault, not yet cause developer's attention.
Summary of the invention
The object of the present invention is to provide a kind of program flow method for supervising, when making the interior subroutine of engine controller software fail to carry out according to predefined procedure and number of times, can in time detect, thereby make software can take the fault counter-measure.
Before each circulation, produce a random number, increase a sub-program identification code in each subroutine; Utilize the MD5 algorithm that random number and subroutine identification code are calculated, if any one subroutine is not carried out by expection, the result that the MD5 algorithm calculates will be different from desired value, thereby find mistake.
Concrete technical scheme is as follows:
A kind of program flow method for supervising, adopt following steps:
(1) before the each circulation of program flow, produce a random number;
(2) increase a sub-program identification code in program flow in each subroutine;
(3) utilize the MD5 algorithm that random number and subroutine identification code are calculated;
(4) if any one subroutine is not carried out by expection, the result that the MD5 algorithm calculates will be different from desired value, thereby find mistake.
Further, described program flow is the software program of engine controller, is comprised of a plurality of subroutines, in the regular hour loop cycle, has a plurality of subroutines carry out and circulate by certain sequencing and number of times.
Further, step (3) specifically comprises the steps:
(3-1) in the circulation first invoked subroutine carry out finish before, carry out the MD5 computing after this random number being added oneself identification code, operation result is the numeral of 128;
Before (3-2) second invoked subroutine carried out and finished, carry out the MD5 computing after 128 bit digital that obtain after previous subroutine MD5 computing being added oneself identification code, generate 128 new bit digital,
(3-3) by that analogy, until in this time circulation, last invoked subroutine is carried out end, obtain 128 bit digital of calculating for the last time in this time circulation.
Further, step (4) specifically comprises the steps:
(4-1) control software and call a monitoring subroutine before circulation finishes;
(4-2) this monitoring subroutine by each subroutine expection in this circulation call order and number of times carries out the MD5 computing to random number and identification code corresponding to each subroutine;
128 bit digital of (4-3) previous step being calculated and front compare by 128 bit digital that each subroutine generates;
If (4-4) two numerals are consistent, in this time circulation of explanation, each subroutine is called by expection;
If (4-5) two numerals are inconsistent, the explanation this time circulate in-line subroutine calling the order or number of times mistake has occured.
Further, produce a random number by controlling software in step (1).
Further, described in step (2) between each subroutine identification code different.
Further, identification code represents with the numeral of a byte or a plurality of bytes in step (2), and its span covers all needs the subroutine number monitored in this circulation.
Further, each subroutine in circulating is successively called order and call number is monitored
Further, the MD5 algorithm is to be this area general information digest algorithm, is used for guaranteeing that communication is complete consistent.
Compare with present prior art, the present invention can effectively detect subroutine and leak execution, many execution, the incorrect mistake of execution sequence; Scheme is easy, is easy to realize.
Description of drawings
Fig. 1 is program flow monitoring process flow diagram of the present invention
Embodiment
The below describes the present invention with reference to the accompanying drawings, and it is a kind of preferred embodiment in numerous embodiments of the present invention.
A kind of program flow monitoring scheme solves the problem of a plurality of subprogram activation monitorings in engine control software.The control of Modern Engine is all to carry out Electronic Control by engine controller, generally is comprised of a plurality of subroutines in the control software of engine controller.Because the operation of engine is a kind of state of cyclic operation that goes round and begins again, be exactly constantly periodic duty in air inlet, compression, acting and four strokes of exhaust as Otto cycle engine.Therefore corresponding control software is also in a corresponding engine four-stroke-cycle operation circulation, a series of subroutine to be carried out recursive call, realizes controlling function.Subroutine in each circulation successively calls order and call number is changeless.
For each subroutine in circulating successively being called order and call number is monitored, to identification code of each subroutine arrangement, between each subroutine, identification code is different, has uniqueness.Identification code can represent with the numeral of a byte or a plurality of bytes, and its span covers all needs the subroutine number monitored in this circulation.
During each circulation beginning, control software and produce a random number, subsequently in the circulation first invoked subroutine carry out finish before, carry out the MD5 computing after this random number being added oneself identification code, operation result is the numeral of 128.Before second invoked subroutine carried out and finished, carry out the MD5 computing after 128 bit digital that obtain after previous subroutine MD5 computing being added oneself identification code, generate 128 new bit digital.By that analogy, until in this time circulation, last invoked subroutine is carried out end, obtain 128 bit digital of calculating for the last time in this time circulation.
Then control software and call a monitoring subroutine before this circulation finishes, this monitoring subroutine by each subroutine expection in this circulation call order and number of times carries out the MD5 computing to random number and identification code corresponding to each subroutine, 128 bit digital and the front of calculating compared by 128 bit digital that each subroutine generates.If two numerals are consistent, in this time circulation of explanation, each subroutine is called by expection; If two numerals are inconsistent, the explanation this time circulate in-line subroutine calling the order or number of times mistake has occured.
The MD5 algorithm is a kind of message digest algorithm, is used for guaranteeing that communication is complete consistent, and main flow programming language generally existing MD5 is realized.The present invention utilizes this algorithm that program flow is monitored, and guarantees that program flow is consistent with expection.
For this programme better is described, be below an example of the present invention explanation:
Suppose that an engine control circulation comprises subroutine A, subroutine B and subroutine C, the identification code that subroutine A is set is 1, and the identification code of subroutine B is 2, and the identification code of subroutine C is 3.Design in addition a monitoring subroutine M.Complete engine control circulation need successively call subroutine A, subroutine B and subroutine C each once, then call monitoring subroutine M and monitor.As shown in Figure 1:
During call subroutine A, subroutine A is except completing the control function that originally engine needs, and the random number R that also this circulation is generated adds that identification code 1 carries out MD5 and calculate, and obtains the digital MD5_A of 128.During call subroutine B, subroutine B also adds that to the MD5_A of input identification code 2 carries out MD5 and calculate except completing the control function that originally engine needs, obtain the digital MD5_B of 128.During call subroutine C, subroutine C also adds that to the MD5_B of input identification code 3 carries out MD5 and calculate except completing the control function that originally engine needs, obtain the digital MD5_C of 128.
Monitoring subroutine M the verification of carrying out MD5 by operation order and the number of times of each subroutine expection calculated.In this example, monitoring subroutine M adds that with random number R identification code 1 carries out for the first time MD5 and calculate, 128 bit digital that obtain add that identification code 2 carries out for the second time MD5 and calculate, 128 bit digital that obtain add that identification code 3 carries out for the third time MD5 and calculate, and obtain at last the digital MD5_M of 128.
Relatively whether MD5_C and these two numerals of MD5_M equate, if equate illustrate that each subroutine is the subroutine A-according to expection in this circulation〉subroutine B-〉subroutine C, and each subroutine is only moved, and once mode carries out.If unequal, illustrate that each subroutine is called order in this circulation or mistake has appearred in number of times.
The above is exemplarily described the present invention by reference to the accompanying drawings; obviously specific implementation of the present invention is not subject to the restrictions described above; as long as the various improvement of having adopted method design of the present invention and technical scheme to carry out; or directly apply to other occasion without improvement, all within protection scope of the present invention.
Claims (9)
1. a program flow method for supervising, is characterized in that, adopts following steps:
(1) before the each circulation of program flow, produce a random number;
(2) increase a sub-program identification code in program flow in each subroutine;
(3) utilize the MD5 algorithm that random number and subroutine identification code are calculated;
(4) if any one subroutine is not carried out by expection, the result that the MD5 algorithm calculates will be different from desired value, thereby find mistake.
2. program flow method for supervising as claimed in claim 1, it is characterized in that, described program flow is the software program of engine controller, is comprised of a plurality of subroutines, in the regular hour loop cycle, there are a plurality of subroutines carry out and circulate by certain sequencing and number of times.
3. program flow method for supervising as claimed in claim 1 or 2, is characterized in that, step (3) specifically comprises the steps:
(3-1) in the circulation first invoked subroutine carry out finish before, carry out the MD5 computing after this random number being added oneself identification code, operation result is the numeral of 128;
Before (3-2) second invoked subroutine carried out and finished, carry out the MD5 computing after 128 bit digital that obtain after previous subroutine MD5 computing being added oneself identification code, generate 128 new bit digital,
(3-3) by that analogy, until in this time circulation, last invoked subroutine is carried out end, obtain 128 bit digital of calculating for the last time in this time circulation.
4. program flow method for supervising as described in any one in claim 1-3, is characterized in that, step (4) specifically comprises the steps:
(4-1) control software and call a monitoring subroutine before circulation finishes;
(4-2) this monitoring subroutine by each subroutine expection in this circulation call order and number of times carries out the MD5 computing to random number and identification code corresponding to each subroutine;
128 bit digital of (4-3) previous step being calculated and front compare by 128 bit digital that each subroutine generates;
If (4-4) two numerals are consistent, in this time circulation of explanation, each subroutine is called by expection;
If (4-5) two numerals are inconsistent, the explanation this time circulate in-line subroutine calling the order or number of times mistake has occured.
5. program flow method for supervising as described in any one in claim 1-4, is characterized in that, produces a random number by controlling software in step (1).
6. program flow method for supervising as described in any one in claim 1-5, is characterized in that, described in step (2) between each subroutine identification code different.
7. program flow method for supervising as described in any one in claim 1-6, it is characterized in that, identification code represents with the numeral of a byte or a plurality of bytes in step (2), and its span covers all needs the subroutine number monitored in this circulation.
8. program flow method for supervising as described in any one in claim 1-7, is characterized in that, each subroutine in circulating is successively called order and call number is monitored.
9. program flow method for supervising as described in any one in claim 1-8, is characterized in that, the MD5 algorithm is to be this area general information digest algorithm, is used for guaranteeing that communication is complete consistent.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310253760.9A CN103383566B (en) | 2013-06-24 | 2013-06-24 | A kind of program flow method for supervising |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310253760.9A CN103383566B (en) | 2013-06-24 | 2013-06-24 | A kind of program flow method for supervising |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103383566A true CN103383566A (en) | 2013-11-06 |
CN103383566B CN103383566B (en) | 2015-10-28 |
Family
ID=49491389
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310253760.9A Active CN103383566B (en) | 2013-06-24 | 2013-06-24 | A kind of program flow method for supervising |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103383566B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105955115A (en) * | 2016-05-10 | 2016-09-21 | 重庆长安汽车股份有限公司 | Method and device for monitoring program flow of whole automobile controller |
CN106776236A (en) * | 2017-02-07 | 2017-05-31 | 北京龙鼎源科技股份有限公司 | The method and apparatus of the execution of monitoring program |
CN108646708A (en) * | 2018-05-02 | 2018-10-12 | 阳光电源股份有限公司 | A kind of program flow monitoring method and system |
CN110135198A (en) * | 2019-02-18 | 2019-08-16 | 北京车和家信息技术有限公司 | Program flow monitoring method, system and vehicle |
CN111427723A (en) * | 2020-03-19 | 2020-07-17 | 阳光电源股份有限公司 | Program flow monitoring method based on AutoSAR and application device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1154771A (en) * | 1994-07-29 | 1997-07-16 | 荷兰皇家·Ptt·有限公司 | Method and apparatus for the verification of data sequences |
US7168065B1 (en) * | 1999-03-09 | 2007-01-23 | Gemplus | Method for monitoring program flow to verify execution of proper instructions by a processor |
CN101166087A (en) * | 2007-09-30 | 2008-04-23 | 奇瑞汽车有限公司 | A secure validation method for car diagnosis communication |
CN101533367A (en) * | 2008-03-14 | 2009-09-16 | 英业达股份有限公司 | Method for analyzing program errors and production method of interpretation data thereof |
CN101763291A (en) * | 2009-12-30 | 2010-06-30 | 中国人民解放军国防科学技术大学 | Method for detecting error of program control flow |
US20130145219A1 (en) * | 2011-12-02 | 2013-06-06 | Fisher Controls International Llc | Program flow control monitoring routines, related methods and systems |
-
2013
- 2013-06-24 CN CN201310253760.9A patent/CN103383566B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1154771A (en) * | 1994-07-29 | 1997-07-16 | 荷兰皇家·Ptt·有限公司 | Method and apparatus for the verification of data sequences |
US7168065B1 (en) * | 1999-03-09 | 2007-01-23 | Gemplus | Method for monitoring program flow to verify execution of proper instructions by a processor |
CN101166087A (en) * | 2007-09-30 | 2008-04-23 | 奇瑞汽车有限公司 | A secure validation method for car diagnosis communication |
CN101533367A (en) * | 2008-03-14 | 2009-09-16 | 英业达股份有限公司 | Method for analyzing program errors and production method of interpretation data thereof |
CN101763291A (en) * | 2009-12-30 | 2010-06-30 | 中国人民解放军国防科学技术大学 | Method for detecting error of program control flow |
US20130145219A1 (en) * | 2011-12-02 | 2013-06-06 | Fisher Controls International Llc | Program flow control monitoring routines, related methods and systems |
Non-Patent Citations (1)
Title |
---|
李红兵 等: "一种检测程序控制流故障的方法", 《微计算机信息》 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105955115A (en) * | 2016-05-10 | 2016-09-21 | 重庆长安汽车股份有限公司 | Method and device for monitoring program flow of whole automobile controller |
CN106776236A (en) * | 2017-02-07 | 2017-05-31 | 北京龙鼎源科技股份有限公司 | The method and apparatus of the execution of monitoring program |
CN106776236B (en) * | 2017-02-07 | 2020-05-08 | 北京龙鼎源科技股份有限公司 | Method and apparatus for monitoring execution of a program |
CN108646708A (en) * | 2018-05-02 | 2018-10-12 | 阳光电源股份有限公司 | A kind of program flow monitoring method and system |
CN110135198A (en) * | 2019-02-18 | 2019-08-16 | 北京车和家信息技术有限公司 | Program flow monitoring method, system and vehicle |
CN110135198B (en) * | 2019-02-18 | 2021-06-22 | 北京车和家信息技术有限公司 | Program flow monitoring method and system and vehicle |
CN111427723A (en) * | 2020-03-19 | 2020-07-17 | 阳光电源股份有限公司 | Program flow monitoring method based on AutoSAR and application device |
CN111427723B (en) * | 2020-03-19 | 2023-05-30 | 阳光电源股份有限公司 | AutoSAR-based program flow monitoring method and application device |
Also Published As
Publication number | Publication date |
---|---|
CN103383566B (en) | 2015-10-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103383566A (en) | Program stream monitoring method | |
WO2017020721A1 (en) | Service function testing method and device | |
CN106503563B (en) | Batch leak detection method based on general framework | |
US8140901B2 (en) | Validation of processors using a self-generating test case framework | |
CN110597393B (en) | Motor vibration control method and device and computer readable storage medium | |
CN110262848B (en) | Method and device for loading application program instance in application development framework | |
CN111143165A (en) | Monitoring method and device | |
CN105912447B (en) | A kind of monitoring method of embedded program execution sequence | |
CN107766247B (en) | Method and device for testing Bootloader and readable storage medium | |
CN106095609B (en) | Walking data check, modification method and system | |
CN110928778A (en) | Endless loop positioning method and device, computer equipment and storage medium | |
CN110737439A (en) | Equipment control system and method based on rule file | |
CN109343856A (en) | The generation method and device of custom algorithm component | |
CN107015846B (en) | Simulation method and device for realizing eukaryon simulation of processor | |
CN112783705B (en) | Test method, device, system, chip and electronic equipment | |
CN114779913B (en) | Resetting method and chip for adaptively adjusting working frequency | |
CN116300821A (en) | Voltage regulator fault diagnosis method and device and electronic equipment | |
Chimisliu et al. | Using dependency relations to improve test case generation from UML statecharts | |
Wang et al. | A static analysis tool with optimizations for reachability determination | |
US11188378B2 (en) | Management of control parameters in electronic systems | |
CN110519389B (en) | Parameter adjusting method and device for engineering equipment, engineering equipment and storage medium | |
CN111522635A (en) | Computing task processing method, device, server and storage medium | |
CN111427723B (en) | AutoSAR-based program flow monitoring method and application device | |
WO2020169997A1 (en) | Method for improving safety of a component or system running a firmware or a finite state machine | |
Yokogawa et al. | Consistency verification of UML diagrams based on process bisimulation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |