Whenever an error occurs in a Simics API function, that function will raise an exception. An exception consists of an exception type and an error message.
The following exception types are defined in the Simics API:
typedef enum sim_exception {
SimExc_No_Exception,
SimExc_General,
SimExc_Arithmetic,
SimExc_Lookup,
SimExc_Attribute,
SimExc_IOError,
SimExc_Index,
SimExc_Memory,
SimExc_Inquiry,
SimExc_InquiryOutsideMemory,
SimExc_InquiryUnhandled,
SimExc_Overflow,
SimExc_Syntax,
SimExc_Type,
SimExc_ZeroDivision,
SimExc_RuntimeError,
SimExc_Break,
SimExc_PythonTranslation,
SimExc_IllegalValue,
SimExc_ObjectNotFound,
SimExc_InterfacedNotFound,
SimExc_AttrNotFound,
SimExc_AttrNotReadable,
SimExc_AttrNotWritable,
SimExc_NeedInteger,
SimExc_NeedFloating,
SimExc_NeedBoolean,
SimExc_NeedString,
SimExc_NeedList,
SimExc_NeedDict,
SimExc_NeedData,
SimExc_NeedObject,
SimExc_InternalRevexecBreak,
} sim_exception_t;
Note that API users writing in C must use SIM_clear_exception() and SIM_last_error() since C does not support exceptions. In Python, the Simics API exceptions will trigger actual Python exceptions, which you can capture using try ... except.
To raise exceptions from C, use SIM_frontend_exception(). From Python, use the normal raise statement.