Example #1
0
static void     RunTrdMenuItem( a_window *wnd, unsigned id, int row, int piece )
{
    thread_state        *thd = GetThreadRow( row );

    piece=piece;
    switch( id ) {
    case MENU_INITIALIZE:
        if( thd == NULL ) {
            WndMenuGrayAll( wnd );
        } else {
            switch( thd->state ) {
            case THD_SIGNAL:
                WndMenuEnable( wnd, MENU_RUN_THREAD_STOP, TRUE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_SIGNAL_STOP, TRUE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_CHANGE_TO, FALSE );
                break;

            case THD_DEBUG:
                WndMenuEnable( wnd, MENU_RUN_THREAD_STOP, FALSE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_SIGNAL_STOP, FALSE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_CHANGE_TO, TRUE );
                break;

            case THD_RUN:
            case THD_WAIT:
            case THD_BLOCKED:
                WndMenuEnable( wnd, MENU_RUN_THREAD_STOP, TRUE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_SIGNAL_STOP, FALSE );
                WndMenuEnable( wnd, MENU_RUN_THREAD_CHANGE_TO, FALSE );
                break;

            default:
                WndMenuGrayAll( wnd );
                break;
            }                    
        }
        return;
    case MENU_RUN_THREAD_STOP:
        RemoteStopThread( thd );
        break;
    case MENU_RUN_THREAD_SIGNAL_STOP:
        RemoteSignalStopThread( thd );
        break;
    case MENU_RUN_THREAD_CHANGE_TO:
        MakeRunThdCurr( thd );
        break;
    }
    DbgUpdate( UP_THREAD_STATE );
}
Example #2
0
static void TrdMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    thread_state        *thd = GetThreadRow( row );

    piece=piece;
    switch( id ) {
    case MENU_INITIALIZE:
        if( thd == NULL ) {
            WndMenuGrayAll( wnd );
        } else {
            switch( thd->state ) {
            case THD_THAW:
            case THD_FREEZE:
                WndMenuEnable( wnd, MENU_THREAD_FREEZE, true );
                WndMenuEnable( wnd, MENU_THREAD_THAW, true );
                WndMenuEnable( wnd, MENU_THREAD_CHANGE_TO, true );
                break;
            case THD_DEBUG:
                WndMenuEnable( wnd, MENU_THREAD_FREEZE, false );
                WndMenuEnable( wnd, MENU_THREAD_THAW, false );
                WndMenuEnable( wnd, MENU_THREAD_CHANGE_TO, true );
                break;
            default:
                WndMenuGrayAll( wnd );
                break;
            }                    
        }
        return;
    case MENU_THREAD_FREEZE:
        if( thd->state == THD_THAW )
            thd->state = THD_FREEZE;
        break;
    case MENU_THREAD_THAW:
        if( thd->state == THD_FREEZE )
            thd->state = THD_THAW;
        break;
    case MENU_THREAD_CHANGE_TO:
        switch( thd->state ) {
        case THD_THAW:
        case THD_FREEZE:
        case THD_DEBUG:    
            MakeThdCurr( thd );
            break;
        }
    }
    DbgUpdate( UP_THREAD_STATE );
}
Example #3
0
static  bool    TrdGetLine( a_window *wnd, int row, int piece,
                             wnd_line_piece *line )
{
    thread_state        *thd = GetThreadRow( row );

    line->indent = Indents[piece] * WndAvgCharX( wnd );
    if( row < 0 ) {
        row += TITLE_SIZE;
        switch( row ) {
        case 0:
            switch( piece ) {
            case PIECE_ID:
                line->text = LIT_DUI( ID );
                return( true );
            case PIECE_STATE:
                line->text = LIT_DUI( State );
                return( true );
            case PIECE_NAME:
                line->text = TxtBuff;
                RemoteThdName( 0, TxtBuff ); // nyi - pui - line up in proportional font
                return( true );
            default:
                return( false );
            }
        case 1:
            if( piece != 0 )
                return( false );
            SetUnderLine( wnd, line );
            return( true );
        default:
            return( false );
        }
    } else {
        if( thd == NULL )
            return( false );
        line->tabstop = false;
        line->use_prev_attr = true;
        line->extent = WND_MAX_EXTEND;
        switch( piece ) {
        case PIECE_ID:
            line->tabstop = true;
            line->use_prev_attr = false;
            line->text = TxtBuff;
            CnvULongHex( thd->tid, TxtBuff, TXT_LEN );
            return( true );
        case PIECE_STATE:
            if( IsThdCurr( thd ) ) {
                line->text = LIT_ENG( Current );
            } else {
                switch( thd->state ) {
                case THD_THAW:
                    line->text = LIT_ENG( Runnable );
                    break;
                case THD_FREEZE:
                    line->text = LIT_ENG( Frozen );
                    break;
                case THD_WAIT:
                    line->text = LIT_ENG( Wait );
                    break;  
                case THD_SIGNAL:
                    line->text = LIT_ENG( Signal );
                    break;  
                case THD_KEYBOARD:
                    line->text = LIT_ENG( Keyboard );
                    break;  
                case THD_BLOCKED:
                    line->text = LIT_ENG( Blocked );
                    break;  
                case THD_RUN:
                    line->text = LIT_ENG( Executing );
                    break;  
                case THD_DEBUG:
                    line->text = LIT_ENG( Debug );
                    break;
                case THD_DEAD:
                    line->text = LIT_ENG( Dead );
                    break;
                }
            }
            return( true );
        case PIECE_NAME:
            line->tabstop = false;
            line->use_prev_attr = true;
            line->text = thd->name;
            return( true );
        }
    }
    return( false );
}
Example #4
0
static  bool    RunTrdGetLine( a_window *wnd, int row, int piece,
                               wnd_line_piece *line )
{
    thread_state        *thd = GetThreadRow( row );

    line->indent = Indents[ piece ] * WndAvgCharX( wnd );
    if( row < 0 ) {
        row += TITLE_SIZE;
        switch( row ) {
        case 0:
            if( piece < PieceCount ) {
                line->text = HeaderArr[ piece ];
                return( TRUE );
            } 
            return( FALSE );
        case 1:
            if( piece != 0 ) return( FALSE );
            SetUnderLine( wnd, line );
            return( TRUE );
        default:
            return( FALSE );
        }
    } else {
        if( thd == NULL ) return( FALSE );
        line->tabstop = FALSE;
        line->use_prev_attr = TRUE;
        line->extent = WND_MAX_EXTEND;
        switch( InfoType[ piece ] ) {
        case RUN_THREAD_INFO_TYPE_NAME:
            line->tabstop = TRUE;
            line->use_prev_attr = FALSE;
            line->text = thd->name;
            return( TRUE );
        case RUN_THREAD_INFO_TYPE_STATE:
            if( IsThdCurr( thd ) && ( thd->state == THD_DEBUG ) ) {
                line->text = LIT( Current );
            } else {
                switch( thd->state ) {
                case THD_THAW:
                    line->text = LIT( Runnable );
                    break;
                case THD_FREEZE:
                    line->text = LIT( Frozen );
                    break;
                case THD_WAIT:
                    line->text = LIT( Wait );
                    break;  
                case THD_SIGNAL:
                    line->text = LIT( Signal );
                    break;  
                case THD_KEYBOARD:
                    line->text = LIT( Keyboard );
                    break;  
                case THD_BLOCKED:
                    line->text = LIT( Blocked );
                    break;  
                case THD_RUN:
                    line->text = LIT( Executing );
                    break;  
                case THD_DEBUG:
                    line->text = LIT( Debug );
                    break;
                case THD_DEAD:
                    line->text = LIT( Dead );
                    break;
                }
            }
            return( TRUE );
        case RUN_THREAD_INFO_TYPE_EXTRA:
            line->tabstop = FALSE;
            line->use_prev_attr = TRUE;
            line->text = thd->extra;
            return( TRUE );
        case RUN_THREAD_INFO_TYPE_CS_EIP:
            line->tabstop = FALSE;
            line->use_prev_attr = TRUE;
            if( thd->cs ) {
                sprintf(TxtBuff, "%04hX:%08lX", thd->cs, thd->eip );
                line->text = TxtBuff;
            } else {
                line->text = "";
            }
            return( TRUE );
        }
    }
    return( FALSE );
}