Пример #1
0
/** Get all parts of the machine state required for a dump.
 * This includes basic thread state, and exception registers.
 *
 * @param thread The thread to get state for.
 *
 * @param machineContext The machine context to fill out.
 */
bool ksmachexc_i_fetchMachineState(const thread_t thread,
                                   _STRUCT_MCONTEXT* const machineContext)
{
    if(!ksmach_threadState(thread, machineContext))
    {
        return false;
    }

    if(!ksmach_exceptionState(thread, machineContext))
    {
        return false;
    }

    return true;
}
Пример #2
0
int ksbt_backtraceThread(const thread_t thread,
                         uintptr_t* const backtraceBuffer,
                         const int maxEntries)
{
    STRUCT_MCONTEXT_L machineContext;

    if(!ksmach_threadState(thread, &machineContext))
    {
        return 0;
    }

    return ksbt_backtraceThreadState(&machineContext,
                                     backtraceBuffer,
                                     0,
                                     maxEntries);
}