コード例 #1
0
ファイル: wpsamp.c プロジェクト: Azarien/open-watcom-v2
STATIC void findRtnFromRow( sio_data *curr_sio, int row )
/*******************************************************/
{
    file_info           *curr_file;
    rtn_info            *curr_rtn;
    cue_handle          *ch;
    sym_handle          *sh;
    int                 index;
    mod_handle          mh;
    address             addr;

    index = 0;
    ch = alloca( DIPHandleSize( HK_CUE, false ) );
    curr_file = curr_sio->curr_file;
    mh = curr_sio->curr_mod->mh;
    if( DIPLineCue( mh, curr_sio->curr_file->fid, row, 0, ch ) == SR_NONE ) {
        if( DIPLineCue( mh, curr_sio->curr_file->fid, 0, 0, ch ) == SR_NONE ) {
            return;
        }
    }
    sh = alloca( DIPHandleSize( HK_SYM, false ) );
    addr = DIPCueAddr( ch );
    if( DIPAddrSym( mh, addr, sh ) == SR_NONE )
        return;
    while( index < curr_file->rtn_count ) {
        curr_rtn = curr_file->routine[index];
        if( curr_rtn->sh != NULL && DIPSymCmp( curr_rtn->sh, sh ) == 0 ) {
            curr_sio->curr_rtn = curr_rtn;
            break;
        }
        index++;
    }
}
コード例 #2
0
OVL_EXTERN walk_result FindModCue( mod_handle mod, void *d )
{
    DIPHDL( cue, cueh );
    cue_find            *fd = d;
    unsigned long       curr_line;

    fd->id = 0;
    fd->ambig = false;
    fd->match = CMP_NONE;
    if( mod != NO_MOD && fd->len != 0 ) {
        DIPWalkFileList( mod, sem_FindCue, fd );
        if( fd->id == 0 )
            return( WR_CONTINUE );
        if( fd->ambig ) {
            Error( ERR_NONE, LIT_ENG( ERR_AMBIG_SRC_FILE ), fd->name, fd->len );
        }
    }
    fd->found_a_file = true;
    switch( DIPLineCue( mod, fd->id, CurrGet.li.name.len, 0, cueh ) ) {
    case SR_EXACT:
        HDLAssign( cue, fd->best_cueh, cueh );
        fd->best_line = CurrGet.li.name.len;
        return( WR_STOP );
    case SR_CLOSEST:
        curr_line = DIPCueLine( cueh );
        if( curr_line < CurrGet.li.name.len && curr_line > fd->best_line ) {
            HDLAssign( cue, fd->best_cueh, cueh );
            fd->best_line = CurrGet.li.name.len;
        }
        break;
    case SR_FAIL:
        return( WR_FAIL );
    }
    return( WR_CONTINUE );
}
コード例 #3
0
static remap_return ReMapOnePoint( brkp *bp, image_entry *image )
{
    mod_handle  himage, mod;
    bool        ok;
    address     addr;
    DIPHDL( cue, cueh );
    DIPHDL( cue, cueh2 );
    remap_return        rc = REMAP_REMAPPED;

    if( !bp->status.b.unmapped )
        return( REMAP_WRONG_IMAGE );
    if( bp->image_name == NULL || bp->mod_name == NULL ) {
        if( image == NULL ) {
            if( ReMapAddress( &bp->loc ) ) {
                rc = REMAP_REMAPPED;
            } else {
                rc = REMAP_ERROR;
            }
        } else {
            rc = ReMapImageAddress( &bp->loc, image );
        }
    } else {
        himage = LookupImageName( bp->image_name, strlen( bp->image_name ) );
        if( himage == NO_MOD )
            return( REMAP_ERROR );
        mod =  LookupModName( himage, bp->mod_name, strlen( bp->mod_name ) );
        if( mod == NO_MOD )
            return( REMAP_ERROR );
        ok = GetBPSymAddr( bp, &addr );
        if( !ok )
            return( REMAP_ERROR );
        if( bp->cue_diff != 0 ) {
            if( DeAliasAddrCue( mod, addr, cueh ) != SR_EXACT )
                return( REMAP_ERROR );
            if( DIPLineCue( mod, DIPCueFileId( cueh ), DIPCueLine( cueh ) + bp->cue_diff, 0, cueh2 ) != SR_EXACT )
                return( REMAP_ERROR );
            addr = DIPCueAddr( cueh2 );
        }
        if( bp->addr_diff != 0 ) {
            addr.mach.offset += bp->addr_diff;
        }
        bp->loc.addr = addr;
        rc = REMAP_REMAPPED;
    }
    if( rc == REMAP_REMAPPED ) {
        bp->status.b.unmapped = false;
    }
    SetPointAddr( bp, bp->loc.addr );
    if( bp->status.b.activate_on_remap ) {
        ActPoint( bp, true );
    }
    return( rc );
}