Beispiel #1
0
static brkp *PointBreak( memory_expr def_seg, address *addr )
{
    unsigned    index;
    brkp        *bp;
    unsigned    old;

    if( addr != NULL ) {
        *addr = NilAddr;
    }
    if( CurrToken == T_SHARP ) {
        Scan();
        old = NewCurrRadix( 10 );
        index = ReqExpr(); // always decimal
        NewCurrRadix( old );
        for( bp = BrkList; bp != NULL; bp = bp->next ) {
            if( bp->index == index ) {
                break;
            }
        }
    } else {
        ReqMemAddr( def_seg, addr );
        for( bp = BrkList; bp != NULL; bp = bp->next ) {
            if( AddrComp( bp->loc.addr, *addr ) == 0 ) {
                break;
            }
        }
    }
    ReqEOC();
    if( bp != NULL && addr != NULL ) {
        *addr = bp->loc.addr;
    }
    return( bp );
}
Beispiel #2
0
void ProcSkip( void )
{
    address    start;

    ReqMemAddr( EXPR_GIVEN, &start );
    ReqEOC();
    SkipToAddr( start );
}
Beispiel #3
0
void StepIntoFunction( char *func )
{
    char        *old;
    address     stop;

    old = ReScan( func );
    ReqMemAddr( EXPR_CODE, &stop );
    ReScan( old );
    GoToAddr( stop );
}
Beispiel #4
0
void ProcGo( void )
{
    address     start;
    address     stop;
    bool        have_start;
    bool        have_stop;
    bool        have_keep;
    bool        doflip;
    bool        flip_on;
    bool        until;
    unsigned    conditions;
    int         count;

    have_keep = FALSE;
    doflip = TRUE;
    until = FALSE;
    while( CurrToken == T_DIV ) {
        Scan();
        switch( ScanCmd( GoOptionTab ) ) {
        case KEEP:
            have_keep = TRUE;
            break;
        case NOFLIP:
            doflip = FALSE;
            break;
        case UNTIL:
            until = TRUE;
            break;
        default:
            Error( ERR_LOC, LIT( ERR_BAD_OPTION ), GetCmdName( CMD_GO ) );
        }
    }
    if( !have_keep ) TraceKill();
    NullStatus( &DbgTmpBrk );
    start = GetRegIP();
    have_stop = FALSE;
    have_start = FALSE;
    if( !ScanEOC() ) {
        stop = start;
        ReqMemAddr( EXPR_GIVEN, &stop );
        if( CurrToken == T_COMMA ) {
            start = stop;
            have_start = TRUE;
            Scan();
            if( !ScanEOC() ) {
                ReqMemAddr( EXPR_GIVEN, &stop );
                have_stop = TRUE;
            }
        } else {
            have_stop = TRUE;
        }
    }
    ReqEOC();
    count = 0;
    do {
        if( have_stop ) {
            if( have_keep ) {
                if( UserTmpBrk.status.b.has_address ) {
                    NullStatus( &UserTmpBrk );
                    UserTmpBrk.status.b.has_address = TRUE;
                } else {
                    NullStatus( &UserTmpBrk );
                }
                Error( ERR_NONE, LIT( ERR_INCONSISTENT_GO ) );
            }
            SetTempBreak( stop );
        } else if( have_keep ) {
            if( UserTmpBrk.status.b.has_address ) {
                UserTmpBrk.status.b.active = TRUE;
            }
        } else {
            NullStatus( &UserTmpBrk );
        }
        if( have_start ) {
            RecordSetRegIP( start );
        }
        flip_on = _IsOn( SW_FLIP );
        if( !doflip ) {
            _SwitchOff( SW_FLIP );
        }
        conditions = Go( doflip );
        if( flip_on ) _SwitchOn( SW_FLIP );
        if( UserTmpBrk.status.b.has_address ) {
            NullStatus( &UserTmpBrk );
            UserTmpBrk.status.b.has_address = TRUE;
        } else {
            NullStatus( &UserTmpBrk );
        }
    } while( until && (conditions & COND_BREAK) && AddrComp( stop, GetRegIP() ) != 0 && ++count < 100 );
}
Beispiel #5
0
OVL_EXTERN void GetExprGivenAddr( void *value )
{
    ReqMemAddr( EXPR_GIVEN, value );
    ReqEOC();
}
Beispiel #6
0
OVL_EXTERN void GetExprDataAddr( void *value )
{
    ReqMemAddr( EXPR_DATA, value );
    ReqEOC();
}
Beispiel #7
0
OVL_EXTERN void GetExprCodeAddr( void *value )
{
    ReqMemAddr( EXPR_CODE, value );
    ReqEOC();
}
Beispiel #8
0
static brkp *SetPoint( memory_expr def_seg, mad_type_handle th )
{
    brkp            *bp;
    const char      *start;
    size_t          len;
    address         loc;
    cmd_list        *cmds;
    char            *condition;
    long            countdown;
    bool            resume;
    bool            active;
    int             index;
    mad_type_info   mti;
    unsigned        old;
    bool            unmapped;
    bool            mapaddress;
    bool            symaddress;
    char            *image_name;
    char            *mod_name;
    char            *sym_name;
    long            cue_diff;
    long            addr_diff;
    int             cmd;

    resume = false;
    index = 0;
    active = true;
    unmapped = false;
    mapaddress = false;
    symaddress = false;
    while( CurrToken == T_DIV ) {
        Scan();
        cmd = ScanCmd( PointNameTab );
        if( cmd < 0 )
            break;
        switch( cmd ) {
        case B_RESUME:
            resume = true;
            break;
        case B_UNRESUME:
            resume = false;
            break;
        case B_ACTIVATE:
            active = true;
            break;
        case B_DEACTIVATE:
            active = false;
            break;
        case B_UNMAPPED:
            unmapped = true;
            break;
        case B_MAPADDRESS:
            mapaddress = true;
            ScanItem( true, &start, &len );
            image_name = DupStrLen( start, len );
            loc.mach.segment = ReqLongExpr();
            loc.mach.offset = ReqLongExpr();
            ReqComma();
            break;
        case B_SYMADDRESS:
            symaddress = true;
            ScanItem( true, &start, &len );
            image_name = DupStrLen( start, len );
            ScanItem( true, &start, &len );
            mod_name = DupStrLen( start, len );
            ScanItem( true, &start, &len );
            sym_name = DupStrLen( start, len );
            cue_diff = ReqLongExpr();
            addr_diff = ReqLongExpr();
            loc = NilAddr;
            ReqComma();
            break;
        case B_INDEX:
            old = NewCurrRadix( 10 );
            index = ReqExpr();
            NewCurrRadix( old );
            ReqComma();
            break;
            /* fall thru */
        default:
            Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_BREAK ) );
            break;
        }
    }
    if( !unmapped ) {
        ReqMemAddr( def_seg, &loc );
    }
    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        if( AddrComp( bp->loc.addr, loc ) == 0 ) {
            Error( ERR_NONE, LIT_ENG( ERR_POINT_EXISTS ) );
        }
    }
    cmds = NULL;
    condition = NULL;
    countdown = 0;
    if( ScanQuote( &start, &len ) ) {
        if( len != 0 )
            cmds = AllocCmdList( start, len );
        if( ScanQuote( &start, &len ) ) {
            if( len != 0 )
                condition = DupStrLen( start, len );
            if( !ScanEOC() ) {
                countdown = ReqExpr();
            }
        }
    }
    ReqEOC();
    if( !IS_BP_EXECUTE( th ) ) {
        MADTypeInfo( th, &mti );
        switch( mti.b.bits / BITS_PER_BYTE ) {
        case 1:
        case 2:
        case 4:
            break;
        case 8:
            if( Is8ByteBreakpointsSupported() )
                break;
        default:
            Error( ERR_NONE, LIT_ENG( ERR_NOT_WATCH_SIZE ) );
            break;
        }
    }
    bp = AddPoint( loc, th, unmapped );
    if( bp == NULL )
        return( NULL );
    bp->status.b.unmapped = unmapped;
    if( mapaddress ) {
        bp->loc.image_name = image_name;
    }
    if( symaddress ) {
        bp->image_name = image_name;
        bp->mod_name = mod_name;
        bp->sym_name = sym_name;
        bp->cue_diff = cue_diff;
        bp->addr_diff = addr_diff;
    }
    bp->cmds = cmds;
    if( cmds != NULL )
        bp->status.b.use_cmds = true;
    bp->condition = condition;
    if( condition != NULL )
        bp->status.b.use_condition = true;
    SetBPCountDown( bp, countdown );
    bp->status.b.resume = resume;
    bp->status.b.active = active;
    if( index != 0 )
        bp->index = index;
    RecordBreakEvent( bp, B_SET );
    return( bp );
}
Beispiel #9
0
void OptMemAddr( memory_expr def_seg, address *def_val )
{
    if( CurrToken == T_COMMA || ScanEOC() ) return;
    ReqMemAddr( def_seg, def_val );
}