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 ); }
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( bp->th != MAD_NIL_TYPE_HANDLE ) 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 ); }
static bool ExactCueAt( asm_window *asw, address addr, cue_handle *ch ) { if( !asw->source ) return( FALSE ); if( DeAliasAddrCue( NO_MOD, addr, ch ) == SR_NONE ) return( FALSE ); if( AddrComp( CueAddr( ch ), addr ) ) return( FALSE ); return( TRUE ); }
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 ); }
static bool HaveHitBP( brkp *bp ) { if( !bp->status.b.active ) return( FALSE ); if( !bp->status.b.in_place ) return( FALSE ); if( !SectIsLoaded( bp->loc.addr.sect_id, OVL_MAP_EXE ) ) return( FALSE ); if( AddrComp( bp->loc.addr, GetRegIP() ) != 0 ) return( FALSE ); return( TRUE ); }
static int AsmAddrRow( a_window *wnd, address ip ) { int row; asm_window *asw = WndAsm( wnd ); for( row = 0; row < WndRows( wnd ); ++row ) { if( asw->ins[ row ].line != 0 ) continue; if( AddrComp( asw->ins[ row ].addr, ip ) == 0 ) break; } return( row ); }
brkp *FindBreak( address addr ) { brkp *bp; if( IS_NIL_ADDR( addr ) ) return( NULL ); for( bp = BrkList; bp != NULL; bp = bp->next ) { if( ( AddrComp( bp->loc.addr, addr ) == 0 ) ) { return( bp ); } } return( NULL ); }
static void FileSetDotAddr( a_window *wnd, address addr ) { file_window *file = WndFile( wnd ); if( AddrComp( file->dotaddr, addr ) == 0 ) return; file->dotaddr = addr; if( IS_NIL_ADDR( addr ) ) return; if( wnd == WndFindActive() ) { AsmMoveDot( file->asw, addr ); SetCodeDot( addr ); } }
static bool BrkGetLine( a_window *wnd, int row, int piece, wnd_line_piece *line ) { brkp *bp; break_window *wndbreak; bool curr; wndbreak = WndBreak( wnd ); bp = BrkGetBP( row ); if( bp == NULL ) return( false ); line->text = TxtBuff; line->tabstop = false; switch( piece ) { #ifdef OPENER_GADGET case PIECE_OPENER: { mod_handle mh; line->text = LIT_DUI( Empty ); if( bp->size == 0 ) { DeAliasAddrMod( bp->loc.addr, &mh ); bp->status.b.source_open = OpenGadget( wnd, line, mh, bp->source_line != NULL ); } return( true ); } #endif case PIECE_ACTIVE: #ifdef OPENER_GADGET line->indent = MaxGadgetLength + WndAvgCharX( wnd ); #endif curr = AddrComp( bp->loc.addr, Context.execution ) == 0; FileBreakGadget( wnd, line, curr, bp ); return( true ); case PIECE_ADDR: line->indent = wndbreak->addr_indent; line->extent = WND_MAX_EXTEND; line->tabstop = true; GetBPAddr( bp, TxtBuff ); return( true ); case PIECE_SOURCE: line->indent = wndbreak->source_indent; line->tabstop = false; line->use_prev_attr = true; GetBPText( bp, TxtBuff ); return( true ); default: return( false ); } }
static bool InsertOneBP( brkp *bp, bool force ) { bool at_ip; at_ip = false; if( bp->status.b.active ) { if( !force && AddrComp( bp->loc.addr, GetRegIP() ) == 0 ) { at_ip = true; } else if( SectIsLoaded( bp->loc.addr.sect_id, OVL_MAP_EXE ) ) { bp->status.b.in_place = true; bp->item.ud = RemoteSetBreak( bp->loc.addr ); } } return( at_ip ); }
brkp *AddBreak( address addr ) { brkp *bp; for( bp = BrkList; bp != NULL; bp = bp->next ) { if( AddrComp( bp->loc.addr, addr ) == 0 ) { DoActPoint( bp, true ); DbgUpdate( UP_BREAK_CHANGE ); return( bp ); } } bp = AddPoint( addr, BP_EXECUTE, false ); if( bp != NULL ) RecordBreakEvent( bp, B_SET ); return( bp ); }
extern brkp *AddBreak( address addr ) { brkp *bp; for( bp = BrkList; bp != NULL; bp = bp->next ) { if( AddrComp( bp->loc.addr, addr ) == 0 ) { DoActPoint( bp, TRUE ); DbgUpdate( UP_BREAK_CHANGE ); return( bp ); } } bp = AddPoint( addr, MAD_NIL_TYPE_HANDLE, FALSE ); if( bp == NULL ) return( NULL ); RecordBreakEvent( bp, B_SET ); return( bp ); }
static void AsmSetDotAddr( a_window *wnd, address addr ) { mod_handle mod; asm_window *asw = WndAsm( wnd ); if( AddrComp( asw->dotaddr, addr ) != 0 ) { WndRowDirty( wnd, -TITLE_SIZE ); asw->dotaddr = addr; DeAliasAddrMod( addr, &mod ); if( mod != asw->mod ) { DbgUpdate( UP_OPEN_CHANGE ); asw->mod = mod; AsmSetTitle( wnd ); } if( IS_NIL_ADDR( addr ) ) return; if( wnd == WndFindActive() ) { SrcMoveDot( asw->src, addr ); SetCodeDot( addr ); } } }
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 ); }
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 ); }