Show
Ignore:
Timestamp:
06/16/07 22:57:20 (17 months ago)
Author:
krobillard
Message:

Debugger works again.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/thune/thread_safe/debugger/ThuneDebugger.cpp

    r152 r415  
    2424 
    2525    _mode = kModeVoid; 
     26    _env.threads = 0; 
    2627 
    2728    _loop = new QEventLoop( this ); 
     
    484485 
    485486 
    486 void ThuneDebugger::showPC( UThread* ur_thread, UCell* pc, UCell* end ) 
    487 { 
    488     UString* str = ur_binPtr( _tmpStrN ); 
     487void ThuneDebugger::showPC( UThread* ut, UCell* pc, UCell* end ) 
     488{ 
     489    UString* str = ur_threadTmp( ut ); 
    489490 
    490491    ur_arrayReserve( str, 1, 4 ); 
     
    515516    _console->append( str->ptr.c ); 
    516517 
    517     _stack->update( ur_thread, str ); 
    518 } 
    519  
    520  
    521 int ThuneDebugger::monitorIgnore( int, UCell*, UCell* ) 
     518    _stack->update( ut, str ); 
     519} 
     520 
     521 
     522int ThuneDebugger::monitorIgnore( UThread*, int, UCell*, UCell* ) 
    522523{ 
    523524    return 0; 
     
    525526 
    526527 
    527 int ThuneDebugger::monitorRun( int cmd, UCell* pc, UCell* end ) 
    528 { 
    529     UThread* ur_thread = &ur_env->mainThread; 
    530  
     528int ThuneDebugger::monitorRun( UThread* ut, int cmd, UCell* pc, UCell* end ) 
     529{ 
    531530    switch( cmd ) 
    532531    { 
     
    547546            gDB->setMode( kModeStep ); 
    548547 
    549             gDB->showPC( ur_thread, pc, end ); 
     548            gDB->showPC( ut, pc, end ); 
    550549            int ret = gDB->_loop->exec(); 
    551550            if( ret < 0 ) 
     
    560559 
    561560 
    562 int ThuneDebugger::monitorStep( int cmd, UCell* pc, UCell* end ) 
    563 { 
    564     UThread* ur_thread = &ur_env->mainThread; 
    565  
     561int ThuneDebugger::monitorStep( UThread* ut, int cmd, UCell* pc, UCell* end ) 
     562{ 
    566563    switch( cmd ) 
    567564    { 
    568565        case UR_EMH_STEP: 
    569             gDB->showPC( ur_thread, pc, end ); 
     566            gDB->showPC( ut, pc, end ); 
    570567            int ret = gDB->_loop->exec(); 
    571568            //printf( "KR ret %d\n", ret ); 
     
    641638    _env.monitor = monitorIgnore; 
    642639 
    643     if( ur_startup( &_env ) ) 
     640    if( ur_startup( &_env, 0, 0 ) ) 
    644641        return false; 
    645642 
    646     _tmpStrN = ur_makeBinary( 256 ); 
    647     _tmpStrHold = ur_hold( UT_STRING, _tmpStrN ); 
    648  
    649643    return true; 
    650644} 
     
    653647void ThuneDebugger::destroyEnv() 
    654648{ 
    655     if( ur_env ) 
     649    if( _env.threads ) 
    656650        ur_shutdown( &_env ); 
    657651} 
     
    662656    UCell* res; 
    663657    QByteArray cmd; 
    664     UThread* ur_thread = &ur_env->mainThread; 
     658    UThread* ut = _env.threads; 
    665659 
    666660    cmd = _editor->toPlainText().toAscii(); 
    667661 
    668     switch( ur_evalCStr( ur_thread, cmd, cmd.size() ) ) 
     662    switch( ur_evalCStr( ut, cmd, cmd.size() ) ) 
    669663    { 
    670664        case UR_EVAL_OK: 
    671665        { 
    672             res = ur_result( ur_thread, 0 ); 
     666            res = ur_result( ut, 0 ); 
    673667 
    674668            if( ! ur_is(res, UT_UNSET) && 
     
    707701            UString* str; 
    708702 
    709             res = ur_result( ur_thread, 0 ); 
     703            res = ur_result( ut, 0 ); 
    710704            str = ur_binPtr( res->err.messageStr ); 
    711705