Pin
|
Classes | |
struct | EXCEPTION_INFO |
Typedefs | |
typedef struct EXCEPTION_INFO | EXCEPTION_INFO |
Variables | |
const UINT32 | MAX_WINDOWS_EXCEPTION_ARGS = 5 |
This API allows the user to raise exceptions on behalf of the application and also analyze information associated with exceptions.
typedef struct EXCEPTION_INFO EXCEPTION_INFO |
Structure that describes an exception.
The tool should not read or modify data members of this structure directly, but must treat the structure as logically opaque and use the Exception API functions to manage it.
enum EXCEPTION_CLASS |
Basic definitions pertaining to hardware and software exceptions.
Identifiers of exception classes. Exception class indicates the type of information (set of attributes) that accompanies exceptions of this class.
enum EXCEPTION_CODE |
Identifiers for all possible exception codes. The codes below are divided into two groups. The first group list all the exceptions that can be raised by PIN_RaiseException(). Tools that want to be portable across operating systems should use codes from this first group when raising exceptions via PIN_RaiseException().
When Pin receives an exception and reports it to the tool, it may report an exception in either the first or second group. This can happen, for example, when using the PIN_SafeCopyEx() function. When Pin can identify a specific exception, it reports a code from the first group. Sometimes, though, the host operating system does not provide enough information for Pin to determine the exact exception. In these cases, Pin reports a code from the second group (one of the EXCEPTCODE_RECEIVED_ codes). A tool can always re-raise one of these exceptions by passing it to PIN_RaiseException(). However, portable tools should avoid creating new exceptions using codes from the second group, because these codes are not supported on all operating systems.
Enumerator | |
---|---|
EXCEPTCODE_NONE | Reserved. No real exception has this code. |
EXCEPTCODE_ACCESS_INVALID_ADDRESS | Virtual address not mapped (the #PF exception). Belongs to EXCEPTCLASS_ACCESS_FAULT. |
EXCEPTCODE_ACCESS_DENIED | Access not permitted due to protection violation (the #PF exception). Belongs to EXCEPTCLASS_ACCESS_FAULT. |
EXCEPTCODE_ACCESS_INVALID_PAGE | A #PF exception for some reason other than the cases above. Belongs to EXCEPTCLASS_ACCESS_FAULT. |
EXCEPTCODE_ACCESS_MISALIGNED | Misaligned memory reference (the #AC exception). Belongs to EXCEPTCLASS_ACCESS_FAULT. |
EXCEPTCODE_ILLEGAL_INS | Illegal instruction (the #UD exception). Belongs to EXCEPTCLASS_INVALID_INS. |
EXCEPTCODE_PRIVILEGED_INS | Privileged instruction (the #GP exception). Belongs to EXCEPTCLASS_INVALID_INS. |
EXCEPTCODE_INT_DIVIDE_BY_ZERO | Integer divide by zero (the #DE exception). Belongs to EXCEPTCLASS_INT_ERROR. |
EXCEPTCODE_INT_OVERFLOW_TRAP | Integer overflow trap (the #OF trap). Belongs to EXCEPTCLASS_INT_ERROR. |
EXCEPTCODE_INT_BOUNDS_EXCEEDED | Array index is out of bounds (#BR exception). Belongs to EXCEPTCLASS_INT_ERROR. |
EXCEPTCODE_X87_DIVIDE_BY_ZERO | x87 FPU divide by zero (the #MF/#Z exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_X87_OVERFLOW | x87 FPU overflow (the #MF/#O exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_X87_UNDERFLOW | x87 FPU underflow (the #MF/#U exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_X87_INEXACT_RESULT | x87 FPU inexact result (the #MF/#P exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_X87_INVALID_OPERATION | x87 FPU invalid operation (the #MF/#IA exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_X87_DENORMAL_OPERAND | x87 FPU denormal operand (the #MF/#D exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_X87_STACK_ERROR | x87 FPU stack overflowed or underflowed (the #MF/#IS exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_SIMD_DIVIDE_BY_ZERO | SIMD floating point divide by zero (the #XM/#Z exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_SIMD_OVERFLOW | SIMD floating point overflow (the #XM/#O exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_SIMD_UNDERFLOW | SIMD floating point underflow (the #XM/#U exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_SIMD_INEXACT_RESULT | SIMD floating point inexact result (the #XM/#P exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_SIMD_INVALID_OPERATION | SIMD invalid floating point operation (the #XM/#I exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_SIMD_DENORMAL_OPERAND | SIMD denormal floating point operand (the #XM/#D exception). Belongs to EXCEPTCLASS_FP_ERROR. |
EXCEPTCODE_DBG_BREAKPOINT_TRAP | Breakpoint trap (the #BP trap). Belongs to EXCEPTCLASS_DEBUG. |
EXCEPTCODE_DBG_SINGLE_STEP_TRAP | Trace trap (the #DB trap). Belongs to EXCEPTCLASS_DEBUG. |
EXCEPTCODE_ACCESS_WINDOWS_GUARD_PAGE | Guard page access (the Windows STATUS_GUARD_PAGE_VIOLATION exception). Belongs to EXCEPTCLASS_ACCESS_FAULT. |
EXCEPTCODE_ACCESS_WINDOWS_STACK_OVERFLOW | Thread stack overflowed (the Windows STATUS_STACK_OVERFLOW exception). Belongs to EXCEPTCLASS_ACCESS_FAULT. |
EXCEPTCODE_WINDOWS | Generic Windows exception. Belongs to EXCEPTCLASS_OS. |
EXCEPTCODE_RECEIVED_UNKNOWN | Unknown exception, cannot be re-raised. Belongs to EXCEPTCLASS_UNKNOWN. |
EXCEPTCODE_RECEIVED_ACCESS_FAULT | General memory access fault. Belongs to EXCEPTCLASS_ACCESS_FAULT. |
EXCEPTCODE_RECEIVED_AMBIGUOUS_X87 | Ambiguous x87 FPU exception. PIN_GetFpErrorSet() tell which are possible. Belongs to EXCEPTCLASS_MULTIPLE_FP_ERROR. |
EXCEPTCODE_RECEIVED_AMBIGUOUS_SIMD | Ambiguous SIMD FPU exception. PIN_GetFpErrorSet() tell which are possible. Belongs to EXCEPTCLASS_MULTIPLE_FP_ERROR. |
enum FAULTY_ACCESS_TYPE |
enum FPERROR |
Possible types of FPU exceptions.
|
inline |
Retrieve the number of Windows system exception's arguments from the specified EXCEPTION_INFO structure.
[in] | pExceptInfo | pointer to the exception information structure to be queried |
|
inline |
Get a string representation of the specified EXCEPTION_INFO structure.
[in] | pExceptInfo | pointer to the exception information structure to be stringized |
|
inline |
Retrieve the address of the instruction that caused the specified exception.
[in] | pExceptInfo | pointer to the exception information structure to be queried |
|
inline |
Given an exception code, return the corresponding exception class.
[in] | exceptCode | exception code |
|
inline |
Retrieve the exception code from the specified EXCEPTION_INFO structure.
[in] | pExceptInfo | pointer to the exception information structure to be queried |
|
inline |
Retrieve the address of the faulty memory access from the specified EXCEPTION_INFO structure.
[in] | pExceptInfo | pointer to the exception information structure to be queried |
[out] | pAccessAddress | pointer to variable that receives the address of the faulty memory access, if known. If this pointer is NULL, the function only checks if the requested address is known but does not return its value. |
|
inline |
Retrieve the type of the faulty memory access from the specified EXCEPTION_INFO structure.
[in] | pExceptInfo | pointer to the exception information structure to be queried |
|
inline |
Retrieve the set of floating point exception codes from the specified EXCEPTION_INFO structure. For EXCEPTCODE_RECEIVED_AMBIGUOUS_X87 and EXCEPTCODE_RECEIVED_AMBIGUOUS_SIMD exceptions, this is the set of possible causes for the exception.
[in] | pExceptInfo | pointer to the exception information structure to be queried |
|
inline |
Retrieve the specified Windows system exception's argument from the specified EXCEPTION_INFO structure.
[in] | pExceptInfo | pointer to the exception information structure to be queried |
[in] | argNum | ordinal number of the argument to be retrieved, starting from zero. The value of this parameter should not exceed the value returned by the PIN_CountWindowsExceptionArguments function. |
|
inline |
Retrieve the Windows system exception code from the specified EXCEPTION_INFO structure.
[in] | pExceptInfo | pointer to the exception information structure to be queried |
|
inline |
Initialize the specified EXCEPTION_INFO structure with the given attributes of an EXCEPTCLASS_ACCESS_FAULT exception.
[out] | pExceptInfo | pointer to the exception information structure to be initialized |
[in] | exceptCode | exception code that specifies an EXCEPTCLASS_ACCESS_FAULT exception |
[in] | exceptAddress | address of the instruction that caused the exception |
[in] | accessAddress | address of the faulty memory access |
[in] | accessType | type of the faulty memory access |
|
inline |
Initialize the specified EXCEPTION_INFO structure with the given generic exception's attributes. Set "unknown" state for all exception-specific attributes.
[out] | pExceptInfo | pointer to the exception information structure to be initialized |
[in] | exceptCode | exception code. It could specify any exception other than EXCEPTCODE_WINDOWS |
[in] | exceptAddress | address of the instruction that caused the exception |
|
inline |
Initialize the specified EXCEPTION_INFO structure with the given attributes of an EXCEPTCODE_WINDOWS exception.
[out] | pExceptInfo | pointer to the exception information structure to be initialized |
[in] | sysExceptCode | the system exception code |
[in] | exceptAddress | address of the instruction that caused the exception |
[in] | numArgs | number of arguments associated with the system exception. This is the number of elements in the <pArgs> array; it should not exceed the MAX_WINDOWS_EXCEPTION_ARGS value. |
[in] | pArgs | pointer to an array of arguments associated with the system exception or NULL if the number of arguments is zero |
VOID PIN_RaiseException | ( | const CONTEXT * | ctxt, |
THREADID | tid, | ||
const EXCEPTION_INFO * | pExceptInfo | ||
) |
A tool can call this API to raise an emulated exception in the application's calling thread. Calling this API abandons the current analysis function and immediately starts executing at the application's exception handler (if there is one) or terminates the application (if there is no handler). This API does not return back to the calling analysis function.
When raising a floating point exception, this method merely raises the exception. It does not set any bits in the floating point status register, nor does it check that the exception is enabled via the exception mask. If the tool wishes to examine or change the floating point status register bits, it may do so via the ctxt parameter.
This function can be called from an analysis function or a replacement routine, but not from an instrumentation callback.
[in] | ctxt | Register state to be reported as the application's context at the exception point. |
[in] | tid | Id of the calling thread. |
[in] | pExceptInfo | Pointer to the EXCEPTION_INFO structure that describes the exception. The exception information should be properly initialized. |
|
inline |
Set the address of the instruction that caused the specified exception.
[in,out] | pExceptInfo | pointer to the exception information structure that receives the new exception address |
[in] | exceptAddress | address of the instruction that caused the exception |
const UINT32 MAX_WINDOWS_EXCEPTION_ARGS = 5 |
Maximum number of arguments that can be associated with an EXCEPTCODE_WINDOWS exception.