Exemple #1
0
static void SetupTrace( struct TDebugThread *obj )
{
    int update = FALSE;
    Tss tss;
    unsigned char ch = 0;

    obj->FDebug = FALSE;
    obj->FWasTrace = TRUE;

    RdosGetThreadTss( obj->ThreadID, &tss );

    RdosReadThreadMem( obj->ThreadID, tss.cs, tss.eip, (char *)&ch, 1 );

    if( ch == 0xCC ) {
        tss.eip++;
        update = TRUE;
    }

    if( ( tss.eflags & 0x100 ) == 0 ) {
        tss.eflags |= 0x100;
        update = TRUE;
    }

    if( update )
        RdosSetThreadTss( obj->ThreadID, &tss );
}
Exemple #2
0
void WriteRegs( struct TDebugThread *obj )
{
    Tss tss;
    int i;

    RdosGetThreadTss( obj->ThreadID, &tss );

    tss.eflags = obj->Eflags;
    tss.eax = obj->Eax;
    tss.ecx = obj->Ecx;
    tss.edx = obj->Edx;
    tss.ebx = obj->Ebx;
    tss.esp = obj->Esp;
    tss.ebp = obj->Ebp;
    tss.esi = obj->Esi;
    tss.edi = obj->Edi;
    tss.es = obj->Es;
    tss.ss = obj->Ss;
    tss.ds = obj->Ds;
    tss.fs = obj->Fs;
    tss.gs = obj->Gs;

    tss.MathControl = obj->MathControl;
    tss.MathStatus = obj->MathStatus;
    tss.MathTag = obj->MathTag;

    for( i = 0; i < 8; i++ )
        tss.st[i] = obj->St[i];

    RdosSetThreadTss( obj->ThreadID, &tss );
}
Exemple #3
0
static void SetupTrace( struct TDebugThread *obj )
{
    int         update = FALSE;
    Tss         tss;
    opcode_type brk_opcode = 0;

    obj->FDebug = FALSE;
    obj->FWasTrace = TRUE;

    RdosGetThreadTss( obj->ThreadID, &tss );

    RdosReadThreadMem( obj->ThreadID, tss.cs, tss.eip, (char *)&brk_opcode, sizeof( brk_opcode ) );

    if( brk_opcode == BRKPOINT ) {
        tss.eip++;
        update = TRUE;
    }

    if( ( tss.eflags & TRACE_BIT ) == 0 ) {
        tss.eflags |= TRACE_BIT;
        update = TRUE;
    }

    if( update ) {
        RdosSetThreadTss( obj->ThreadID, &tss );
    }
}