static void FuncRefresh( a_window *wnd ) { func_window *func = WndFunc( wnd ); mod_handle mod; if( UpdateFlags & UP_SYM_CHANGE ) { if( func->is_global ) { FuncNewMod( wnd, func->mod ); } else if( DeAliasAddrMod( GetCodeDot(), &mod ) == SR_NONE ) { FuncNoMod( wnd ); } else { FuncNewMod( wnd, mod ); } } else if( ( UpdateFlags & UP_CODE_ADDR_CHANGE ) && !func->is_global ) { if( DeAliasAddrMod( GetCodeDot(), &mod ) == SR_NONE ) { FuncNoMod( wnd ); } else { FuncNewMod( wnd, mod ); } } else if( UpdateFlags & UP_BREAK_CHANGE ) { if( func->toggled_break ) { func->toggled_break = FALSE; } else { WndRepaint( wnd ); } } }
static a_window *DoWndSrcInspect( address addr, bool existing ) { a_window *wnd; // bool nil; mod_handle mod; DIPHDL( cue, ch ); a_window *active; active = WndFindActive(); // nil = false; if( IS_NIL_ADDR( addr ) ) { // nil = true; addr = Context.execution; } wnd = NULL; if( existing ) { wnd = WndFindExisting( WND_SOURCE ); } if( wnd == NULL ) { if( DeAliasAddrMod( addr, &mod ) == SR_NONE || DeAliasAddrCue( mod, addr, ch ) == SR_NONE ) { ch = NULL; } wnd = DoWndSrcOpen( ch, existing ); } if( !SrcMoveDot( wnd, addr ) || !SrcHasFileOpen( wnd ) ) { if( active != NULL ) WndRestoreToFront( active ); return( NULL ); } return( wnd ); }
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 }
extern bool SrcMoveDot( a_window *wnd, address addr ) { unsigned line; mod_handle mod; file_window *file; DIPHDL( cue, ch ); if( wnd == NULL ) return( FALSE ); file = WndFile( wnd ); if( file->mod == NO_MOD && !file->track ) return( FALSE ); if( IS_NIL_ADDR( addr ) ) { WndScrollAbs( wnd, 0 ); return( FALSE ); } DeAliasAddrMod( addr, &mod ); if( DeAliasAddrCue( mod, addr, ch ) == SR_NONE ) { if( LineCue( mod, 0, 0, 0, ch ) == SR_NONE ) return( FALSE ); } line = CueLine( ch ); if( mod != file->mod || CueFileId( ch ) != file->file_id ) { if( !file->track ) return( FALSE ); FileTrack( wnd, ch ); } --line; WndScrollAbs( wnd, line ); // WndMoveCurrent( wnd, line, PIECE_SOURCE ); FileSetDotAddr( wnd, addr ); FileSetTitle( wnd, CueMod( ch ) ); return( TRUE ); }
address DefAddrSpaceForAddr( address addr ) { mod_handle mod; if( DeAliasAddrMod( addr, &mod ) == SR_NONE ) mod = NO_MOD; return( DefAddrSpaceForMod( mod ) ); }
void ClearAllModBreaks( mod_handle handle ) { brkp *bp, *next; mod_handle mh; for( bp = BrkList; bp != NULL; bp = next ) { next = bp->next; DeAliasAddrMod( bp->loc.addr, &mh ); if( mh == handle ) { RemovePoint( bp ); } } }
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 ); } }
void DbgUpdate( update_list flags ) { mod_handle prev_mod; input_stack *inp; UpdateFlags |= flags; if( flags & ( UP_SYM_CHANGE ) ) { BrkAddrRefresh(); } if( flags & (UP_REG_CHANGE|UP_CSIP_CHANGE) ) { InitLC( &Context, TRUE ); } if( flags & UP_NEW_PROGRAM ) { SetStackPos( &Context, 0 ); } if( flags & (UP_SYM_CHANGE+UP_STACKPOS_CHANGE+UP_REG_CHANGE+UP_CSIP_CHANGE+UP_CSIP_JUMPED) ) { SymCompFini(); prev_mod = ContextMod; if( DeAliasAddrMod( Context.execution, &ContextMod ) == SR_NONE ) ContextMod = NO_MOD; if( prev_mod != ContextMod ) { HookNotify( FALSE, HOOK_NEW_MODULE ); } } if( flags & (UP_CODE_ADDR_CHANGE | UP_SYM_CHANGE ) ) { prev_mod = CodeAddrMod; if( DeAliasAddrMod( GetCodeDot(), &CodeAddrMod ) == SR_NONE ) { CodeAddrMod = NO_MOD; } if( prev_mod != CodeAddrMod ) { for( inp = InpStack; inp != NULL; inp = inp->link ) { inp->type |= INP_NEW_LANG; } } } DUIUpdate( flags ); }
brkp *FindBreakByLine( mod_handle mod, cue_fileid id, unsigned line ) { brkp *bp; mod_handle brk_mod; DIPHDL( cue, ch ); for( bp = BrkList; bp != NULL; bp = bp->next ) { if( DeAliasAddrMod( bp->loc.addr, &brk_mod ) == SR_NONE )continue; if( brk_mod != mod )continue; if( DeAliasAddrCue( brk_mod, bp->loc.addr, ch ) == SR_NONE ) continue; if( CueFileId( ch ) != id ) continue; if( CueLine( ch ) != line ) continue; return( bp ); } return( NULL ); }
char *LineAddr( address *addr, char *buff, size_t buff_len ) { mod_handle mod; char *end; DIPHDL( cue, line ); AddrFloat( addr ); if( DeAliasAddrMod( *addr, &mod ) == SR_NONE ) return( NULL ); if( DeAliasAddrCue( mod, *addr, line ) == SR_NONE ) return( NULL ); end = buff + buff_len; buff += DIPModName( mod, buff, buff_len - 1 ); *buff++ = '@'; buff = CnvULongDec( DIPCueLine( line ), buff, end - buff ); *buff = NULLCHAR; return( buff ); }
static void UnMapOnePoint( brkp *bp, image_entry *image ) { mod_handle himage; if( bp->status.b.unmapped ) return; if( image != NULL ) { if( DeAliasAddrMod( bp->loc.addr, &himage ) == SR_NONE ) return; if( image != ImageEntry( himage ) ) { return; } } if( bp->image_name == NULL || bp->mod_name == NULL ) { bp->status.b.unmapped = UnMapAddress( &bp->loc, image ); } else { bp->status.b.unmapped = true; } }
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 ); } } }
bool UnMapAddress( mappable_addr *loc, image_entry *image ) { map_entry *map; mod_handle himage; if( image == NULL ) { if( DeAliasAddrMod( loc->addr, &himage ) == SR_NONE ) return( false ); image = ImageEntry( himage ); } if( image == NULL ) return( false ); DbgFree( loc->image_name ); loc->image_name = DupStr( image->image_name ); for( map = image->map_list; map != NULL; map = map->link ) { if( map->real_addr.segment == loc->addr.mach.segment ) { loc->addr.mach.segment = map->map_addr.segment; loc->addr.mach.offset = loc->addr.mach.offset - map->real_addr.offset; return( true ); } } return( false ); }
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; } } }