Patent ID: 8762785

Claim:
A method for handling exceptions in an embedded system, comprising: when running an application program, establishing an application-level exception callback linked list for the application program, and establishing a task-level exception callback linked list for each task in the application program; registering, by the application program, task-level exception handling functions and a corresponding relation between the task-level exception handling functions and exception information into each task-level exception callback linked list, and registering application-level exception handling functions and a corresponding relation between the application-level exception handling functions and exception information into the application-level exception callback linked list; when capturing an exception, searching the corresponding relation between the task-level exception handling function and the exception information to locate an task-level exception handling function matching exception information of the captured exception, according to the exception information of the captured exception; when no matched task-level exception handling function is located or the captured exception is not eliminated by the located task-level exception handling function, determining whether an upgrading processing for the captured exception is necessary according to the exception information; when it is determined that the upgrading processing for the captured exception is necessary, searching the corresponding relation between the application-level exception handling function and the exception information in the application-level exception callback linked list to locate an application-level exception handling function matching the exception information of the captured exception, according to the exception information of the captured exception; calling and executing the located exception handling function to perform an exception handling.