Ejemplo n.º 1
0
void SkipToAddr( address addr )
{
    if( IS_NIL_ADDR( addr ) ) return;
    if( !AdvMachState( ACTION_MODIFY_IP ) ) return;
    RecordSetRegIP( addr );
    DbgUpdate( UP_CSIP_CHANGE | UP_REG_CHANGE );
}
Ejemplo n.º 2
0
void MakeRunThdCurr( thread_state *thd )
{
    unsigned    err;

    if( !AdvMachState( ACTION_THREAD_CHANGE ) ) return;
    if( RemoteSetRunThreadWithErr( thd->tid, &err ) == 0 ) {
        Error( ERR_NONE, LIT( ERR_NO_MAKE_CURR_THREAD ), thd->tid, err );
    }
    DbgRegs->tid = thd->tid;
    ReadDbgRegs();
    SetCodeDot( GetRegIP() );
    DbgUpdate( UP_REG_CHANGE | UP_CSIP_CHANGE | UP_THREAD_STATE );
}
Ejemplo n.º 3
0
void ProcAssign( void )
{
    char        *startpos;

    if( !AdvMachState( ACTION_ASSIGNMENT ) ) {
        FlushEOC();
        return;
    }
    startpos = ScanPos();
    NormalExpr();
    PopEntry();
    ReqEOC();
    RecordCommand( startpos, CMD_ASSIGN );
}
Ejemplo n.º 4
0
unsigned Execute( bool tracing, bool do_flip )
{
    unsigned    conditions;
    bool        stack_cmds;
    static unsigned executing = 0;

    if( !CheckStackPos() )
        return( COND_USER );
    if( !AdvMachState( ACTION_EXECUTE ) )
        return( COND_USER );

    if( executing == 0 ) {
        ++executing;
        HookNotify( true, HOOK_EXEC_START );
        --executing;
    }

    /* get rid of useless pending input information */
    for( ;; ) {
        if( CurrToken != T_LINE_SEPARATOR )
            break;
        if( InpStack == NULL )
            break;
        if( InpStack->type & (INP_HOLD|INP_STOP_PURGE) )
            break;
        if( InpStack->rtn( InpStack->handle, INP_RTN_EOL ) )
            continue;
        PopInpStack();
    }
    _SwitchOff( SW_TRAP_CMDS_PUSHED );
    conditions = ExecProg( tracing, do_flip, true );
    SetCodeDot( GetRegIP() );
    stack_cmds = true;
    if( tracing && (conditions & COND_BREAK) )
        stack_cmds = false;
    if( ReportTrap( conditions, stack_cmds ) ) {
        _SwitchOn( SW_TRAP_CMDS_PUSHED );
    }
    if( executing == 0 ) {
        ++executing;
        HookNotify( true, HOOK_EXEC_END );
        --executing;
    }
    if( conditions & COND_TERMINATE ) {
        HookNotify( true, HOOK_PROG_END );
    }
    return( conditions );
}
Ejemplo n.º 5
0
void MakeThdCurr( thread_state *thd )
{
    error_handle    errh;

    if( !AdvMachState( ACTION_THREAD_CHANGE ) )
        return;
    // NYI - PUI - record the thread change?
    WriteDbgRegs();
    if( RemoteSetThreadWithErr( thd->tid, &errh ) == 0 ) {
        Error( ERR_NONE, LIT_ENG( ERR_NO_MAKE_CURR_THREAD ), thd->tid, errh );
    }
    DbgRegs->tid = thd->tid;
    ReadDbgRegs();
    SetCodeDot( GetRegIP() );
    DbgUpdate( UP_REG_CHANGE | UP_CSIP_CHANGE | UP_THREAD_STATE );
}
Ejemplo n.º 6
0
void ChangeMemUndoable( address addr, const void *data, size_t size )
{
    char                *p;
    char                *end;

    if( AdvMachState( ACTION_MODIFY_MEMORY ) ) {
        ChangeMem( addr, data, size );
        end = TxtBuff + TXT_LEN;
        p = Format( TxtBuff, "%s %A", GetCmdName( CMD_MODIFY ), addr );
        for( ; size > 0 && p < end - ( 2 + 8 ); --size ) {
            p = StrCopy( ", ", p );
            p = CnvULong( *(unsigned char *)data, p, end - p );
            data = (char *)data + 1;
        }
        RecordEvent( TxtBuff );
        DbgUpdate( UP_MEM_CHANGE );
        CollapseMachState();
    }
}
Ejemplo n.º 7
0
void ChangeMemUndoable( address addr, const void *item, unsigned size )
{
    char                *p;
    const unsigned char *it;
    char                *end;

    if( AdvMachState( ACTION_MODIFY_MEMORY ) ) {
        ChangeMem( addr, item, size );
        it = item;
        end = TxtBuff + TXT_LEN;
        p = Format( TxtBuff, "%s %A", GetCmdName( CMD_MODIFY ), addr );
        for( ; size > 0; --size ) {
            p = StrCopy( ", ", p );
            p = CnvULong( *it++, p, end - p );
        }
        RecordEvent( TxtBuff );
        DbgUpdate( UP_MEM_CHANGE );
        CollapseMachState();
    }
}
Ejemplo n.º 8
0
void ProcModify( void )
{
    const char          *startpos;
    mad_type_handle     mth;
    mad_type_kind       tk;

    if( !AdvMachState( ACTION_MODIFY_MEMORY ) ) {
        FlushEOC();
        return;
    }
    startpos = ScanPos();
    if( CurrToken != T_DIV ) {
        MemMod( GetMADTypeHandleDefaultAt( NilAddr, MTK_BASIC ), MAS_MEMORY );
    } else {
        Scan();
        mth = ScanType( MAS_ALL | MTK_ALL, &tk );
        if( mth == MAD_NIL_TYPE_HANDLE ) {
            Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_MODIFY ) );
        }
        MemMod( mth, tk );
    }
    RecordCommand( startpos, CMD_MODIFY );
}