Changeset 415

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

Debugger works again.

Location:
branches/thune/thread_safe
Files:
7 modified

Legend:

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

    r114 r415  
    1515   Show current stack. 
    1616*/ 
    17 void StackDisplay::update( UThread* ur_thread, UString* tmp ) 
     17void StackDisplay::update( UThread* ut, UString* tmp ) 
    1818{ 
    1919    clear(); 
    2020 
    21     if( ur_env ) 
     21    if( ut ) 
    2222    { 
    2323        UCell* it = UR_TOS; 
  • 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 
  • branches/thune/thread_safe/debugger/ThuneDebugger.h

    r114 r415  
    77 
    88#include <QMainWindow> 
    9 #include "urlan.h" 
     9#include "env.h" 
    1010 
    1111 
     
    5959    QString strippedName(const QString &fullFileName); 
    6060 
    61     static int monitorIgnore( int cmd, UCell* pc, UCell* end ); 
    62     static int monitorRun( int cmd, UCell* pc, UCell* end ); 
    63     static int monitorStep( int cmd, UCell* pc, UCell* end ); 
     61    static int monitorIgnore( UThread*, int cmd, UCell* pc, UCell* end ); 
     62    static int monitorRun   ( UThread*, int cmd, UCell* pc, UCell* end ); 
     63    static int monitorStep  ( UThread*, int cmd, UCell* pc, UCell* end ); 
    6464 
    6565    void showPC( UThread*, UCell* pc, UCell* end ); 
     
    9494    QEventLoop* _loop; 
    9595    UrlanEnv _env; 
    96     UIndex _tmpStrN; 
    97     UIndex _tmpStrHold; 
    9896 
    9997    enum 
  • branches/thune/thread_safe/debugger/project.r

    r114 r415  
    1111 
    1212    include_from %.. 
    13     libs_from %../ %thune0 
     13    libs_from %../ %thune_emh 
    1414 
    15     cflags "-DUR_CONFIG_EMH" 
     15    cflags "-DLANG_THUNE -DUR_CONFIG_EMH" 
    1616 
    1717    linux [ 
    1818        ;libs_from %/usr/X11R6/lib64 
    1919        ;  {SM Xinerama Xext Xrandr Xrender Xcursor Xi Xft X11} 
     20        include_from %../unix 
     21        libs {bz2} 
    2022        libs {png freetype dl} 
    2123    ] 
  • branches/thune/thread_safe/doc/UserManual

    r414 r415  
    7575block!       []  [a b c] 
    7676paren!       ()  (a b c) 
     77macro!       <size 2 mul> 
    7778vector!      #[1 2 3]  #[-85.33 2 44.8] 
    7879function!    [2 add] proc :inc2 
     
    9192context! 
    9293===========  ========== 
     94 
     95 
     96Macros 
     97------ 
     98 
     99Reader macros are simply blocks of code evaluated by the tokenizer. 
     100Any reduced values created by the evaluation are appended to the block 
     101currently being read. 
     102 
     103Macros can be used wherever a constant is needed to improve evaluation 
     104speed. 
     105 
     106Example:: 
     107 
     108    <34 2 mul :border> 
     109 
     110    box-width <border> add 
     111 
     112 
     113Currently, macro! values cannot be created by the user. 
     114A literal macro syntax may be added in the future. 
    93115 
    94116 
  • branches/thune/thread_safe/env.h

    r388 r415  
    3333    OSMutex     mutex; 
    3434#ifdef UR_CONFIG_EMH 
    35     int (*monitor)(int,UCell*,UCell*); 
     35    int (*monitor)(UThread*,int,UCell*,UCell*); 
    3636#endif 
    3737}; 
  • branches/thune/thread_safe/thune.c

    r408 r415  
    284284#ifdef UR_CONFIG_EMH 
    285285#define EMH_STEP(pc,end) \ 
    286     if( ut->env->monitor(UR_EMH_STEP,pc,end) ) \ 
     286    if( ut->env->monitor(ut,UR_EMH_STEP,pc,end) ) \ 
    287287        goto call_return; 
    288288 
    289289#define EMH_HALT(pc,end) \ 
    290     if( ! ut->env->monitor(UR_EMH_HALT,pc,end) ) \ 
     290    if( ! ut->env->monitor(ut,UR_EMH_HALT,pc,end) ) \ 
    291291        goto execute; 
    292292#else 
     
    769769        case UT_CALL: 
    770770            val->call.addr( ut, UR_TOS ); 
    771 #ifdef UR_CONFIG_DT_CODE 
     771#if defined(UR_CONFIG_EMH) || defined(UR_CONFIG_DT_CODE) 
    772772call_return: 
    773773#endif