Beispiel #1
0
bool BreakWrite( address addr, mad_type_handle th, const char *comment )
{
    brkp                *bp;
    mad_type_info       mti;
    bool                ok_to_try = true;

    if( IS_BP_EXECUTE( th ) )
        return( false );
    MADTypeInfo( th, &mti );
    switch( mti.b.bits / BITS_PER_BYTE ) {
    case 8:
        if( !Is8ByteBreakpointsSupported() ) {
            ok_to_try = false;
        }
        // fall down
    case 1:
    case 2:
    case 4:
        if( ok_to_try ) {
            if(  FindBreak( addr ) != NULL ) {
                Error( ERR_NONE, LIT_ENG( ERR_POINT_EXISTS ) );
            }
            bp = AddPoint( addr, th, false );
            if( bp == NULL )
                return( true );
            bp->source_line = DupStr( comment );
            RecordBreakEvent( bp, B_SET );
            return( true );
        }
        // fall down
    default:
        return( false );
    }
}
Beispiel #2
0
static void     BrkRefresh( a_window *wnd )
{
    brkp        *bp;
    int         row;

    if( UpdateFlags & BrkInfo.flags & ~(UP_OPEN_CHANGE|UP_MEM_CHANGE) ) {
        BrkInit( wnd );
    } else if( UpdateFlags & UP_MEM_CHANGE ) {
        row = 0;
        for( bp = BrkList; bp != NULL; bp = bp->next ) {
            if( !IS_BP_EXECUTE( bp->th ) ) {
                WndPieceDirty( wnd, row, PIECE_SOURCE );
            }
            ++row;
        }
    }
#ifdef OPENER_GADGET
    {
        int             i;
        brkp            *bp;
        mod_handle      mh;

        if( UpdateFlags & UP_OPEN_CHANGE ) {
            for( i = 0, bp = BrkList; bp != NULL; bp = bp->next, ++i ) {
                DeAliasAddrMod( bp->loc.addr, &mh );
                bp->status.b.source_open =
                    CheckOpenGadget( wnd, i, bp->status.b.source_open, mh,
                                     bp->source_line != NULL, PIECE_OPENER );
            }
        }
    }
#endif
}
Beispiel #3
0
bool InsertBPs( bool force )
{
    brkp    *bp;
    bool    at_ip;

    at_ip = false;
    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        bp->status.b.cmds_pushed = false;
        if( !IS_BP_EXECUTE( bp->th ) )
            continue;
        bp->status.b.in_place = false;
        bp->status.b.hit = false;
        if( ( UserTmpBrk.status.b.active ) && ( AddrComp( UserTmpBrk.loc.addr, bp->loc.addr ) == 0 ) )
            continue;
        if( ( DbgTmpBrk.status.b.active ) && ( AddrComp( DbgTmpBrk.loc.addr, bp->loc.addr ) == 0 ) )
            continue;
        at_ip |= InsertOneBP( bp, force );
    }
    UserTmpBrk.status.b.hit = false;
    UserTmpBrk.status.b.in_place = false;
    DbgTmpBrk.status.b.hit = false;
    DbgTmpBrk.status.b.in_place = false;
    if( UserTmpBrk.status.b.active ) {
        at_ip |= InsertOneBP( &UserTmpBrk, force );
    }
    if( DbgTmpBrk.status.b.active
     && ( !UserTmpBrk.status.b.active
       || ( AddrComp( UserTmpBrk.loc.addr, DbgTmpBrk.loc.addr ) != 0 ) ) ) {
        at_ip |= InsertOneBP( &DbgTmpBrk, force );
    }
    return( at_ip );
}
Beispiel #4
0
static void     BrkMenuItem( a_window *wnd, gui_ctl_id id, int row, int piece )
{
    brkp        *bp;

    piece=piece;
    if( row < 0 ) {
        bp = NULL;
    } else {
        bp = BrkGetBP( row );
    }
    switch( id ) {
    case MENU_INITIALIZE:
        if( bp != NULL ) {
            WndMenuEnableAll( wnd );
            WndMenuEnable( wnd, MENU_BREAK_ENABLE, !bp->status.b.active );
            WndMenuEnable( wnd, MENU_BREAK_DISABLE, bp->status.b.active );
            WndMenuEnable( wnd, MENU_BREAK_SOURCE, bp != NULL && IS_BP_EXECUTE( bp->th ) );
            WndMenuEnable( wnd, MENU_BREAK_ASSEMBLY, bp != NULL && IS_BP_EXECUTE( bp->th ) );
        } else {
            WndMenuGrayAll( wnd );
        }
        WndMenuEnable( wnd, MENU_BREAK_CREATE_NEW, true );
        break;
    case MENU_BREAK_ENABLE:
        ActPoint( bp, true );
        break;
    case MENU_BREAK_DISABLE:
        ActPoint( bp, false );
        break;
    case MENU_BREAK_CREATE_NEW:
        if( DlgBreak( NilAddr ) )
            WndScrollBottom( wnd );
        break;
    case MENU_BREAK_CLEAR:
        RemoveBreak( bp->loc.addr );
        break;
    case MENU_BREAK_MODIFY:
        DlgBreak( bp->loc.addr );
        break;
    case MENU_BREAK_SOURCE:
        WndSrcInspect( bp->loc.addr );
        break;
    case MENU_BREAK_ASSEMBLY:
        WndAsmInspect( bp->loc.addr );
        break;
    }
}
Beispiel #5
0
static void DoActPoint( brkp *bp, bool act )
{
    bp->status.b.active = act;
    RecordBreakEvent( bp, act ? B_ACTIVATE : B_DEACTIVATE );
    if( !act && !IS_BP_EXECUTE( bp->th ) ) {
        GetWPVal( bp );
    }
}
Beispiel #6
0
bool DispBPMsg( bool stack_cmds )
{
    brkp        *bp;
    brkp        *next;
    char        *p;
    bool        ret;
    cmd_list    *cmds;

    ret = false;
    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        if( !bp->status.b.hit )
            continue;
        if( !bp->status.b.silent ) {
            p = GetBPAddrText( bp, TxtBuff );
            if( !IS_BP_EXECUTE( bp->th ) ) {
                p = StrCopy( " - ", p );
                p = StrVal( LIT_ENG( OldVal ), bp, p );
                GetWPVal( bp );
                p = StrVal( LIT_ENG( NewVal ), bp, p );
                *p = NULLCHAR;
            }
            DUIInfoBox( TxtBuff );
        }
        if( stack_cmds && bp->status.b.resume ) {
            cmds = AllocCmdList( "go/keep", sizeof( "go/keep" ) );
            PushCmdList( cmds );
            TypeInpStack( INP_HOOK );
            FreeCmdList( cmds );
            ret = true;
        }
        if( stack_cmds && ( bp->cmds != NULL ) && bp->status.b.use_cmds ) {
            bp->status.b.cmds_pushed = true;
            PushCmdList( bp->cmds );
            TypeInpStack( INP_BREAK_POINT );
            ret = true;
        }
    }
    for( bp = BrkList; bp != NULL; bp = next ) {
        next = bp->next;
        if( bp->status.b.autodestruct ) {
            DUIRemoveBreak( bp );
        }
    }
    if( UserTmpBrk.status.b.hit ) {
        p = Format( TxtBuff, LIT_ENG( Break_on_execute ) );
        Format( p, BrkFmt(), UserTmpBrk.loc.addr );
        DUIDlgTxt( TxtBuff );
    }
    return( ret );
}
Beispiel #7
0
bool BrkCheckWatchLimit( address loc, mad_type_handle th )
{
    bool                enough_iron;
    unsigned long       mult;
    brkp                *wp;
    mad_type_info       mti;
    unsigned            size;

    if( !IS_BP_EXECUTE( th ) ) {
        MADTypeInfo( th, &mti );
        size = mti.b.bits / BITS_PER_BYTE;
        enough_iron = RemoteSetWatch( loc, size, &mult );
    } else {
        enough_iron = true;
    }
    for( wp = BrkList; wp != NULL; wp = wp->next ) {
        if( IS_BP_EXECUTE( wp->th ) )
            continue;
        MADTypeInfo( wp->th, &mti );
        if( !RemoteSetWatch( wp->loc.addr, mti.b.bits / BITS_PER_BYTE, &mult ) ) {
            enough_iron = false;
        }
    }
    if( !IS_BP_EXECUTE( th ) ) {
        RemoteRestoreWatch( loc, size );
    }
    for( wp = BrkList; wp != NULL; wp = wp->next ) {
        if( IS_BP_EXECUTE( wp->th ) )
            continue;
        MADTypeInfo( wp->th, &mti );
        RemoteRestoreWatch( wp->loc.addr, mti.b.bits / BITS_PER_BYTE );
    }
    if( !enough_iron ) {
        return( DlgAreYouNuts( mult ) );
    }
    return( true );
}
Beispiel #8
0
static char     *GetBPAddrText( brkp *bp, char *p )
{
    if( IS_BP_EXECUTE( bp->th ) ) {
        p = Format( p, LIT_ENG( Break_on_execute ) );
        p = Format( p, BrkFmt(), bp->loc.addr );
    } else {
        p = StrCopy( LIT_ENG( Break_on_write ), p );
        if( bp->source_line != NULL ) {
            p = StrCopy( bp->source_line, p );
        } else {
            p = Format( p, "%a", bp->loc.addr );
        }
    }
    return( p );
}
Beispiel #9
0
void InsertWPs( void )
{
    brkp                *wp;
    unsigned long       mult;
    mad_type_info       mti;

    for( wp = BrkList; wp != NULL; wp = wp->next ) {
        if( IS_BP_EXECUTE( wp->th ) )
            continue;
        if( wp->status.b.active && SectIsLoaded( wp->loc.addr.sect_id, OVL_MAP_EXE ) ) {
            wp->status.b.in_place = true;
            MADTypeInfo( wp->th, &mti );
            RemoteSetWatch( wp->loc.addr, mti.b.bits / BITS_PER_BYTE, &mult );
        }
    }
}
Beispiel #10
0
void GetBPAddr( brkp *bp, char *buff )
{
    char                *p;

    if( bp->status.b.unmapped ) {
        p = StrCopy( LIT_ENG( Image_Not_Loaded ), buff );
        if( bp->image_name != NULL ) {
            *p++ = '(';
            p = StrCopy( bp->image_name, p );
            *p++ = ')';
        }
    } else if( !IS_BP_EXECUTE( bp->th ) && bp->source_line != NULL ) {
        p = StrCopy( bp->source_line, buff );
    } else {
        p = CnvNearestAddr( bp->loc.addr, buff, TXT_LEN );
    }
    StrCopy( ":", p );
}
Beispiel #11
0
bool UpdateWPs( void )
{
    brkp                *wp;
    bool                have_active;

    have_active = false;
    for( wp = BrkList; wp != NULL; wp = wp->next ) {
        if( IS_BP_EXECUTE( wp->th ) )
            continue;
        wp->status.b.hit = false;
        wp->status.b.has_value = false;
        if( wp->status.b.active && SectIsLoaded( wp->loc.addr.sect_id, OVL_MAP_EXE ) ) {
            have_active = true;
            GetWPVal( wp );
        }
    }
    return( have_active );
}
Beispiel #12
0
void RemoveBPs( void )
{
    brkp    *bp;

    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        if( IS_BP_EXECUTE( bp->th ) ) {
            RemoveOneBP( bp );
        } else {
            RemoveOneWP( bp );
        }
    }
    if( UserTmpBrk.status.b.active ) {
        RemoveOneBP( &UserTmpBrk );
    }
    if( DbgTmpBrk.status.b.active ) {
        RemoveOneBP( &DbgTmpBrk );
    }
}
Beispiel #13
0
void GetBPText( brkp *bp, char *buff )
{
    unsigned    max;

    //MAD: might be a different mad then when break set
    max = ~0;
    if( IS_BP_EXECUTE( bp->th ) ) {
        if( bp->source_line != NULL ) {
            strcpy( buff, bp->source_line );
        } else {
            if( IS_NIL_ADDR( bp->loc.addr ) ) {
                strcpy( buff, LIT_ENG( Quest_Marks ) );
            } else {
                UnAsm( bp->loc.addr, buff, max );
            }
        }
    } else {
        MADTypeHandleToString( CurrRadix, bp->th, &bp->item, buff, &max );
    }
}
Beispiel #14
0
static brkp *AddPoint( address loc, mad_type_handle th, bool unmapped )
{
    brkp                *bp;
    brkp                **owner;

    if( !IS_BP_EXECUTE( th ) && !BrkCheckWatchLimit( loc, th ) )
        return( NULL );
    _Alloc( bp, sizeof( brkp ) );
    InitMappableAddr( &bp->loc );
    bp->th = th;
    bp->mad = SysConfig.mad;
    NullStatus( bp );
    bp->status.b.active = true;
    bp->source_line = NULL;
    bp->image_name = NULL;
    bp->mod_name = NULL;
    bp->sym_name = NULL;
    bp->cue_diff = 0;
    bp->status.b.unmapped = unmapped;
    SetPointAddr( bp, loc );
    bp->cmds = NULL;
    bp->status.b.use_cmds = false;
    bp->index = FindNextBPIndex();

    bp->total_hits = 0;
    bp->countdown = 0;
    bp->initial_countdown = 0;
    bp->status.b.use_countdown = false;
    bp->condition = NULL;
    bp->status.b.use_condition = false;
    bp->error = NULL;
    owner = &BrkList;
    while( *owner != NULL ) {
        owner = &((*owner)->next);
    }
    bp->next = NULL;
    *owner = bp;
    DbgUpdate( UP_BREAK_CHANGE );
    return( bp );
}
Beispiel #15
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 #16
0
void SetPointAddr( brkp *bp, address addr )
{
    DIPHDL( cue, ch );
    image_entry *image;
    mod_handle  mod;
    char  const *start;
    bool        ok;

    if( bp->status.b.unmapped )
        return;
    _Free( bp->source_line );
    bp->source_line = NULL;
    bp->loc.addr = addr;
    _Free( bp->mod_name );
    bp->mod_name = NULL;
    _Free( bp->image_name );
    bp->image_name = NULL;
    _Free( bp->sym_name );
    bp->sym_name = NULL;
    bp->cue_diff = 0;
    bp->addr_diff = 0;
    if( !IS_BP_EXECUTE( bp->th ) ) {
        GetWPVal( bp );
    } else if( DeAliasAddrMod( addr, &mod ) != SR_NONE ) {
        image = ImageEntry( mod );
        if( image == NULL )
            return;
        ModName( mod, TxtBuff, TXT_LEN );
        bp->mod_name = DupStr( TxtBuff );
        if( image->image_name != NULL ) {
            start = SkipPathInfo( image->image_name, OP_REMOTE );
            bp->image_name = DupStrLen( start, ExtPointer( start, OP_REMOTE ) - start );
        } else {
            bp->image_name = NULL;
        }
        switch( DeAliasAddrCue( NO_MOD, addr, ch ) ) {
        case SR_EXACT:
            bp->source_line = CopySourceLine( ch );
            Format( TxtBuff, "%d", CueLine( ch ) );
            bp->sym_name = DupStr( TxtBuff );
            ok = GetBPSymAddr( bp, &addr );
            break;
        case SR_CLOSEST:
            Format( TxtBuff, "%d", CueLine( ch ) );
            bp->sym_name = DupStr( TxtBuff );
            bp->addr_diff = addr.mach.offset - CueAddr( ch ).mach.offset;
            ok = GetBPSymAddr( bp, &addr );
            break;
        default:
            ok = false;
        }
        if( !ok ) {
            _Free( bp->image_name );
            _Free( bp->mod_name );
            _Free( bp->sym_name );
            bp->image_name = NULL;
            bp->mod_name = NULL;
            bp->sym_name = NULL;
        }
    }
}
Beispiel #17
0
unsigned CheckBPs( unsigned conditions, unsigned run_conditions )
{
    brkp                *bp;
    item_mach           item;
    bool                hit, bphit, wphit;
    bool                state_set;
    mad_type_info       mti;

    wphit = false;
    state_set = false;
    bphit = false;
    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        if( !bp->status.b.active )
            continue;
        hit = false;
        if( IS_BP_EXECUTE( bp->th ) ) {
            if( HaveHitBP( bp ) ) {
                hit = true;
            }
        } else {
            if( SectIsLoaded( bp->loc.addr.sect_id, OVL_MAP_EXE ) ) {
                MADTypeInfo( bp->th, &mti );
                if( ItemGetMAD( &bp->loc.addr, &item, IT_NIL, bp->th ) ) {
                    
                    /*
                     * If the breakpoint fires here because of a write, but the value hasn't changed then
                     * the breakpoint does not fire off!!!! The SupportsExactBreakpoints actually enables
                     * break on write, not break on change and allocates the exact data space - not plus
                     * or minus a few bytes...
                     *
                     */
                    
                    if( _IsOn( SW_BREAK_ON_WRITE ) && IsExactBreakpointsSupported() ) {

                        bool    drop_hit = false;
                        
                        if( ( UserTmpBrk.status.b.active ) || ( DbgTmpBrk.status.b.active ) ) {
                        
                            if( HaveHitBP( &UserTmpBrk ) ) {
                                drop_hit = true;
                            }
                            if( HaveHitBP( &DbgTmpBrk ) ) {
                                drop_hit = true;
                            }
                            if( ! ( conditions & ( COND_BREAK | COND_WATCH | COND_TRACE | COND_USER | COND_EXCEPTION | COND_STOP ) ) ) {
                                drop_hit = true;
                            }
                        }
                        
                        if( !drop_hit ) 
                            hit = true;
                    } else {
                        if( ( memcmp( &bp->item, &item, mti.b.bits / BITS_PER_BYTE ) != 0 ) || !bp->status.b.has_value ) {
                            hit = true;
                        }
                    }
                } else if( bp->status.b.has_value ) {
                    if( conditions & ( COND_BREAK | COND_WATCH | COND_TRACE | COND_USER | COND_EXCEPTION | COND_STOP ) ) {
                        hit = true;
                    }
                }
            }
        }
        if( hit ) {
            bp->total_hits++;
        }
        if( hit && bp->condition != NULL && bp->status.b.use_condition ) {
            _SwitchOn( SW_ERR_IN_TXTBUFF );
            if( !state_set ) {
                /* gets all the registers updated */
                SetProgState( run_conditions );
                state_set = true;
            }
            if( SpawnP( TestExpression, bp ) == 0 ) {
                if( !bp->status.b.expr_true ) {
                    hit = false;
                } else {
                    bp->status.b.expr_true = false;
                }
            } else {
                bp->status.b.expr_error = true;
                bp->error = DupStr( TxtBuff );
                hit = true;
            }
            _SwitchOff( SW_ERR_IN_TXTBUFF );
        }

        if( hit && bp->status.b.use_countdown && bp->countdown != 0 && !bp->status.b.expr_error ) {
            if( --bp->countdown != 0 ) {
                hit = false;
            }
        }
        if( hit ) {
            if( IS_BP_EXECUTE( bp->th ) ) {
                bphit = true;
            } else {
                wphit = true;
            }
            bp->status.b.hit = true;
        }
    }
    if( state_set ) {
        /* we might have changed a register in eval'ing conditions */
        WriteDbgRegs();
    }
    if( HaveHitBP( &UserTmpBrk ) ) {
        bphit = true;
        UserTmpBrk.status.b.hit = true;
    }
    if( HaveHitBP( &DbgTmpBrk ) ) {
        bphit = true;
        DbgTmpBrk.status.b.hit = true;
    }
    if( bphit )
        return( COND_BREAK | ( conditions & ~COND_STOPPERS ) );
    if( wphit )
        return( COND_WATCH | ( conditions & ~COND_STOPPERS ) );
    if( conditions & COND_BREAK ) {
        unsigned        max = TXT_LEN;

        ReadDbgRegs();
        if( MADUnexpectedBreak( &DbgRegs->mr, TxtBuff, &max ) == MS_OK ) {
            WriteDbgRegs();
            if( max == 0 ) {
                conditions &= ~COND_STOPPERS;
                if( _IsOff( SW_CONTINUE_UNEXPECTED_BREAK ) ) {
                    conditions |= COND_TRACE;
                }
                return( conditions );
            } else if( SetMsgText( TxtBuff, &conditions ) ) {
                DUIMsgBox( TxtBuff );
                return( COND_TRACE | COND_MESSAGE | ( conditions & ~COND_STOPPERS ) );
            } else {
                return( conditions & ~COND_STOPPERS );
            }
        } else {
            return( conditions & ~COND_STOPPERS );
        }
    } else if( conditions & COND_WATCH ) {
        return( conditions & ~COND_STOPPERS );
    }
    return( conditions );
}
Beispiel #18
0
static char *GetBPCmd( brkp *bp, brk_event event, char *buff, unsigned buff_len )
{
    char        *cmds;
    char        *cond;
    char        *p;
    char        *end = buff + buff_len ;

    cmds = cond = LIT_ENG( Empty );
    if( bp != NULL ) {
        if( bp->cmds != NULL ) cmds = bp->cmds->buff;
        if( bp->condition != NULL ) cond = bp->condition;
    }
    p = Format( buff, "%s", GetCmdName( CMD_BREAK ) );
    switch( event ) {
    case B_SET:
        *p++ = '/';
        if( IS_BP_EXECUTE( bp->th ) ) {
            p = GetCmdEntry( PointNameTab, B_SET, p );
        } else {
            p += GetMADTypeNameForCmd( bp->th, p, end - p );
            *p++ = ' ';
        }
        if( bp->status.b.resume ) {
            *p++ = '/';
            p = GetCmdEntry( PointNameTab, B_RESUME, p );
        }
        if( !bp->status.b.active ) {
            *p++ = '/';
            p = GetCmdEntry( PointNameTab, B_DEACTIVATE, p );
        }
        *p++ = ' ';
        *p++ = '/';
        p = GetCmdEntry( PointNameTab, B_INDEX, p );
        p = Format( p, " %d, ", bp->index );
        if( bp->loc.image_name != NULL ) {
            *p++ = '/';
            p = GetCmdEntry( PointNameTab, B_UNMAPPED, p );
            *p++ = ' ';
            *p++ = '/';
            p = GetCmdEntry( PointNameTab, B_MAPADDRESS, p );
            *p++ = ' ';
            p = StrCopy( bp->loc.image_name, p );
            *p++ = ' ';
            p = AddHexSpec( p );
            p = CnvULongHex( bp->loc.addr.mach.segment, p, end - p );
            *p++ = ' ';
            p = AddHexSpec( p );
            p = CnvULongHex( bp->loc.addr.mach.offset, p, end - p );
            *p++ = ',';
        } else if( bp->image_name != NULL && bp->mod_name != NULL ) {
            *p++ = '/';
            p = GetCmdEntry( PointNameTab, B_UNMAPPED, p );
            *p++ = ' ';
            *p++ = '/';
            p = GetCmdEntry( PointNameTab, B_SYMADDRESS, p );
            *p++ = ' ';
            p = StrCopy( bp->image_name, p );
            *p++ = ' ';
            p = StrCopy( bp->mod_name, p );
            *p++ = ' ';
            p = StrCopy( bp->sym_name, p );
            *p++ = ' ';
            p = AddHexSpec( p );
            p = CnvULongHex( bp->cue_diff, p, end - p );
            *p++ = ' ';
            p = AddHexSpec( p );
            p = CnvULongHex( bp->addr_diff, p, end - p );
            *p++ = ',';
        } else {
            p = AddrToString( &bp->loc.addr, MAF_FULL, p, end - p );
//          p = Format( p, " %A", bp->loc.addr );
        }
        p = Format( p, " {%s} {%s}", cmds, cond );
        if( bp->initial_countdown != 0 ) {
            p = StrCopy( " ", p );
            p = AddHexSpec( p );
            p = CnvULongHex( bp->initial_countdown, p, end - p );
        }
        return( p );
    case B_CLEAR:
    case B_ACTIVATE:
    case B_DEACTIVATE:
    case B_RESUME:
    case B_UNRESUME:
        *p++ = '/';
        p = GetCmdEntry( PointNameTab, event, p );
        if( bp == NULL ) {
            p = StrCopy( "*", p );
        } else {
            p = AddrToString( &bp->loc.addr, MAF_FULL, p, end - p );
//          p = Format( p, " %A", bp->loc.addr );
        }
        return( p );
    }
    return( NULL );
}