CN101599039A - Abnormality eliminating method and device under the embedded type C language environment - Google Patents

Abnormality eliminating method and device under the embedded type C language environment Download PDF

Info

Publication number
CN101599039A
CN101599039A CNA2008101000605A CN200810100060A CN101599039A CN 101599039 A CN101599039 A CN 101599039A CN A2008101000605 A CNA2008101000605 A CN A2008101000605A CN 200810100060 A CN200810100060 A CN 200810100060A CN 101599039 A CN101599039 A CN 101599039A
Authority
CN
China
Prior art keywords
unusual
exception
thread
unusually
exception handler
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
Application number
CNA2008101000605A
Other languages
Chinese (zh)
Other versions
CN101599039B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN2008101000605A priority Critical patent/CN101599039B/en
Priority to PCT/CN2009/070492 priority patent/WO2009146612A1/en
Publication of CN101599039A publication Critical patent/CN101599039A/en
Application granted granted Critical
Publication of CN101599039B publication Critical patent/CN101599039B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms

Landscapes

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

Abstract

The embodiment of the invention provides the abnormality eliminating method under a kind of embedded type C language environment, comprise: the code segment that needs protection that monitoring is moving, if described code segment occurs unusual, it is described unusual then to dish out, and describedly comprises at least a in software anomaly, the hardware anomalies unusually; Described unusual according to what obtain, determine corresponding exception handler, described unusual by described exception handler processing, wherein, described exception handler and described code segment are separate.The present invention also provides the device of the abnormality processing under a kind of embedded type C language environment.

Description

Abnormality eliminating method and device under the embedded type C language environment
Technical field
The present invention relates to C language technology, relate in particular to abnormality processing technology under the embedded type C language environment.
Background technology
Unusually be meant the unusual situation that hardware or software program occur when operation.Under embedded type C language environment, traditional abnormality eliminating method is when noting abnormalities, to restart system.With the program exception is example, can be by the unusual recognition capability of CPU, whether occur unusual during the scrutiny program operation, in case occur unusual during the operation of CPU discovery procedure, then call exception handler, to comprise register, current stack, call stack under interior abnormal information is preserved, finish processing by uniform way then.That is, for occurring in unusual in the task, debug version is hung up this task down, restarts embedded system in official release, for occurring in unusual in the interruption, then all handles in the mode of restarting embedded system.
The inventor finds through after scrutinizing prior art, increase day by day along with software complexity, system restart need be longer time, and product is shorter and shorter to requirement break period of system, do not interrupt when even wishing system's operation, and under embedded type C language environment, traditional abnormality eliminating method can't satisfy such demand.
Summary of the invention
The embodiment of the invention is to provide abnormality eliminating method, device and embedded system under a kind of embedded type C language environment, in order to realize shortening the break period of system when taking place unusually, does not perhaps interrupt.
Abnormality eliminating method under a kind of embedded type C language environment, comprise: the code segment that needs protection that monitoring is moving, if described code segment occurs unusual, it is described unusual then to dish out, and describedly comprises at least a in software anomaly, the hardware anomalies unusually; Described unusual according to what obtain, determine corresponding exception handler, described unusual by described exception handler processing, wherein, described exception handler and described code segment are separate.
Abnormality processing device under a kind of embedded type C language environment comprises: monitoring unit is used to monitor the code segment of moving that needs protection; Unusually the unit of dishing out, be used for described monitoring unit find described code segment occur unusual after, it is described unusual to dish out, and describedly comprises at least a in software anomaly, the hardware anomalies unusually; Matching unit is used for described unusually according to what obtain, determines corresponding exception handler, and described exception handler is used to handle unusual that the described unit of dishing out unusually dishes out, and wherein, described exception handler and described code segment are separate.
Withdraw from the method for thread or process under a kind of embedded type C language environment, be applied to the scene that thread initiatively withdraws from, comprising: obtain the information that thread or process need withdraw from; Unusually whether thread that inspection need be withdrawed from or process are dished out still takies resource; If then discharge the described resource that takies; Withdraw from described thread or process.
Withdraw from the device of thread or process under a kind of embedded type C language environment, comprising: the information acquisition unit is used to obtain the information that thread or process need withdraw from; The resource inspection unit is used for after described information acquisition unit obtains information that thread or process need withdraw from, and unusually whether thread that inspection need be withdrawed from or process are dished out still takies resource; The resource releasing unit is used for unusually still taking resource what described resource inspection unit checked out that the thread that need withdraw from or process dish out, discharges the described resource that takies; Withdraw from the unit, be used for after described resource releasing unit discharges the described resource that takies, withdrawing from described thread or process.
A kind of embedded type C language environment is deleted the method for thread or process down, is applied to current thread or process by the scene of other threads or process-kill, comprising: thread or the process of determining the needs deletion; Unusually whether what check to need that the thread of deletion or process dish out still takies resource; If then discharge the described resource that takies; Delete described thread or process.
A kind of embedded type C language environment is deleted the device of thread or process down, comprising: determining unit is used for thread or the process of determining that needs are deleted; The resource inspection unit is used for after described determining unit is determined the thread or process of needs deletion, check need that the thread that delete or process dish out unusually whether still take resource; The resource releasing unit is used for unusually still taking resource what described resource inspection unit checked out that the thread of needs deletions or process dish out, discharges the described resource that takies; Thread or process-kill unit are used for deleting described thread or process after described resource releasing unit discharges the described resource that takies.
A kind of embedded system comprises above-mentioned abnormality processing device.
Under the embedded type C language environment of the embodiment of the invention in abnormality eliminating method, device and the embedded system, if code segment occurs unusual, it then not simple rerun routine code snippet, but handle unusually by the exception handler that is independent of code segment, like this, program is in when operation, just can not be because of unusual and interrupt run, and satisfied the demand of interrupting has taken place when product is not wished system's operation.
Under the embedded type C language environment of the embodiment of the invention, withdraw from or delete in the method for thread or process, no matter be to withdraw from or delete thread or process, can discharge the unusual shared resource that processing threads or process are dished out, like this, when other threads or process need be used these resources, can unusually still not take resource and cause other threads or process can't use these resources because of what deletion or the thread that withdraws from or process were dished out.In addition, can also delete the thread of required deletion by other threads, thus the abnormality processing can realize cross-thread deletion thread the time.
Description of drawings
Fig. 1 is the process flow diagram of abnormality eliminating method under the embedded type C language environment of the embodiment of the invention;
Fig. 2 is the structural representation of abnormality processing device under the embedded type C language environment of the embodiment of the invention;
Fig. 3 is the synoptic diagram of the corresponding different Exception Type of the different exception handler of the embodiment of the invention;
Fig. 4 is the process flow diagram of abnormality eliminating method one specific embodiment under the embedded type C language environment of the present invention;
Fig. 5 stores storage layout's synoptic diagram of unusual relevant information for the heap space of the embodiment of the invention;
Fig. 6 is the realization flow figure of the try piece of the embodiment of the invention;
Fig. 7 is the realization flow figure of the except piece of the embodiment of the invention;
Fig. 8 is the realization flow figure of certain specific exceptions of seizure of the embodiment of the invention;
Fig. 9 is that the unusual realization flow figure of appointment is handled in the seizure of the embodiment of the invention;
Figure 10 is the seizure of the embodiment of the invention and handles unusual realization flow figure interior between a certain exceptions area;
Figure 11 is the realization flow figure of the throw piece of the embodiment of the invention;
Figure 12 is the process flow diagram of precision management method of the abnormality processing of the embodiment of the invention;
Figure 13 is the process flow diagram of the method that withdraws from thread or process of the embodiment of the invention;
Figure 14 is the structural representation of the device that withdraws from thread or process of the embodiment of the invention;
Figure 15 is the process flow diagram of the method for the deletion thread of the embodiment of the invention or process;
Figure 16 is the structural representation of the device of the deletion thread of the embodiment of the invention or process.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in further detail.
In embodiments of the present invention, for writing pointed exception handler according to different scenes unusually in the embedded system under the C language environment, carrying out local anomaly handles and attempts to recover, and needn't unusually all make to restart system handles to all, after finishing, abnormality processing continues to carry out, thereby the code operational efficiency under the raising normal flow has also been simplified programming.The realization of abnormality processing framework (convenient understanding can be described as the abnormality processing device) does not rely on compiler in the embedded system under the C language environment, and offers the user carries out precision management to the abnormality processing framework method.
In the embodiment of the invention, provide the abnormality eliminating method under the multiple embedded type C language environment, a kind of method wherein comprises as shown in Figure 1:
Step S101: the code segment that needs protection that monitoring is moving;
Step S102: unusual if described code segment occurs, it is described unusual then to dish out, and describedly comprises at least a in software anomaly, the hardware anomalies unusually;
Need to prove: the scheme of the embodiment of the invention is not only applicable to software anomaly, also is applicable to hardware anomalies; When hardware anomalies takes place after, can attempt recovering unusual, avoid restarting system;
Step S103: described unusual according to what obtain, determine corresponding exception handler, described unusual by described exception handler processing, wherein, described exception handler and described code segment are separate.For other precision management of abnormality processing level when dishing out unusually is provided, in embodiments of the present invention, the step of the code segment that needs protection that described monitoring is moving is specially: according to the unusual granularity of processing that is provided with, and the code segment that needs protection that monitoring is moving;
When a program carry out to trigger when unusual, under a kind of realizations,, then monitor the described code segment of moving that needs protection when the code segment of moving that needs protection during more than or equal to the unusual granularity of the processing of setting;
When the code segment of moving that needs protection during less than the unusual granularity of the processing that is provided with, then do not monitor the described code segment of moving that needs protection, that is to say, just do not need to carry out follow-up step; Here, the unusual granularity of the processing of described setting comprises at least a in function rank, module level, the parts rank, and wherein, described module is made up of a plurality of functions, and described parts are made up of a plurality of modules.For example, the user is the function rank in the unusual granularity of debug phase set handling; After code was stable, the granularity that user's set handling is unusual was a module level, then code unusual in identification module level when unusual of dishing out.
In embodiments of the present invention, described method further comprises: application is used to write down the storage space with relevant unusually information; Then, described code segment occur unusual after, dish out described unusual before, record and relevant information unusually.Should be understood that: will be recorded in the storage space of application with unusual relevant information.
In embodiments of the present invention, the described described unusual step of dishing out, under a kind of realization, be specially: will pass after the described and unusual relevant information package, here, described and unusual relevant information comprises the Exception Type sign at least, should be noted that: Exception Type sign is the information of the unusual type that is used to represent that the present procedure code snippet occurs, can adopt numeral in form, perhaps character, the perhaps combination of numeral and character, for example: adopt the different Exception Types of different string representations.
Should be understood that: the embodiment of the invention is suitable for dissimilar unusual, under a kind of realization, distribute different signs can in advance different concrete Exception Types, for example: with unified unusually a, b, c, d, e, the f (group) of being divided into, and which being distinguished with another sign simultaneously is software anomaly, which is hardware anomalies (a big class), for example: 1 expression software anomaly; 0 expression hardware anomalies; Need to prove: this only is an example, is not used in restriction embodiment of the invention scheme.
In embodiments of the present invention, described unusual according to what obtain, determine corresponding exception handler, handle described unusual step by described exception handler, under a kind of realization, can comprise:
Acquisition that pass over unusual relevant information, comprise Exception Type in the described and unusual relevant information and identify;
Determine and the corresponding exception handler that Exception Type mated of described Exception Type sign, handle described unusual by described exception handler.Therefore, the embodiment of the invention is at the dissimilar different disposal of carrying out unusually, avoids prior art running into when unusual, restarts system, causes long problem of system break time.
Determine and the corresponding exception handler that Exception Type mated of described Exception Type sign, handle described unusual step by described exception handler and comprise:
When the corresponding Exception Type of described Exception Type sign during with treatable a kind of special Exception Type coupling, should be unusually by handling with the exception handler of this Exception Type coupling;
Or, when the corresponding Exception Type of described Exception Type sign and a kind of Exception Type in the treatable at least a Exception Type mate, should be unusual by handling with the exception handler of this Exception Type coupling, wherein, treatable at least a Exception Type can be the type of array appointment, or the type between exceptions area;
Or, when existing when can handle the unusual exception handler of any kind, determine to handle described unusual by the unusual exception handler of this coupling any type.
It will be appreciated that: under a kind of realization, can determine and the corresponding exception handler that Exception Type mated of described Exception Type sign by grand, this grand form is EXCEPT, and this is grand can to have the Exception Type parameter, also can not have the Exception Type parameter;
Under this grand situation that has an Exception Type parameter, concrete matching process can comprise: obtain thread abnormal information (promptly with unusual relevant information); Judge in the thread abnormal information Exception Type sign whether with the Exception Type parameter in a kind of coupling; If coupling is then carried out corresponding exception handler; If do not match, then transmit (dishing out) abnormal information again.
Under this grand situation that does not have an Exception Type parameter, unusually all will being handled of any kind by corresponding exception handler, in other words, in case the grand acquisition of EXCEPT is unusual, just transfer to and go to handle unusual, also just played the unusual effect of all types of catching with the nearest exception handler in described code segment position.This is grand when not having the Exception Type parameter, and the abnormal information that comprises the Exception Type sign is delivered to still that the except piece is grand to deal with, the exception handler that the user writes can not add differentiation unify handle.
The method of the embodiment of the invention further comprises: if during the current exception handler that does not exist with this Exception Type coupling, with passing again of obtaining with unusual relevant information, perhaps, when all unmatching, start default handler, the described default handler starting system of attaching most importance to.
For the precision management to the abnormality processing mode further is provided, in embodiments of the present invention, described unusual according to what obtain, determine corresponding exception handler, handle described unusual step by described exception handler, under another kind is realized, can comprise:
Acquisition that pass over unusual relevant information, comprise in the described and unusual relevant information that Exception Type identifies, the designated treatment mode identifies; Need to prove: can identify the different designated treatment mode of expression by different designated treatment modes, for example: the fault-tolerant processing mode of 1 expression; The processing mode of 0 expression debugging.
Determine that the Exception Type corresponding with described Exception Type sign mates, and identify the exception handler that corresponding processing mode is mated, handle described unusual by described exception handler with described designated treatment mode.Wherein, processing mode can be fault-tolerant or debugging.
When described processing mode is the fault-tolerant processing mode, handle described unusual by the exception handler of fault-tolerant way; When described processing mode is the debugging processing mode, handle described unusually by the exception handler of debugging mode, wherein, described exception handler and described code segment are separate.
If current the existence and this Exception Type coupling, and during with the exception handler of the processing mode coupling of appointment, with passing again of obtaining with unusual relevant information, perhaps, when all unmatching, start default handler, the described default handler starting system of attaching most importance to.
Therefore, the embodiment of the invention not only can realize carrying out different processing unusually at dissimilar, and the mode that can also be provided with according to the user is to handling with different processing modes unusually, for example, in the development phase, to the abnormity processing main method is that catching exception is handled wrong and output error, and when the product issue was finished in exploitation, the main method of abnormality processing was fault-tolerant recovery.Exception handler in the embodiment of the invention can also mate and handle polytype unusual.
If the exception handler that has a plurality of and described Exception Type to be complementary, the step of then determining the exception handler that Exception Type mated corresponding with described Exception Type sign is: definite and described Exception Type identifies that corresponding Exception Type mated, and an exception handler nearest with described code segment position.
If occur unusual when described code segment is called, then by described exception handler handle described unusual after, also comprise: return the normal postrun result of described code segment step by step, perhaps operation and code segment it after adjacent with described exception handler; Thereby further improve the code operational efficiency under the normal flow.
Under a kind of realization, by coupling and catch abnormal function grandly mate and catch unusually; By the grand code segment of moving that needs protection of monitoring with monitoring function; By have an abnormal function of dishing out grand dish out described unusual.
Concrete, code segment can be meant function, also can be meant the module of being made up of a plurality of functions, can also be meant the parts of being made up of a plurality of modules, certainly, code segment can also be other other program segments of level, enumerates no longer one by one here.Under embedded type C language environment, can grandly come the watchdog routine code snippet by what have a monitoring function, for example can be by the setjmp () function of encapsulation C language grand.
When code segment occurs in operational process when unusual, it is unusual to dish out, and dish out unusual before, can write down and unusual relevant information, like this, dish out when unusual, can dish out and relevant information unusually.Both software anomaly information can be comprised with unusual relevant information, also hardware anomalies information can be comprised.Under embedded type C language environment, can by have an abnormal function of dishing out grand dish out unusual, for example can be by the longjmp () function of encapsulation C language grand.
At the code segment that needs protection, can set up at least one exception handler.Each exception handler can mate and handle one type unusual, also can mate and handle polytype unusual.Different exception handlers can be handled same type unusual, when being dished out unusually, it is such unusual therefrom to select an exception handler to handle, for example, can select one with the nearest exception handler of described code segment handle described unusually.Concrete, supposing has program A, program B and program C etc. can handle same unusual exception handler respectively after certain code segment, when code segment is dished out when unusual, if there is not special setting, then generally all handle described unusual by program A (after code segment, the most forward with respect to this code segment) in all positions of can handling in the described unusual exception handler.
Need to prove, exception handler and code segment are separate, have two advantages like this at least: first advantage is, if it is unusual that code segment does not occur in operational process, then exception handler can not be performed, thereby do not influence the normal operation of code segment, objectively improved the operational efficiency of code segment yet; Whether second advantage be, can provide to the user to handle unusual by exception handler or which kind of exception handler to handle unusual selection by.
In actual applications, code segment may be in invoked procedure, occur unusual, by the exception handler that is complementary with described unusual type handle described unusual after, that can return step by step is the normal postrun result of code segment.For example, function A call function B, function B call function C, if it is unusual that function C took place in when operation, and existence and the exception handler that unusual type is complementary, then can handle unusually by exception handler, after handling unusually, function C can normally be moved, and the result of its normal operation can return to function B, and function B returns to function A with the operation result of function B again.This shows, even during function B call function C, the function C operation occurs unusual, but for function A and function B, this or these unusually all are not found, and that function A and function B obtain is respectively the result of the normal operation of function B and the result of the normal operation of function C.In addition, by the exception handler that is complementary with described unusual type handle described unusual after, also can move the code segment after the described exception handler.Still be example with top example, even handle unusual by exception handler, but no longer return the execution function C, but carry out follow-up code segment, follow-up code segment can be meant code segment adjacent with exception handler and after its position, also can be meant exception handler any one code segment afterwards.
Under embedded type C language environment, can by by realize with the C language have coupling and catch abnormal function grandly mate and catch unusually, return else branch grand of non-0 value after for example can being called by the setjmp () function that encapsulates the C language.
Abnormality processing device under a kind of embedded type C language environment wherein (also can be called the abnormality processing framework) as shown in Figure 2, comprising:
Monitoring unit 201 is used to monitor the code segment of moving that needs protection;
Unusually the unit 202 of dishing out, be used for monitoring unit 201 find described code segment occur unusual after, it is described unusual to dish out, and describedly comprises at least a in software anomaly, the hardware anomalies unusually;
Matching unit 203 is used for described unusually according to what obtain, determines corresponding exception handler, and described exception handler is used to handle unusual that the described unit of dishing out unusually dishes out, and wherein, described exception handler and described code segment are separate.
Under embedded type C language environment, the macroblockization that will have monitoring function is a monitoring unit, for example can be setjmp () function grand of encapsulation C language.
In addition, said apparatus can also comprise:
Information recording unit 204 is used to write down the unusual relevant information of the described code segment appearance of finding with monitoring unit 201, and exports to the described unit 202 of dishing out unusually.Like this, dishing out when unusual in the unit 202 of dishing out unusually, can dish out and unusual relevant information.Both software anomaly information can be comprised with unusual relevant information, also hardware anomalies information can be comprised.Under the C language environment, the macroblockization that will have an abnormal function of the dishing out unit 202 of promptly dishing out unusually for example can be longjmp () function grand of encapsulation C language.
Unusually the unit 202 of dishing out is first unit of dishing out unusually, be used for after monitoring unit 201 finds that described code segment occurs unusually, to pass after the described and unusual relevant information package, described and unusual relevant information comprises the Exception Type sign at least, and described Exception Type sign is used to represent the unusual type of present procedure code snippet appearance.
Matching unit 203 is first matching unit, that be used to obtain to pass over and unusual relevant information, comprise the Exception Type sign in the described and unusual relevant information, and determine and the corresponding exception handler that Exception Type mated of described Exception Type sign, handle described unusual by described exception handler.
Matching unit 203 is second matching unit, that be used to obtain to pass over and unusual relevant information, comprise the Exception Type sign in the described and unusual relevant information, the designated treatment mode identifies, and determine that the Exception Type corresponding with described Exception Type sign mates, and identify the exception handler that corresponding processing mode is mated with described designated treatment mode, handle described unusual by described exception handler.For example, other exception handler of function level can be set, the exception handler of module level also can be set, other exception handler of component-level can also be set, suppose that corresponding these three other exception handlers of level can both handle the unusual of same type, but processing mode has nothing in common with each other.The user can select to handle unusual rank; suppose that the user has selected module level; the processing mode of the exception handler that it is corresponding is a fault-tolerant processing; when the code segment that needs protection occurs in operational process unusually; then handling unusual is exactly the exception handler of module level correspondence; that is, to taking fault-tolerant way to handle unusually.
Processing mode can comprise multiple modes such as fault-tolerant and debugging, when code segment occurs can handling unusual according to the processing mode that is provided with when unusual.For example, if the processing mode that is provided with is the fault-tolerant processing mode, then can use the exception handler of fault-tolerant way to handle unusual.Again for example, if the set handling mode is the debugging processing mode, then can use the exception handler of debugging mode to handle unusually, wherein, exception handler and code segment are separate.
If the exception handler that has a plurality of and described unusual type to be complementary, matching unit 203 is the 3rd matching unit, be used for described unusual according to what obtain, definite and described unusual type is mated, and an exception handler nearest with described code segment position handled described unusual by described exception handler.
When program execution triggering was unusual, monitoring unit 201 was first monitoring unit, was used for according to the unusual described code segment of moving that needs protection of granularity monitoring of the processing that is provided with.For example: when the unusual granularity of processing that is provided with is module level, and the described code segment of moving that needs protection is the function rank, does not then just need to monitor the described code segment of moving that needs protection; When the unusual granularity of processing that is provided with is the function rank, and the described code segment of moving that needs protection is a module level, then monitors the described code segment of moving that needs protection; At the code segment that needs protection, can set up at least one exception handler.Each exception handler can mate and handle one type unusual, also can mate and handle polytype unusual.
Different exception handlers can be handled same type unusual, when dishing out when unusual in the unit 202 of dishing out unusually, it is such unusual therefrom to select an exception handler to handle by matching unit 203, for example, can select one to handle described unusual with the nearest exception handler of described code segment.
In actual applications, code segment may be to occur in invoked procedure unusually, determine the exception handler that is complementary with described unusual type at matching unit 203, by this exception handler handle described unusual after, code segment can be returned normal postrun result step by step.Under embedded type C language environment, the macroblockization that has coupling and catch abnormal function that will be realized by the C language be a matching unit 203, for example can be else branch grand that returns non-0 value after the setjmp () function of encapsulation C language is called.
Need to prove, because different exception handlers goes for different unusual, be convenient identification Exception Type, distribute different signs can for different Exception Types, for example: with unified unusually a, b, c, d, e, the f (group) of being divided into, and which being distinguished with another sign simultaneously is software anomaly, and which is hardware anomalies (a big class), for example: 1 expression software anomaly; 0 expression hardware anomalies.Concrete, as shown in Figure 3, at first obtain to pass over unusual relevant information (abbreviation abnormal information), comprise the Exception Type sign in this abnormal information, through grand coupling, determine the exception handler of the Exception Type coupling corresponding, handle the unusual of corresponding Exception Type by corresponding exception handler with this Exception Type sign.
Except that said method embodiment and abnormality processing framework embodiment, the present invention also provides embedded system, and described system comprises above-mentioned abnormality processing device (being the abnormality processing framework).Specifically see also above-mentionedly, repeat no more here the abnormality processing frame description.
Except that said method embodiment, the present invention also provides another one method embodiment.Concrete, as shown in Figure 4, comprising:
Step S401: executive routine code;
Step S402: judge whether to trigger unusually, if, then change step S403, otherwise, step S401 changeed;
Step S403:, determine the try piece (for convenience of description, here with try piece represent have monitoring function grand) corresponding with granularity according to handling unusual granularity;
Step S404: judge whether the try piece has except piece (for convenience of description, represent to have seizure and mate the grand of abnormal function with the except piece) here, if, change step S406, otherwise, step S405 changeed;
Step S405: determine the try piece of higher one-level granularity correspondence, change step S404;
Step S406: judge whether the except piece can be handled unusually, if, change step S407, otherwise, step S405 changeed;
Step S407: carry out the code of except piece, change step S401.
The embodiment of the invention is at first set up exception record information under embedded type C language environment, set up the storage and the TRANSFER MODEL of unusual relevant information, final related mechanism and the user interface unusually of realizing.
1. about exception record information:
Table 1 is a kind of form of expression of exception record information.
Exception Type Whether in interruption unusual (being error code during software anomaly) Unusually whether renewable sign Nested unusual CPU register exception record (being empty during software anomaly) The exceptional instructions address Unusual additional parameter number Unusual additional parameter information The non-conformance description character string
Table 1
Under embedded type C language environment, in order to realize abnormality processing, need definition exception record structure, abnormal information is kept in this structure, pass to the except piece, the except piece can decide the mode of processing according to exception record information.Exception record information is shown in the note in the following code:
Typedef struct _ VOS_SEH_REC // exception record information
{
VOS_UINT32 ulSehType; The hardware or the software anomaly type of // definition
VOS_UINT32 ulSehErrOrIntCode; Be error code information under the // software anomaly situation, whether sign is unusual in interruption under the hardware anomalies situation
VOS_UINT32 ulSehFlag; // unusually whether renewable sign
Struct _ VOS_SEH_REC*pSehNextRec; Nested unusual in the // recording exceptional processing procedure
VOS_EXC_REG_INFO*pExcRegs; It pointed to CPU register information record when //ulSehType was hardware anomalies, was empty during software anomaly
VOS_UINT32 ulSehAddr; The instruction address that // generation is unusual
VOS_UINT32 ulSehParaNums; // unusual additional parameter number
VOS_UINT32 a_SehInfo[EXC_MAX_PARA_NUM]; // unusual additional parameter information
VOS_CHAR scSehMsg[32]; // non-conformance description character string
}VOS_SEH_REC;
2: about the storage and the TRANSFER MODEL of unusual relevant information
Under embedded type C language environment, for supporting unusual nested processing and, need the unusual relevant information of storage, and select suitable storage and TRANSFER MODEL according to the characteristics of its life cycle to the multithreading abnormity processing.Unusual relevant information comprises: (1) each try piece is preserved the env information (info) of its operation context environmental; (2) the exception record information (being previously defined VOS_SEH_REC) after taking place unusually; (3) the abnormality control table of each thread.
Adopt the stack of thread scope to store and transmit from having the grand of the abnormal function of dishing out to grand information with coupling and seizure abnormal function, wherein, the required storage space of env information need satisfy the degree of depth of the maximum level of nesting of try piece, exception record information stores space then needs to satisfy once nested depth capacity, therefore, can consider with the thread to be unit, behind thread creation, distribute the thread heap space to store unusual relevant information, storage layout's signal can be with reference to Fig. 5.
Env information is the dynamic information of each thread normal operation period height, and each thread all keeps portion.Exc information (info) then only just occurs under thread operation exception situation, and each cross-thread can be shared use.
Env information is together in series all environment records that can recall and forms the abnormal ranges table, at the throw piece (for convenience of description, here represent to have the grand of abnormal function of dishing out with the throw piece) when operation show the except piece that obtains to be complementary by visiting this, and the information that this table storage unit need write down is as shown in table 2:
Interrupt background sign is set Record valid flag Unusual file (debugging, optional) is set Unusual row number (debugging, optional) is set The record chained list
Table 2
Concrete data structure is as follows:
Typedef struct_SEH_SCOPE_UNIT // abnormal ranges table
{
VOS_BOOL blIntFlag; // whether interrupting under the background sign being set
Jmp_buf seh_env; // record valid flag
#ifdef SEH_DEBUG//unusual debugging
VOS_CHAR*pSehSetFile; // unusual file is set
VOS_UINT32 ulSehSetLine; // unusual row number is set
#endif
Struct_SEH_SCOPE_UNIT*seh_next; // record chained list
}SEH_SCOPE_UNIT;
Exc information is noted exception record information, when throw piece (being equivalent to the unit of dishing out unusually in the said apparatus) is operated, this structure is passed to the except piece (being equivalent to the matching unit in the said apparatus) that is complementary as information parameter to be handled, if wherein generation is nested unusually, then information is connected.Need the information of record as shown in table 3:
The information effective marker Exception record information
Table 3
Concrete data structure is as follows:
typedef?struct_SEH_EXC_INFO
{
VOS_UINT32 ulMagic; // information effective marker
VOS_SEH_REC seh_rec; // exception record
}SEH_EXC_INFO;
The SEH_EXC_INFO buffer zone that each cross-thread is shared distributes the control information table as shown in table 4:
Unusual maximum information piece number Assignment information piece number Idle abnormal information piece chained list
Table 4
Concrete data structure is as follows:
Typedef struct_SEH_INFO_BUF_CTRL // buffer zone distributes the control information table
{
VOS_UINT32 ulMaxExcInfoNum; // unusual maximum information piece number
VOS_UINT32 ulUsedExcInfoNum; // assignment information piece number
SEH_EXC_INFO*pExcInfoBufFreeLink; // idle abnormal information piece chained list
}SEH_INFO_BUF_CTRL;
After thread created merit, the abnormality control table of distribution (exc ctrl) information was as shown in table 5:
The maximum nested number of plies of thread try piece The unusual maximum nested number of plies of thread Idle abnormal ranges watch chain table The unusual nested counting of thread The unusual current state of thread Unusual on-the-spot abnormal information address Abnormal ranges watch chain gauge outfit
Table 5
Concrete data structure is as follows:
typedef?struct_SEH_TH_CTRL
{
/ * control information */
VOS_UINT32 ulMaxScopeLayer; The maximum nested number of plies of // thread try piece
VOS_UINT32 ulMaxExcNestNum; The unusual maximum nested number of plies of // thread
SEH_SCOPE_UNIT*pScopeUnitFreeLink; // free range piece chained list
/ * status information */
VOS_UINT32 ulExceptNestCnt; The unusual nested numeration of // thread
VOS_UINT32 ulSehStatusFlag; The unusual current state of // thread
SEH_EXC_INFO*pSehExcInfo; // unusual field data address
SEH_SCOPE_UINT*pScopeTableHead; // abnormal ranges linked list head
}SEH_TH_CTRL;
Wherein, the ulSehStatusFlag sign has six kinds of states, be respectively: SEH_STAT_NON (initial value under the no abnormal situation is necessary for 0), SEH_STAT_UNHANDLE (it is unusual to be untreated), SEH_STAY_HANDLED (handling), SEH_STAT_CONTINUE_SEARCH (continuing to recall the abnormality processing piece), SEH_STAT_CONTINUE_REDO (re-executing) and SEH_STAT_RESTART (restarting process or veneer) from exception.
Thread abnormal ranges table is organized in the single-track link table mode, pressed the operation of stack preface, the embodiment of the invention provides the interface function of following function:
VOS_UINT32 SEH_ScopeTablePush (SEH_SCOPE_UINT*pScopeTableHead, SEH_SCOPE_UINT*pSehScopeUnit); // abnormal ranges gauge pressure stack
SEH_SCOPE_UINT * SEH_ScopeTablePop (SEH_SCOPE_UINT*pScopeTableHead); // abnormal ranges
// pop
VOS_BOOL SEH_ScopeTableIsEmpty (SEH_SCOPE_UINT*pScopeTableHead); // judgement abnormal ranges table
// whether be empty
Application release to thread abnormal information buffer table can provide following interface function function:
SEH_EXC_INFO*SHE_ExcInfoBufAlloc (); // application thread abnormal information buffer table
VOS_UINT32 SEH_ExcInfoBufFree (SEH_EXC_INFO*pSehExcInfo); // release thread abnormal information buffer table
3. about the realization and the user interface design of abnormality processing flow process
The setjmp () that provides in the standard C storehouse, longjmp () function can provide the mechanism of the local redirect in non-this locality.Under embedded type C language environment, do not rely on compiler and realize unusual relation mechanism, can adopt the encapsulation of setjmp to realize the try piece, and call longjmp after identification is unusual throw is provided piece, the except piece then is the else branch that returns non-0 value after setjmp calls.
One, the structure of thread abnormality control table
For realizing above-mentioned interface, at first need to construct the control table of thread abnormality.The shared abnormal information controll block of each thread, is kept among the pointer g_pSehInfoBufCtrl of direction structure SEH_INFO_BUF_CTRL from the application of system heap space in system initialisation phase.
Under VxWorks, after the task creation success, the application system heap space is preserved SEH_TH_CTRL, the pointer g_pSehThCtrl content of using taskVarAdd will point to SEH_TH_CTRL is kept in the task variable, in the try piece, can visit g_SehThCtrl by local variable, its value is switched by VxWorks, simultaneously this heap space is recorded in the system task resource summary table.
Under Linux, use pthread_key_create to create the key handle, and be kept among the key handle pointer g_pThKey, after the thread creation success, the application system heap space is preserved SEH_TH_CTRL, call pthread_setspecific and finish the pointer g_pSehThCtrl content preservation of pointing to SEH_TH_CTRL, in the try piece, operate the abnormality control table of this thread, simultaneously this heap space is recorded in the system thread resource summary table by the rreturn value (the g_pSehThCtrl content of this thread) of local variable preservation pthread_getspecific.
When this task or thread withdrawed from automatically, the system heap space that g_pSehThCtrl is pointed to discharged; When other tasks of deletion or thread, other tasks or the thread resources that is recorded in the system resource summary table discharged.
Two, the design of try piece
The realization flow of try piece comprises as shown in Figure 6:
Step S601: it is grand to begin to carry out the try piece;
Step S602: whether the granularity of judging described try piece correspondence less than the unusual granularity of processing that is provided with, if, change step S608, otherwise, step S603 changeed;
Step S603: obtain the address of current thread abnormality control table, change step S604;
Step S604: Unit piece of application from the free range piece chained list of thread abnormality control table, change step S605;
Step S605: the biIntFlag of initialization Unit piece, the Unit piece is pressed into thread abnormal ranges chained list, the continuous item of initialization exception state control table changes step S606;
Step S606: call setjmp () function, change step S607;
Step S607: judge whether to return 0, if, then change step S608, otherwise, step S609 changeed;
Step S608: normal process, change step S610;
Step S609: abnormality processing, change step S610;
Step S610: it is grand to finish to carry out the try piece, changes step S611;
Step S611: judge whether and need recall, if, then change step S612, otherwise, step S613 changeed;
Step S612: it is unusual to dish out again;
Step S613: judge whether and need reset, if, then change step S614, otherwise, step S615 changeed;
Step S614: restart process or veneer and handle;
Step S615: judge whether to recover to carry out, if, change step S616, otherwise, step S617 changeed;
Step S616: according to the recovery operation of CPU characteristics execute exception;
Step S617:try block end is handled.
Need to prove that step S608 and S609 (i.e. dotted portion among the figure) be for the user handles code, that is, and the flow process that the user need carry out, normal program code such as the code segment that for example needs protection.
Concrete, the try piece can dynamically be applied for a record cell from the free range piece chained list of thread abnormality control table, if surpass the maximum nested number of plies ulMaxScopeLayer of thread try piece, then triggering system acquiescence abnormality processing.Under the normal condition, through behind a small amount of initialization operation, be pressed into (push) in thread abnormal ranges chained list, in the if statement, call setjmp then, the normal process flow process code of application programs forms monitoring, when having hardware or software anomaly to dish out in the monitored code snippet, this program can return to the execution point of setjmp preservation thus.For the rreturn value of distinguishing setjmp is to call (0 value) for the first time, still longjmp calls returns (non-0 value), with the ulSehStatusFlag record in the control table of thread abnormality, non-0 the time when returning, represent current abnormality processing state, its implication is, whether the except piece that mates this try piece is found, perhaps need further to recall, perhaps re-execute, perhaps need reset procedure or Reset Board from exception.In addition, the realization of try piece needs also to consider that other precision management is supported to the abnormality processing level.
The flow process of try piece can realize in the following way:
#define?SEH_TRY_BEG(SEH_level)\
{\
VOS_INT32?ulSehStatusFlag=0;\
If (SEH_Level>=SEH_HANDLE_LEVEL) meticulous the control of the unusual framework of------
{\
SEH_SCOPE_UINT*_try_pSehScopeUnit;\
SEH_TH_CTRL*_try_pSehThCtrl;\
_ try_pSehThCtrl=current thread State Control Biao Dizhi
_ try_pSehScopeUnit=from Unit piece of thread free range piece chained list application
According to current whether in interruption initialization Unit piece blIntFlag sign
Call SEH_ScopeTablePush with Unit be pressed into thread abnormal ranges table
Initialization exception state control table status information be no abnormal state SEH_STAT_NON
_try_pSehThCtrl->pSehExcInfo=VOS_NULL_PTR;
ulSehStatusFlag=_try_pSehThCtrl->ulSehStatusFlag=setjmp(_try_pSeh-ScopeUnit->seh_env);
}
if(0==ulSehStatusFlag)\
---this forward braces is the guiding to normal flow code action scope in the try piece
The realization of try piece need accomplish not rely on compiler, can't discern the end point that finds the try piece and add end code automatically by the syntax of compiler, therefore, need SEH_TRY_END of design by application call, finish the end process of try piece, finish the removing of abnormality is handled.
#define?SEH_TRY_END\
If (SEH_STAT_CONTINUE_SEARCH/* need further recall */
==_try_pSehThCtrl->ulSehStatusFlag)\
{\
SEH_RETHROW();\
}\
else\
{\
SEH_ExcInfoBufFree(_try_pSehThCtrl->pSehExcInfo);
If (SEH_STAT_RESTART/* need reset procedure or veneer * /==_ try_pSehThCtrl->ulSehStatusFlag)
{\
Restart process or veneer handle
}\
Else if (SEH_STAT_CONTINUE_REDO/* need from exceptional instructions recover to carry out */
==_try_pSehThCtrl->ulSehStatusFlag)\
{\
According to the recovery operation of CPU system characteristics execute exception
}\
}\
---this reverse braces is closing the action scope of abnormality processing mode precision management in the except piece
---this reverse braces is closing except piece action scope
{\
/ * does not carry out any except piece, shows no abnormal generation */
if(0==_try_pSehThCtrl->ulSehStatusFlag)\
{\
Call SEH_ScopeTablePop with Unit eject thread abnormal ranges table
With the Unit piece discharge in the control table of loop line journey abnormality thread free range piece chained list
}\
}\
---this reverse braces is closing the whole unusual framework action scope of try piece
Three, the design of except piece
After the try piece, the mechanism of except piece need be provided, in fact it is exactly the else branch of the if statement pairing of SEH_TRY_BEG encapsulation, can handle the Exception Type that the throw piece is dished out, and supports the fine processing of abnormality processing mode simultaneously.The specific implementation flow process comprises as shown in Figure 7:
Step S701: it is grand to begin to carry out the except piece;
Step S702: close the action scope of normal process branch or the action scope of previous abnormality processing mode;
Step S703: judge whether it is current abnormality processing mode, if, change step S704, otherwise, step S708 changeed;
Step S704: the Unit piece is ejected thread abnormal ranges table;
Step S705: the free range piece chained list that the Unit piece is discharged into the control table of thread abnormality;
Step S706: the state of having handled unusually is set;
Step S707: the execute exception handler code, here, the exception handler code is an exception handling code;
Step S708: change the except piece of next abnormality processing mode or finish abnormality processing.
The encapsulation code is as follows:
#define?SEH_EXCEPT(method)\
---this reverse braces is closing normal flow code action scope in the try piece or last abnormality processing mode action scope
else\
{\
If (method==EXCEPTION_HANDLE_METHOD)---the meticulous control of abnormality processing mode
Call SEH_ScopeTablePop with Unit eject thread abnormal ranges table
With the Unit piece discharge in the control table of loop line journey abnormality thread free range piece chained list
_try_pSehThCtrl->ulSehStatusFlag=SEH_STAT_HANDLED;\
SEH_EXCEPT can realize the unusual seizure of any type, for supporting the filtration to Exception Type, promptly catches the unusual of particular type, and the embodiment of the invention further provides the encapsulation of three kinds of forms.
(1) catches certain specific exceptions
Realization flow comprises as shown in Figure 8:
Step S801: it is grand to begin to carry out the except piece;
Step S802: close the action scope of normal process branch or the action scope of previous abnormality processing mode;
Step S803: judge whether it is current abnormality processing mode, if, change step S804, otherwise, step S810 changeed;
Step S804: the Unit piece is ejected thread abnormal ranges table;
Step S805: judge whether to mate Exception Type, if, change step S807, otherwise, step S806 changeed;
Step S806: it is unusual to dish out again;
Step S807: the free range piece chained list that the Unit piece is discharged into the control table of thread abnormality;
Step S808: the state of having handled unusually is set;
Step S809: execute exception handler code;
Step S810: change the except piece of next abnormality processing mode or finish abnormality processing.
Code is as follows:
#define?SEH_EXCEPT_ONE(seh_type,method)\
}\
else\
{\
if(method==EXCEPTION_HANDLE_METHOD){\
Call SEH_ScopeTablePop with Unit eject thread abnormal ranges table
With the Unit piece discharge in the control table of loop line journey abnormality thread free range piece chained list
if(seh_type==_try_pSehThCtrl->pSehExcInfo->seh_rec.ulSehType)\
{
_try_pSehThCtrl->ulSehStatusFlag=SEH_STAT_HANDLED;\
}\
else\
{\
SEH_RETHROW (); / * heavily throw unusual */
}\
(2) catching processing specifies unusual
Realization flow comprises as shown in Figure 9:
Step S901: it is grand to begin to carry out the except piece;
Step S902: close the action scope of normal process branch or the action scope of previous abnormality processing mode;
Step S903: judge whether it is current abnormality processing mode, if, change step S904, otherwise, step S910 changeed;
Step S904: the Unit piece is ejected thread abnormal ranges table;
Step S905: judge whether to mate the Exception Type of array appointment, if, change step S907, otherwise, step S906 changeed;
Step S906: it is unusual to dish out again;
Step S907: the free range piece chained list that the Unit piece is discharged into the control table of thread abnormality;
Step S908: the state of having handled unusually is set;
Step S909: execute exception handler code;
Step S910: change the except piece of next abnormality processing mode or finish abnormality processing.
Code is as follows:
#define?SEH_EXCEPT_VAR(seh_type_num,seh_type_array,method)\
}\
else\
{\
if(method==EXCEPTION_HANDLE_METHOD){\
Call SEH_ScopeTablePop with Unit eject thread abnormal ranges table
With the Unit piece discharge in the control table of loop line journey abnormality thread free range piece chained list
If (type matching in the unusual field data among ulSehType and the seh_type_array)
{\
-try_pSehThCtrl->ulSehStatusFlag=SEH_STAT_HANDLED;\
}\
else\
{\
SEH_RETHROW();\
}
(3) unusual in catching and handle between a certain exceptions area
Realization flow comprises as shown in figure 10:
Step S1001: it is grand to begin to carry out the except piece;
Step S1002: close the action scope of normal process branch or the action scope of previous abnormality processing mode;
Step S1003: judge whether it is current abnormality processing mode, if, change step S1004, otherwise, step S1010 changeed;
Step S1004: the Unit piece is ejected thread abnormal ranges table;
Step S1005: the Exception Type in judging whether to mate between exceptions area, if, change step S1007, otherwise, step S1006 changeed;
Step S1006: it is unusual to dish out again;
Step S1007: the free range piece chained list that the Unit piece is discharged into the control table of thread abnormality;
Step S1008: the state of having handled unusually is set;
Step S1009: execute exception handler code;
Step S1010: change the except piece of next abnormality processing mode or finish abnormality processing.
Code is as follows:
#define?SEH_EXCEPT_IN(seh_type_min,seh_type_max,method)\
}\
else\
{\
if(method==EXCEPTION_HANDLE_METHOD){\
Call SEH_ScopeTablePop with Unit eject thread abnormal ranges table
The nit piece discharge in the control table of loop line journey abnormality thread free range piece chained list
The type matching in ulSehType and seh_type_min/max interval in the unusual field data of if)
{\
_try_pSehThCtrl->ulSehStatusFlag=SEH_STAT_HANDLED;\
}\
else\
{\
SEH_RETHROW();\
}\
In addition, the embodiment of the invention also offers application layer to do the associative operation macro interface of further processing as follows in the except piece:
(1) obtains exception record information
#define?SEH_GET_RECORD(pSehRec)\
((pSehRec)=&(_try_pSehThCtrl->pSehExcInfo.seh_rec))
(2) obtain Exception Type
#define?SEH_GET_TYPE(SehType)\
((SehType)=_try_pSehThCtrl->pSehExcInfo.seh_rec.ulSehType)
(3) the unusual nested number of plies is set
#define?SEH_GET_NEST_COUNT(NestCount)\
(NestCount)=_try_pSehThCtrl->ulExceptNestCnt
(4) the abnormality processing state is set
#define?SEH_SET_STATUS(SehStatus)\
_try_pSehThCtrl->ulSehStatusFlag=(SehStatus)
Four, the design of throw piece
There are two places in the place of calling throw, and a place is when the system acquisition hardware anomalies, calls the throw piece, and to the except piece, another place then is that the function among the try initiatively calls the throw software anomaly of dishing out with abnormity notifying.To both of these case, the unified operation of dishing out is provided here, that is, obtain to be positioned in the thread abnormal ranges table storage unit (but not ejecting) of stack top, location contents is carried out assignment, can realize by function S EH_ThrowInner.
Realization flow comprises as shown in figure 11:
Step S1101: carry out ThrowInner () function;
Step S1102: judge whether parameter is legal, if, then change step S1103, otherwise, step S1112 changeed;
Step S1103: the address that obtains the control table of current thread abnormality;
Step S1104: the stack top storage unit that obtains thread abnormal ranges chained list;
Step S1105: judge whether the try piece and the except piece of coupling, if, then change step S1106, otherwise, step S1112 changeed;
Step S1106: judge whether shared abnormal information buffer memory or whether the exception record of dishing out is unusual field notes, if, change step S1107, otherwise, step S1111 changeed;
Step S1107: distribute and share the abnormal information buffer memory;
Step S1108: judged whether buffer memory, if, then change step S1109, otherwise, step S1112 changeed;
Step S1109: the initialization buffer memory is provided with the abnormality mark that is untreated;
Step S1110: carry out the except block code;
Step S1111: the abnormality processing sign is set;
Step S1112: the abnormality processing of giving tacit consent to.
Code is as follows:
void?SEH_ThrowInner(VOS_SEH_REC*pSehRec)
{
SEH_SCOPE_UINT*pTempUnit;
SEH_EXC_INFO*pInfoBuf;
SEH_TH_CTRL*pSehThCtrl;
VOS_UINT32?ulSehStatusFlag;
if(VOS_NULL_PTR==pSehRec)
{
Parameter is illegal, presses the system default abnormality processing
}
PSehThCtrl=current thread State Control table address
pTempUnit=SEH_ScopeTableTop(pSehThCtrl->pScopeTableHead);
if(VOS_NULL_PTR==pTempUnit)
{
Showing does not have the try-except piece, presses the system default abnormality processing
}
if((VOS_NULL_PTR==pSehThCtrl->pSehExcInfo)
||(pSehRec!=&(pSehThCtrl->pSehExcInfo->seh_rec))
{
pInfoBuf=SEH_ExcInfoBufAlloc();
if(VOS_NULL_PTR==pInfoBuf)
{
Showing does not have the abnormal information buffer memory of sharing, and presses the system default abnormality processing
}
pSehThCtrl->ulExceptNestCnt=1;
pSehThCtrl->pSehExcInfo=pInfoBuf;
* pInfoBuf content is carried out initialization
pInfoBuf->seh_rec.ulSehType=pSehRec->ulSehType;
Other assign operations of pInfoBuf ...
ulSehStatusFlag=SEH_STAT_UNHANDLE;
}
else
{
ulSehStatusFlag=pSehThCtrl->ulSehStatusFlag;
}
Second parameter of/* longjmp be used for the abnormality processing status information return to pSehThCtrl->ulSehStatusFlag*/
longjmp(pTempUnit->seh_env,ulSehStatusFlag);
}
To the software anomaly situation that program is dished out, most of hardware anomalies information can shield.Grand package interface after the simplification is the initialization exception record information of dishing out at first, calls the SEH_ThrowInner function then, is achieved as follows:
#define?SEH_THROW(SehType,SehErrCode,SehMsg)\
{\
VOS_SEH_REC?tmpSehRec;
memset(&tmpSehRec,0,sizeof(tmpSehRec));
tmpSehRec.ulSehType=SehType;
tmpSehRec.ulSehErrOrIntCode=SehErrCode;
strncpy(tmpSehRec.stSehMsg,SehMsg,31);
tmpSehRec.stSehMsg[31]=0;
SEH_ThrowInner(&tmpSehRec);
}
Situation about can't handle for current excpet piece, the front is described under the situation of SEH_EXCEPT_ONE, SEH_EXCEPT_VAR and SEH_EXCEPT_IN, pSehThCtrl->ulSehStatusFlag carries out rethrow after being set to further to recall state SEH_STAT_CONTINUE_SEARCH, and the interface of dishing out again is achieved as follows:
#define?SEH_RETHROW()\
SEH_ThrowInner(&(pSehThCtrl->pSehExcInfo->seh_rec))
Five, the realization of framework precision management
Precision management to framework has two aspects.Other precision management of processing module level when dishing out unusually is provided on the one hand, the precision management to the abnormality processing mode is provided on the other hand.
Other precision management of processing module level when (1) dishing out unusually
Code is dished out when unusual, can search the try piece according to fine degree, defmacro SEH_HANDLE_LEVEL for this reason, and the user is by disposing this grand fineness that can preserve the abnormality processing framework of expectation.This grand value is defaulted as FUNC_LEVEL (function level).The user can as required that this is grand value be configured to MODULE_LEVEL or COMPONENT_LEVEL.
The user can specify the configuration level SEH_Level of try piece simultaneously when try block protection code is set.In the design of try piece, can see that when SEH_Level>=SEH_HANDLE_LEVEL, code is dished out in the framework, and corresponding try piece just is identified when unusual.Therefore, in the different phase of exploitation, the user only need dispose SEH_HANDLE_LEVEL, just can control the fineness of abnormality processing framework.For example, it is FUNC_LEVEL (function rank) that the user is provided with SEH_HANDLE_LEVEL in the debug phase, and all try pieces all can be identified; After code was stable, it was that FUNC_LEVEL is MODULE_LEVEL that the user is provided with SEH_HANDLE_LEVEL, then code unusual in identification module level when unusual of dishing out.
Framework realizes other judgement of abnormality processing level and being supported in the try piece of configuration, and it is realized and flow process illustrates in the design of try piece and Fig. 8.
(2) precision management of abnormality processing mode
The different phase that the user develops under embedded type C language environment has different processing modes to abnormity processing.For example, in the development phase, be that catching exception is handled wrong and output error to the abnormity processing main method, and when the product issue was finished in exploitation, the main method of abnormality processing was fault-tolerant recovery.Therefore, the precision management of abnormality processing provides framework for the user, make the user when different phase is write exception handling code, do not need to cover former code and be simple designated treatment mode, write different exception handling codes at different processing modes.
For this reason, grand EXCEPTION_HANDLE_METHOD can be set preserve the current processing mode of user, when except piece catching exception, designated treatment mode method (EXCEPTION_CHECK, EXCEPTION_TOLARENT and other user-defined modes) the except piece that method is identical with current processing mode EXCEPTION_HANDLE_METHOD could be handled the unusual of corresponding try piece.The user can use the abnormality processing framework in the following manner:
SEH_TRY_BEG(SEH_level)
{
...
SEH_THROW
...
}
SEH_EXCEPT(method1)
{
The exception handling code of processing mode method1 correspondence
}
SEH_EXCEPT(method2)
{
The exception handling code of processing mode method2 correspondence
}
......
SEH_TRY_END
Support realization and flow process to the abnormality eliminating method precision management partly and among Fig. 9 are described in the design of except piece.
(3) the precision management method of abnormality processing framework
Realization flow comprises as shown in figure 12:
Step S1201: the try piece of execute protection program code;
Step S1202: judge whether current rank is not less than user configured rank, if change step
S1203, otherwise, step S1209 changeed;
Step S1203: carry out the program code that needs protection;
Step S1204: judge whether the program code that needs protection dishes out unusually, if change step
S1205, otherwise, step S1203 changeed;
Step S1205: determine corresponding except piece;
Step S1206: judge whether to meet the abnormality processing mode that the user is provided with, if, change step S1207, otherwise, step S1208 changeed;
Step S1207: execute exception handler code;
Step S1208: change next abnormality processing mode, change step S1206;
Step S1209: ignore current try block protection, change step S1203.
Concrete, the user can arrangement abnormalities handle rank and abnormality processing means.For example, when running into the try piece, judge at first whether the rank of current try piece is not less than user configured abnormality processing rank, if, then code is protected, otherwise, the protection mechanism of this try piece ignored.For the code of try block protection,, then seek corresponding except piece if it is unusual to dish out; if the processing means of the except piece that finds conform to user configured processing means; then carry out corresponding abnormality processing, otherwise, the except piece of next processing means accordingly sought.
Six, user interface and using method
The embodiment of the invention provides two class external interfaces: a class is to build the interface of unusual framework, the interface SEH_TRY_BEG and the SEH_TRY_END that comprise the try piece that is used for the cognizance code fragment, be used for interface SEH_EXCEPT (it is unusual to mate all), SEH_EXCEPT_ONE (it is unusual to mate a certain class), SEH_EXCEPT_VAR (the coupling Exception Type is variable) and the SEH_EXCEPT_IN of the exception handler except piece of code snippet coupling (coupling certain kinds model interval unusually), and the SEH_THROW interface of the throw piece that is used to dish out unusual; Another kind of is in the abnormality processing framework, unusual for making things convenient for application program further to handle, the perhaps employed Processing Interface of control abnormity treatment scheme more flexibly as required, comprise SEH_GET_RECORD (obtaining exception record information), SEH_GET_TYPE (obtaining Exception Type) and SEH_SET_STATUS (the abnormality processing state is set), above-mentioned interface all provides in grand mode, and in the inner use of abnormality processing framework.The user can use this abnormality processing framework in the following way in code:
SEH_TRY_BEG(SEH_level)
{
// user wants the code of monitoring and protection
...
SEH_THROW (SehType, SehErrCode, if SehMsg) // take place then it to be dished out unusually
...
}
SEH_EXCEPT (Exception Type, mothod1)
{
...
SEH_GET_RECORD (/ * obtain exception record * /);
If (hardware anomalies)
{
/ * further processes, dump abnormal information */
app_exc_handle();
}
...
If (software anomaly)
{
/ * carry out comprehensive bug check and error message report */
app_err_handle();
}
...
SEH_SET_STATUS (that/* can be set to continue to recall is unusual, from exceptional instructions recover to carry out, reset procedure * /);
...
}
SEH_EXCEPT (Exception Type, mothod2)
The abnormality eliminating method of ... // other abnormality processing modes define
SEH_TRY_END
The present invention also provides method that withdraws from thread or process under the embedded type C language environment and the method for deleting thread or process except that above-mentioned abnormality eliminating method is provided.
Withdraw from thread or process method realization flow as shown in figure 13, be applied to the scene that thread initiatively withdraws from, comprising:
Step S1301: obtain the information that thread or process need withdraw from.
Step S1302: unusually whether thread that inspection need be withdrawed from or process are dished out still takies resource, if, change step S1303, otherwise, step S1304 changeed;
Step S1303: discharge the described resource that takies;
Step S1304: withdraw from described thread or process.
Unusually whether thread that inspection need be withdrawed from or process are dished out still takies resource and specifically can comprise: whether thread that inspection need be withdrawed from or process have dished out unusually; If, then check dished out unusually whether still take resource.
Concrete, the interface operation VOS_ExitThread that can provide thread to withdraw from for the user, this interface function is before withdrawing from thread, check at first whether current thread has the resource of abnormality processing not discharge as yet, if have, then the unusual shared resource of dishing out in the try piece is checked and discharged, carry out the operation of withdrawing from thread afterwards.
The device that withdraws from thread or process under a kind of embedded type C language environment wherein can comprise as shown in figure 14: information acquisition unit 1401 is used to obtain the information that thread or process need withdraw from; Resource inspection unit 1402 is used for after information acquisition unit 1401 obtains information that threads or process need withdraw from, and unusually whether thread that inspection need be withdrawed from or process are dished out still takies resource; Resource releasing unit 1403 is used for unusually still taking resource what resource inspection unit 1402 checked out that the thread that need withdraw from or process dish out, then discharges the described resource that takies; Thread or process withdraw from unit 1404, are used for withdrawing from described thread or process after resource releasing unit 1403 discharges the described resource that takies.
The realization flow of the method for deletion thread or process is applied to current thread or process as shown in figure 15 by the scene of other threads or process-kill, comprising:
Step S1501: thread or process that need to determine deletion.
Step S1502: unusually whether what check to need that the thread of deletion or process dish out still takies resource, if, change step S1503, otherwise, step S1504 changeed;
Step S1503: discharge the described resource that takies;
Step S1504: delete described thread or process.
Unusually whether what check to need that the thread of deletion or process dish out still takies resource and specifically can comprise: check whether thread or process that needs are deleted have dished out unusually; If, then check dished out unusually whether still take resource.
Concrete, if thread 1 switches to thread 2 after dishing out unusually, thread 2 needs to carry out the deletion action to thread 1, in embodiments of the present invention, deletes thread 1 again after the unusual shared resource of dishing out in 2 pairs of threads 1 of thread is handled.
Under Linux, thread 2 deletion threads 1 realize by sending signal for thread 1, therefore, can be in thread 1 among the processing function handler of registration signal to handling unusually of having dished out.Under Linux, the abnormality processing when deleting for striding course can be adopted to use the same method and be handled.
Under VxWorks, the function taskDelete of deletion task allows by function taskDeleteHookAdd () registration Hook Function, therefore, can be before the deletion task, the registration Hook Function is handled unusually to the task of will deleting.
For above two kinds of operating systems, the embodiment of the invention provides unified processing means.Concrete, VOS_KillExHandle () is provided function, under linux system, be registered as the handler of the signal of deletion thread (process), under vxWorks, be registered as and withdraw from hook.VOS_KillExHandle () function is current to be processed unusual by the information acquisition in the abnormality control table that obtains deleted thread, then resource unusual and that take is handled accordingly.
The device of deletion thread or process comprises as shown in figure 16 under a kind of C language environment wherein:
Determining unit 1601 is used for thread or the process of determining that needs are deleted;
Resource inspection unit 1602 is used for after determining unit 1601 is determined the thread or process of needs deletion, check need that the thread that delete or process dish out unusually whether still take resource;
Resource releasing unit 1603 is used for unusually still taking resource what resource inspection unit 1602 checked out that the thread of needs deletions or process dish out, then discharges the described resource that takies;
Thread or process-kill unit 1604 are used for deleting described thread or process after resource releasing unit 1603 discharges the described resource that takies.
In sum, but the embodiment of the invention has realized not relying on the abnormality eliminating method of the precision management of compiler under embedded type C language environment.The user interface that the embodiment of the invention provides can separate user's coding with abnormality processing, make the user when using embedded type C language environment to carry out program development, by using simple macro interface can realize program design, thereby more pay close attention to the exploitation of the normal branch of code based on abnormality processing.But the design to the precision management of unusual framework makes the user can adjust the rank of abnormality processing as required, for example, abnormality processing can be fixed on the function level in the debug phase, unusual with capture program as far as possible, and after code is stable, the abnormality processing rank is decided to be component-level during network operation on the product, ignores the abnormality processing of function level, only handle unifying unusually of occurring at module.
The situation that can't control the granularity and the mode of abnormality processing according to the needs of oneself at user in the prior art, the embodiment of the invention realizes in above-mentioned abnormality eliminating method that does not rely on compiler and abnormality processing framework the mechanism of abnormality processing dynamic-configuration to function, module or assembly, and the mechanism of arrangement abnormalities processing, thereby realization is to the precision management of abnormality eliminating method and abnormality processing framework.Make the user to carry out precision management to abnormality processing framework and disposal route according to the needs of oneself.The user comprises two aspects to the precision management of abnormality processing framework and disposal route:
On the one hand, in the different phase of exploitation, the user can arrive the abnormality processing dynamic-configuration different stages such as function, module, assembly as required, thereby reaches the precision management to the abnormality processing framework.For example, in product development stage, the user can be configured to the abnormality processing rank function rank in order to find the mistake of exception throw as far as possible, and in the code of abnormality processing protection, function is dished out, and unusual exception handling that all can minuend is caught and handled; When product development finishes issue; code is comparatively stable; in order to improve performance; the user can be configured to the abnormality processing rank module level even component-level; the mechanism of abnormality processing works in module or parts scope, and the unusual meeting of dishing out is caught by the exception handling of this module or parts and unified the processing.
On the other hand, the user can do different abnormality processing to the code of same segment protect, and can be in the abnormality processing framework arrangement abnormalities disposal route, different abnormality eliminating methods is come into force.For example; code to same segment protect; user's abnormality processing can have debugging and fault-tolerant at least two kinds of processing modes, uses the debugging mode to find the mistake of exception throw when code development as far as possible, and uses fault-tolerant way to handle recovering unusually when product is issued.The user can the arrangement abnormalities processing mode be debugging or fault-tolerant in the abnormality processing framework.
And, under the embedded type C language environment of the embodiment of the invention in abnormality eliminating method, device and the embedded system, if code segment occurs unusual, it then not simple rerun routine code snippet, and be to use the exception handler that is independent of code segment to handle unusually, like this, program is when operation, just can not be because of unusual and interrupt run, satisfied the demand of interrupting has taken place when product is not wished system's operation.
And, abnormality processing when not supporting the deletion of cross-thread and striding course at exception handling of the prior art, the embodiment of the invention do not rely under the embedded type C environment provides thread initiatively to withdraw from the abnormality eliminating method of compiler and the abnormality processing framework and the method during cross-thread (process) deletion.Under the embedded type C language environment of the embodiment of the invention, withdraw from or delete in the method for thread or process, no matter be to withdraw from or delete thread or process, can discharge the unusual shared resource that processing threads or process are dished out, like this, when other threads or process need be used these resources, can unusually still not take resource and cause other threads or process can't use these resources because of what deletion or the thread that withdraws from or process were dished out.In addition, can also delete the thread of required deletion by other threads, thus the abnormality processing can realize cross-thread deletion thread the time.
The process that one of ordinary skill in the art will appreciate that abnormality processing under the embedded type C language environment of realizing the foregoing description can be finished by the relevant hardware of programmed instruction, described program can be stored in the read/write memory medium, and this program is carried out the corresponding step in the said method when carrying out.Described storage medium can be as ROM/RAM, magnetic disc, CD etc.
Need to prove that at last all embodiment of the present invention can be applied under the embedded type C language environment, under the non-embedded C language environment.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (28)

1. the abnormality eliminating method under the embedded type C language environment is characterized in that, comprising:
The code segment that needs protection moved of monitoring, unusual if described code segment occurs, it is described unusual then to dish out, and describedly comprises at least a in software anomaly, the hardware anomalies unusually;
Described unusual according to what obtain, determine corresponding exception handler, described unusual by described exception handler processing, wherein, described exception handler and described code segment are separate.
2. the method for claim 1 is characterized in that, the step tool of the code segment that needs protection that described monitoring is moving is: according to the unusual granularity of processing that is provided with, monitor the described code segment of moving that needs protection.
3. the method for claim 1 is characterized in that, further comprises: application is used to write down the storage space with relevant unusually information;
Then, described code segment occur unusual after, dish out described unusual before, record and relevant information unusually.
4. as claim 1 or 3 described methods, it is characterized in that, described dishing out describedly is specially unusually: will pass after the described and unusual relevant information package, described and unusual relevant information comprises the Exception Type sign at least, and described Exception Type sign is used to represent the unusual type of present procedure code snippet appearance.
5. method as claimed in claim 4 is characterized in that, and is described described unusual according to what obtain, determines corresponding exception handler, handles described unusual step by described exception handler and comprises:
Acquisition that pass over unusual relevant information, comprise Exception Type in the described and unusual relevant information and identify;
Determine and the corresponding exception handler that Exception Type mated of described Exception Type sign, handle described unusual by described exception handler.
6, method as claimed in claim 5 is characterized in that, the corresponding exception handler that Exception Type mated of described definite and described Exception Type sign is handled described unusual step by described exception handler and comprised:
When the corresponding Exception Type of described Exception Type sign during with treatable a kind of special Exception Type coupling, should be unusually by handling with the exception handler of this Exception Type coupling;
Or, when a kind of Exception Type coupling in the corresponding Exception Type of described Exception Type sign and the treatable at least a Exception Type, should be unusually by handling with the exception handler of this Exception Type coupling;
Or, when existing when can handle the unusual exception handler of any kind, determine to handle described unusual by the unusual exception handler of this coupling any type.
7, method as claimed in claim 6, it is characterized in that, described method further comprises: if during the current exception handler that does not exist with this Exception Type coupling, with passing again of obtaining with unusual relevant information, perhaps, when all unmatching, start default handler, the described default handler starting system of attaching most importance to.
8, method as claimed in claim 4 is characterized in that, and is described described unusual according to what obtain, determines corresponding exception handler, handles described unusual step by described exception handler and comprises:
Acquisition that pass over unusual relevant information, comprise in the described and unusual relevant information that Exception Type identifies, the designated treatment mode identifies;
Determine that the Exception Type corresponding with described Exception Type sign mates, and identify the exception handler that corresponding processing mode is mated, handle described unusual by the exception handler of described coupling with described designated treatment mode.
9. method as claimed in claim 5 is characterized in that, described exception handler can also mate and handle polytype unusual.
10. method as claimed in claim 5 is characterized in that, if the exception handler that has a plurality of and described Exception Type to be complementary determines that then the step of the exception handler that Exception Type mated corresponding with described Exception Type sign is:
Determine to identify that corresponding Exception Type mated with described Exception Type, and an exception handler nearest with described code segment position.
11. the method for claim 1, it is characterized in that, if occur unusual when described code segment is called, then by described exception handler handle described unusual after, also comprise: return the normal postrun result of described code segment step by step, perhaps operation and code segment it after adjacent with described exception handler.
12. method as claimed in claim 2 is characterized in that, the unusual granularity of the processing of described setting comprises at least a in function rank, module level, the parts rank, and wherein, described module is made up of a plurality of functions, and described parts are made up of a plurality of modules.
13. method as claimed in claim 8 is characterized in that, when described processing mode is the fault-tolerant processing mode, is handled described unusual by the exception handler of fault-tolerant way;
When described processing mode is the debugging processing mode, handle described unusually by the exception handler of debugging mode, wherein, described exception handler and described code segment are separate.
14, the method for claim 1 is characterized in that, is grandly mated and catches unusually by what have coupling and catch abnormal function; By the grand code segment of moving that needs protection of monitoring with monitoring function; By have an abnormal function of dishing out grand dish out described unusual.
15. abnormality processing device under the embedded type C language environment is characterized in that, comprising:
Monitoring unit is used to monitor the code segment of moving that needs protection;
Unusually the unit of dishing out, be used for described monitoring unit find described code segment occur unusual after, it is described unusual to dish out, and describedly comprises at least a in software anomaly, the hardware anomalies unusually;
Matching unit is used for described unusually according to what obtain, determines corresponding exception handler, and described exception handler is used to handle unusual that the described unit of dishing out unusually dishes out, and wherein, described exception handler and described code segment are separate.
16. abnormality processing device as claimed in claim 15 is characterized in that, also comprises: information recording unit is used to write down the unusual relevant information of the described code segment appearance of finding with described monitoring unit, and exports to the described unit of dishing out unusually.
17. abnormality processing device as claimed in claim 16, it is characterized in that, the described unit of dishing out unusually is first unit of dishing out unusually, be used for after described monitoring unit finds that described code segment occurs unusually, to pass after the described and unusual relevant information package, described and unusual relevant information comprises the Exception Type sign at least, and described Exception Type sign is used to represent the unusual type of present procedure code snippet appearance.
18. abnormality processing device as claimed in claim 17, it is characterized in that, described matching unit is first matching unit, that be used to obtain to pass over and unusual relevant information, comprise the Exception Type sign in the described and unusual relevant information, and determine and the corresponding exception handler that Exception Type mated of described Exception Type sign, handle described unusual by described exception handler.
19. abnormality processing device as claimed in claim 17, it is characterized in that, described matching unit is second matching unit, that be used to obtain to pass over and unusual relevant information, comprise the Exception Type sign in the described and unusual relevant information, the designated treatment mode identifies, and determine that the Exception Type corresponding with described Exception Type sign mates, and identify the exception handler that corresponding processing mode is mated with described designated treatment mode, handle described unusual by described exception handler.
20, abnormality processing device as claimed in claim 15, it is characterized in that, if the exception handler that has a plurality of and described unusual type to be complementary, described matching unit is the 3rd matching unit, be used for described unusual according to what obtain, definite and described unusual type is mated, and an exception handler nearest with described code segment position, is handled described unusual by described exception handler.
21, abnormality processing device as claimed in claim 15; it is characterized in that; described monitoring unit is first monitoring unit, is used for when program execution triggering is unusual, according to the unusual described code segment of moving that needs protection of granularity monitoring of the processing that is provided with.
22. withdraw from the method for thread or process under the embedded type C language environment, it is characterized in that, be applied to the scene that thread initiatively withdraws from, comprising:
Obtain the information that thread or process need withdraw from;
Unusually whether thread that inspection need be withdrawed from or process are dished out still takies resource;
If then discharge the described resource that takies;
Withdraw from described thread or process.
23. method as claimed in claim 22 is characterized in that, the resource that unusually whether still takies that thread that inspection need be withdrawed from or process are dished out specifically comprises:
Whether thread that inspection need be withdrawed from or process have dished out unusually;
If, then check dished out unusually whether still take resource.
24. withdraw from the device of thread or process under the embedded type C language environment, it is characterized in that, comprising:
The information acquisition unit is used to obtain the information that thread or process need withdraw from;
The resource inspection unit is used for after described information acquisition unit obtains information that thread or process need withdraw from, and unusually whether thread that inspection need be withdrawed from or process are dished out still takies resource;
The resource releasing unit is used for unusually still taking resource what described resource inspection unit checked out that the thread that need withdraw from or process dish out, discharges the described resource that takies;
Withdraw from the unit, be used for after described resource releasing unit discharges the described resource that takies, withdrawing from described thread or process.
25. an embedded type C language environment is deleted the method for thread or process down, it is characterized in that, is applied to current thread or process by the scene of other threads or process-kill, comprising:
Need to determine the thread or the process of deletion;
Unusually whether what check to need that the thread of deletion or process dish out still takies resource;
If then discharge the described resource that takies;
Delete described thread or process.
26. method as claimed in claim 25 is characterized in that, the resource that unusually whether still takies that thread that inspection need be deleted or process are dished out specifically comprises:
Whether check needs the thread or the process of deletion to dish out unusually;
If, then check dished out unusually whether still take resource.
27. an embedded type C language environment is deleted the device of thread or process down, it is characterized in that, comprising:
Determining unit is used for thread or the process of determining that needs are deleted;
The resource inspection unit is used for after described determining unit is determined the thread or process of needs deletion, check need that the thread that delete or process dish out unusually whether still take resource;
The resource releasing unit is used for unusually still taking resource what described resource inspection unit checked out that the thread of needs deletions or process dish out, discharges the described resource that takies;
Thread or process-kill unit are used for deleting described thread or process after described resource releasing unit discharges the described resource that takies.
28. an embedded system is characterized in that, described system comprises any described abnormality processing device as claim 15-21.
CN2008101000605A 2008-06-03 2008-06-03 Abnormal handling method and device under embedded type C language environment Expired - Fee Related CN101599039B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN2008101000605A CN101599039B (en) 2008-06-03 2008-06-03 Abnormal handling method and device under embedded type C language environment
PCT/CN2009/070492 WO2009146612A1 (en) 2008-06-03 2009-02-20 Method and apparapus for exception handling in embedded c language environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101000605A CN101599039B (en) 2008-06-03 2008-06-03 Abnormal handling method and device under embedded type C language environment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN2011101075073A Division CN102163174A (en) 2008-06-03 2008-06-03 Methods and devices for quitting and deleting thread or process in embedded C language environment

Publications (2)

Publication Number Publication Date
CN101599039A true CN101599039A (en) 2009-12-09
CN101599039B CN101599039B (en) 2011-11-02

Family

ID=41397719

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101000605A Expired - Fee Related CN101599039B (en) 2008-06-03 2008-06-03 Abnormal handling method and device under embedded type C language environment

Country Status (2)

Country Link
CN (1) CN101599039B (en)
WO (1) WO2009146612A1 (en)

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853189A (en) * 2010-05-26 2010-10-06 北京航空航天大学 Exception handling device based on Java and exception handling method thereof
CN101937372A (en) * 2010-08-30 2011-01-05 北京数码大方科技有限公司 Exception processing method and device
CN102004694A (en) * 2010-11-26 2011-04-06 北京握奇数据系统有限公司 Java-based exception handling method and exception handling mechanism
CN102385508A (en) * 2010-09-03 2012-03-21 金蝶软件(中国)有限公司 Exception handling method and device and software system
CN102833120A (en) * 2011-06-14 2012-12-19 中兴通讯股份有限公司 Method and system for handling exception of network management server in quick test professional (QTP)
CN103731729A (en) * 2013-11-26 2014-04-16 乐视致新电子科技(天津)有限公司 Media player of smart television, exception handling method of media player of smart television and smart television
CN104239208A (en) * 2014-09-19 2014-12-24 福建星海通信科技有限公司 Recovery method for exceptions during automation execution
CN104503770A (en) * 2015-01-12 2015-04-08 北京国双科技有限公司 Handling method and device for abnormal information
CN104503918A (en) * 2015-01-12 2015-04-08 北京国双科技有限公司 Handling method and device for abnormal information
CN105354105A (en) * 2015-10-28 2016-02-24 上海斐讯数据通信技术有限公司 Software exception handling system and method
CN105718374A (en) * 2016-01-26 2016-06-29 国家信息技术安全研究中心 Method and system for hotspot module instruction tracking
CN105843675A (en) * 2016-04-01 2016-08-10 腾讯科技(深圳)有限公司 Thread exiting method and device
CN106227672A (en) * 2016-08-10 2016-12-14 中车株洲电力机车研究所有限公司 A kind of built-in application program fault catches and processing method
CN106372505A (en) * 2016-08-23 2017-02-01 北京航空航天大学 Embedded system code attack-oriented quick recovery method
CN106528316A (en) * 2016-11-10 2017-03-22 霍尔果斯霹雳互动网络科技有限公司 Anti-crash method and system of online game server
CN106951337A (en) * 2017-03-28 2017-07-14 北京奇虎科技有限公司 A kind of method and apparatus for the cross-system operation that application is realized based on abnormality processing
CN107451046A (en) * 2016-05-30 2017-12-08 腾讯科技(深圳)有限公司 A kind of method and terminal for detecting thread
CN108345542A (en) * 2018-02-28 2018-07-31 腾讯科技(深圳)有限公司 Abnormality eliminating method and device in a kind of application program
CN108958850A (en) * 2018-06-29 2018-12-07 郑州云海信息技术有限公司 A kind of log optimization method, device, equipment and computer readable storage medium
CN109117253A (en) * 2017-06-26 2019-01-01 阿里巴巴集团控股有限公司 A kind of method and apparatus of micro-kernel scheduling
CN111124726A (en) * 2019-12-09 2020-05-08 上海移远通信技术股份有限公司 Method and device for detecting abnormity of opened modem port
CN111190707A (en) * 2019-08-02 2020-05-22 腾讯科技(深圳)有限公司 Data processing method and device
CN112000577A (en) * 2020-08-25 2020-11-27 得到(天津)文化传播有限公司 Code checking method and device, electronic equipment and storage medium
CN112445642A (en) * 2020-11-09 2021-03-05 浙江吉利控股集团有限公司 Exception handling method, remote parking assist system, and computer storage medium
CN113220495A (en) * 2021-05-24 2021-08-06 浙江大华技术股份有限公司 Process abnormal event processing method and device, electronic equipment and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704356B (en) * 2017-06-12 2019-06-28 平安科技(深圳)有限公司 Exception stack information acquisition method, device and computer readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6247169B1 (en) * 1996-11-04 2001-06-12 Sun Microsystems, Inc. Structured exception-handling methods, apparatus, and computer program products
CN100437515C (en) * 2003-06-30 2008-11-26 松下电器产业株式会社 Garbage collection system
CN1952880A (en) * 2006-10-26 2007-04-25 康佳集团股份有限公司 A method making nonlocal skip tool imitated into exception mechanism by C programming language

Cited By (43)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853189A (en) * 2010-05-26 2010-10-06 北京航空航天大学 Exception handling device based on Java and exception handling method thereof
CN101853189B (en) * 2010-05-26 2012-07-11 北京航空航天大学 Exception handling device based on Java and exception handling method thereof
CN101937372A (en) * 2010-08-30 2011-01-05 北京数码大方科技有限公司 Exception processing method and device
CN102385508A (en) * 2010-09-03 2012-03-21 金蝶软件(中国)有限公司 Exception handling method and device and software system
CN102004694A (en) * 2010-11-26 2011-04-06 北京握奇数据系统有限公司 Java-based exception handling method and exception handling mechanism
CN102004694B (en) * 2010-11-26 2013-04-24 北京握奇数据系统有限公司 Java-based exception handling method and exception handling mechanism
CN102833120A (en) * 2011-06-14 2012-12-19 中兴通讯股份有限公司 Method and system for handling exception of network management server in quick test professional (QTP)
CN102833120B (en) * 2011-06-14 2017-06-13 中兴通讯股份有限公司 The abnormal method and system of NM server are processed in a kind of rapid automatized test
CN103731729A (en) * 2013-11-26 2014-04-16 乐视致新电子科技(天津)有限公司 Media player of smart television, exception handling method of media player of smart television and smart television
CN104239208A (en) * 2014-09-19 2014-12-24 福建星海通信科技有限公司 Recovery method for exceptions during automation execution
CN104239208B (en) * 2014-09-19 2017-02-15 福建星海通信科技有限公司 Recovery method for exceptions during automation execution
CN104503918A (en) * 2015-01-12 2015-04-08 北京国双科技有限公司 Handling method and device for abnormal information
CN104503770A (en) * 2015-01-12 2015-04-08 北京国双科技有限公司 Handling method and device for abnormal information
CN104503918B (en) * 2015-01-12 2017-12-19 北京国双科技有限公司 The processing method and processing device of abnormal information
CN105354105A (en) * 2015-10-28 2016-02-24 上海斐讯数据通信技术有限公司 Software exception handling system and method
CN105354105B (en) * 2015-10-28 2018-04-06 上海斐讯数据通信技术有限公司 Software anomaly processing system and method
CN105718374A (en) * 2016-01-26 2016-06-29 国家信息技术安全研究中心 Method and system for hotspot module instruction tracking
CN105843675B (en) * 2016-04-01 2020-06-26 腾讯科技(深圳)有限公司 Thread exit method and device
CN105843675A (en) * 2016-04-01 2016-08-10 腾讯科技(深圳)有限公司 Thread exiting method and device
CN107451046B (en) * 2016-05-30 2020-11-17 腾讯科技(深圳)有限公司 Method and terminal for detecting threads
CN107451046A (en) * 2016-05-30 2017-12-08 腾讯科技(深圳)有限公司 A kind of method and terminal for detecting thread
CN106227672B (en) * 2016-08-10 2019-07-09 中车株洲电力机车研究所有限公司 A kind of built-in application program failure captures and processing method
CN106227672A (en) * 2016-08-10 2016-12-14 中车株洲电力机车研究所有限公司 A kind of built-in application program fault catches and processing method
CN106372505A (en) * 2016-08-23 2017-02-01 北京航空航天大学 Embedded system code attack-oriented quick recovery method
CN106372505B (en) * 2016-08-23 2018-12-28 北京航空航天大学 A kind of quick recovery method for Embedded System Code attack
CN106528316A (en) * 2016-11-10 2017-03-22 霍尔果斯霹雳互动网络科技有限公司 Anti-crash method and system of online game server
CN106951337B (en) * 2017-03-28 2020-09-11 北京奇虎科技有限公司 Method and equipment for realizing cross-system operation of application based on exception handling
CN106951337A (en) * 2017-03-28 2017-07-14 北京奇虎科技有限公司 A kind of method and apparatus for the cross-system operation that application is realized based on abnormality processing
CN109117253A (en) * 2017-06-26 2019-01-01 阿里巴巴集团控股有限公司 A kind of method and apparatus of micro-kernel scheduling
US11954520B2 (en) 2017-06-26 2024-04-09 Alibaba Group Holding Limited Micro kernel scheduling method and apparatus
CN109117253B (en) * 2017-06-26 2022-05-24 阿里巴巴集团控股有限公司 Method and device for scheduling microkernels
CN108345542A (en) * 2018-02-28 2018-07-31 腾讯科技(深圳)有限公司 Abnormality eliminating method and device in a kind of application program
CN108345542B (en) * 2018-02-28 2021-01-29 腾讯科技(深圳)有限公司 Method and device for processing exception in application program
CN108958850A (en) * 2018-06-29 2018-12-07 郑州云海信息技术有限公司 A kind of log optimization method, device, equipment and computer readable storage medium
CN111190707A (en) * 2019-08-02 2020-05-22 腾讯科技(深圳)有限公司 Data processing method and device
CN111124726B (en) * 2019-12-09 2024-01-26 上海移远通信技术股份有限公司 Method and device for detecting abnormality of open modem port
CN111124726A (en) * 2019-12-09 2020-05-08 上海移远通信技术股份有限公司 Method and device for detecting abnormity of opened modem port
CN112000577A (en) * 2020-08-25 2020-11-27 得到(天津)文化传播有限公司 Code checking method and device, electronic equipment and storage medium
CN112000577B (en) * 2020-08-25 2023-12-26 得到(天津)文化传播有限公司 Code checking method and device, electronic equipment and storage medium
CN112445642A (en) * 2020-11-09 2021-03-05 浙江吉利控股集团有限公司 Exception handling method, remote parking assist system, and computer storage medium
CN112445642B (en) * 2020-11-09 2023-05-16 浙江吉利控股集团有限公司 Abnormality processing method, remote parking assist system, and computer storage medium
CN113220495A (en) * 2021-05-24 2021-08-06 浙江大华技术股份有限公司 Process abnormal event processing method and device, electronic equipment and storage medium
CN113220495B (en) * 2021-05-24 2024-04-16 浙江大华技术股份有限公司 Method and device for processing process abnormal event, electronic equipment and storage medium

Also Published As

Publication number Publication date
WO2009146612A1 (en) 2009-12-10
CN101599039B (en) 2011-11-02

Similar Documents

Publication Publication Date Title
CN101599039B (en) Abnormal handling method and device under embedded type C language environment
CN103069385B (en) System and method for dynamic load calculating based on figure
CN101719090A (en) Method for automatically analyzing crash cause of computer software system
CN101887365B (en) Method and system for constructing executable code for component-based applications
CN101446918B (en) Method for realizing debugging of single function by user state debugger and system thereof
CN101553769A (en) Method and system for tracking and monitoring computer applications
CN101278265A (en) Profiling using user-level control mechanism
CN106325819A (en) Computer instruction processing method, coprocessor and system
CN102135911B (en) Method, device and system for starting and stopping server process
CN105308578B (en) The diagnosis of state transformation
KR20120083800A (en) Apparatus and method for compression of trace data
CN107015904B (en) Stack protection method and device
AU2020412360A1 (en) Unit testing of components of dataflow graphs
CN109375921A (en) Page file quickly compiles method, apparatus and storage equipment, computer equipment
CN103109293A (en) User motion processing system and method
AU2014262225A1 (en) Dynamically loading graph-based computations
CN102163174A (en) Methods and devices for quitting and deleting thread or process in embedded C language environment
CN109284222B (en) Software unit, project testing method, device and equipment in data processing system
CN101681362B (en) Storage optimization method
US20160210553A1 (en) Predicting the Impact of Change on Events Detected in Application Logic
US9032372B2 (en) Runtime environment and method for non-invasive monitoring of software applications
KR101916960B1 (en) Apparatus and method in which a plurality of source codes are automatically combined
Dai A hybrid approach to cloud system performance bug detection, diagnosis and fix
AU2016200107A1 (en) Dynamically loading graph-based computations
Zhang Code Generation Techniques for Raw Data Processing

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
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20111102

Termination date: 20170603