Exemplo n.º 1
0
trap_retval ReqRunThread_get_name( void )
{
    run_thread_get_name_req *acc;
    char                    *name;
    struct TDebug           *obj;
    struct TDebugThread     *t = 0;

    acc = GetInPtr( 0 );
    name = GetOutPtr( 0 );
    strcpy( name, "" );

    if( acc->thread == 0 )
        strcpy( name, "Name" );
    else {
        obj = GetCurrentDebug();
            if (obj) {
            t = LockThread( obj, acc->thread );

            if( t )
                sprintf( name, "%04hX %s", t->ThreadID, t->ThreadName );

            UnlockThread( obj );
        }
    }

    return( strlen( name ) + 1 );
}
Exemplo n.º 2
0
trap_retval ReqRunThread_set( void )
{
    run_thread_set_req      *acc;
    run_thread_set_ret      *ret;
    struct TDebug           *obj;
    struct TDebugThread     *t = 0;

    acc = GetInPtr( 0 );
    ret = GetOutPtr( 0 );

    ret->old_thread = 0;
    ret->err = 0;

    obj = GetCurrentDebug();
    if (obj )
        t = obj->CurrentThread;

    if( t )
        ret->old_thread = t->ThreadID;

    if( obj && acc->thread != 0 ) {
        SetCurrentThread( obj, acc->thread );
        SetCurrentDebug( obj );
    }

    return( sizeof( *ret ) );
}
Exemplo n.º 3
0
trap_retval ReqRunThread_poll( void )
{
    struct TDebug           *obj;
    struct TDebugThread     *thread;
    run_thread_poll_ret     *ret;

    ret = GetOutPtr( 0 );
    ret->conditions = 0;

    obj = GetCurrentDebug();

    if (obj) {
        thread = GetCurrentThread( obj );
        if( thread ) {
            SetCurrentThread( obj, thread->ThreadID );
            SetCurrentDebug( obj );
        }

        if( IsTerminated( obj ) )
            ret->conditions |= COND_TERMINATE;

        if( HasThreadChange( obj ) ) {
            ret->conditions |= COND_THREAD;
            ClearThreadChange( obj );
        }

        if( HasModuleChange( obj ) ) {
            ret->conditions |= COND_LIBRARIES;
        }
    }
    return( sizeof( *ret ) );
}
Exemplo n.º 4
0
trap_retval ReqRunThread_get_next( void )
{
    run_thread_get_next_req *acc;
    run_thread_get_next_ret *ret;
    struct TDebug           *obj;

    acc = GetInPtr( 0 );
    ret = GetOutPtr( 0 );
    ret->thread = 0;

    obj = GetCurrentDebug();
        if (obj)
        ret->thread = GetNextThread( obj, acc->thread );

    return( sizeof( *ret ) );
}
Exemplo n.º 5
0
trap_retval ReqRead_regs( void )
{
    mad_registers           _WCUNALIGNED *mr;
    struct TDebug           *obj;
    struct TDebugThread     *thread;

    mr = GetOutPtr( 0 );
    memset( mr, 0, sizeof( mr->x86 ) );

    obj = GetCurrentDebug();
    if (obj) {
        thread = obj->CurrentThread;
        if( thread ) {
            mr->x86.cpu.eax = thread->Eax;
            mr->x86.cpu.ebx = thread->Ebx;
            mr->x86.cpu.ecx = thread->Ecx;
            mr->x86.cpu.edx = thread->Edx;
            mr->x86.cpu.esi = thread->Esi;
            mr->x86.cpu.edi = thread->Edi;
            mr->x86.cpu.esp = thread->Esp;
            mr->x86.cpu.ebp = thread->Ebp;
            mr->x86.cpu.eip = thread->Eip;
            mr->x86.cpu.efl = thread->Eflags;
            mr->x86.cpu.cr3 = thread->Cr3;
            mr->x86.cpu.ds = thread->Ds;
            mr->x86.cpu.cs = thread->Cs;
            mr->x86.cpu.es = thread->Es;
            mr->x86.cpu.ss = thread->Ss;
            mr->x86.cpu.fs = thread->Fs;
            mr->x86.cpu.gs = thread->Gs;

            mr->x86.u.fpu.cw = thread->MathControl;
            mr->x86.u.fpu.sw = thread->MathStatus;
            mr->x86.u.fpu.tag = thread->MathTag;
            mr->x86.u.fpu.ip_err.p.offset = thread->MathEip;
            mr->x86.u.fpu.ip_err.p.segment = thread->MathCs;
            mr->x86.u.fpu.op_err.p.offset = thread->MathDataOffs;
            mr->x86.u.fpu.op_err.p.segment = thread->MathDataSel;
            memcpy( mr->x86.u.fpu.reg, thread->St, 8 * 10 );

        }
    }

    return( sizeof( mr->x86 ) );
}
Exemplo n.º 6
0
trap_retval ReqWrite_regs( void )
{
    mad_registers           _WCUNALIGNED *mr;
    struct TDebug           *obj;
    struct TDebugThread     *thread;

    mr = GetInPtr( sizeof( write_regs_req ) );

    obj = GetCurrentDebug();
    if (obj) {
        thread = obj->CurrentThread;
        if( thread ) {
            thread->Eax = mr->x86.cpu.eax;
            thread->Ebx = mr->x86.cpu.ebx;
            thread->Ecx = mr->x86.cpu.ecx;
            thread->Edx = mr->x86.cpu.edx;
            thread->Esi = mr->x86.cpu.esi;
            thread->Edi = mr->x86.cpu.edi;
            thread->Esp = mr->x86.cpu.esp;
            thread->Ebp = mr->x86.cpu.ebp;
            thread->Eip = mr->x86.cpu.eip;
            thread->Eflags = mr->x86.cpu.efl;
            thread->Ds = mr->x86.cpu.ds;
            thread->Cs = mr->x86.cpu.cs;
            thread->Es = mr->x86.cpu.es;
            thread->Ss = mr->x86.cpu.ss;
            thread->Fs = mr->x86.cpu.fs;
            thread->Gs = mr->x86.cpu.gs;

            thread->MathControl = mr->x86.u.fpu.cw;
            thread->MathStatus = mr->x86.u.fpu.sw;
            thread->MathTag = mr->x86.u.fpu.tag;
            thread->MathEip = mr->x86.u.fpu.ip_err.p.offset;
            thread->MathCs = mr->x86.u.fpu.ip_err.p.segment;
            thread->MathDataOffs = mr->x86.u.fpu.op_err.p.offset;
            thread->MathDataSel = mr->x86.u.fpu.op_err.p.segment;
            memcpy( thread->St, mr->x86.u.fpu.reg, 8 * 10 );

            WriteRegs( thread );
        }
    }
    return( 0 );
}
Exemplo n.º 7
0
unsigned ReqGet_message_text( void )
{
    get_message_text_ret    *ret;
    char                    *err_txt;
    struct TDebug           *obj;
    char                    *msg;

    obj = GetCurrentDebug();

    ret = GetOutPtr( 0 );
    ret->flags = MSG_ERROR;
    err_txt = GetOutPtr( sizeof( *ret ) );

    if( obj->CurrentThread )
        msg = obj->CurrentThread->FaultText;
    else
        msg = "Exception fault";

    strcpy( err_txt, msg );

    return( sizeof( *ret ) + strlen( err_txt ) + 1 );
}