Example #1
0
OVL_EXTERN walk_result sem_FindCue( cue_handle *cueh, void *d )
{
    cue_find    *cd = d;
    char        file[FILENAME_MAX];
    unsigned    len;
    unsigned    match;


    len = DIPCueFile( cueh, file, sizeof( file ) );
    if( len < cd->len )
        return( WR_CONTINUE );
    if( memcmp( &file[len - cd->len], cd->name, cd->len ) == 0 ) {
        match = CMP_SENSITIVE;
    } else if( memicmp( &file[len - cd->len], cd->name, cd->len ) == 0 ) {
        match = CMP_INSENSITIVE;
    } else {
        return( WR_CONTINUE );
    }
    if( match > cd->match ) {
        cd->match = match;
        cd->id = DIPCueFileId( cueh );
        cd->ambig = false;
    } else if( match == cd->match ) {
        cd->ambig = true;
    }
    return( WR_CONTINUE );
}
Example #2
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 );
}
Example #3
0
STATIC file_info  *loadFileInfo( mod_info *curr_mod, sym_handle *sym )
/********************************************************************/
{
    file_info       *sym_file;
    cue_handle      *ch;
    cue_fileid      fid;
    int             file_count;
    int             count;
    location_list   ll;

    if( DIPSymLocation( sym, NULL, &ll ) != DS_OK ) {
        return( curr_mod->mod_file[0] );
    }
    ch = alloca( DIPHandleSize( HK_CUE, false ) );
    switch( DIPAddrCue( curr_mod->mh, ll.e[0].u.addr, ch ) ) {
    case SR_NONE:
    case SR_FAIL:
        return( curr_mod->mod_file[0] );
    }
    fid = DIPCueFileId( ch );
    file_count = curr_mod->file_count;
    for( count = 0; count < file_count; ++count ) {
        sym_file = curr_mod->mod_file[count];
        if( sym_file->fid == fid ) {
            return( sym_file );
        }
    }
    curr_mod->file_count++;
    curr_mod->mod_file = ProfRealloc( curr_mod->mod_file, curr_mod->file_count * sizeof( pointer ) );
    count = DIPCueFile( ch, NULL, 0 ) + 1;
    sym_file = ProfCAlloc( sizeof( file_info ) + count );
    sym_file->fid = fid;
    DIPCueFile( ch, sym_file->name, count );
    initRoutineInfo( sym_file );
    curr_mod->mod_file[file_count] = sym_file;
    return( sym_file );
}
Example #4
0
void *OpenSrcFile( cue_handle *ch )
{
    void        *hndl;
    char_ring   *path;
    const char  *p;
    char        *d;
    const char  *rem_name;
    bool        used_star;
    unsigned    len;
    char        *buff;

    len = DIPCueFile( ch, NULL, 0 ) + 1;
    _AllocA( buff, len );
    DIPCueFile( ch, buff, len );
    hndl = FOpenSource( buff, DIPCueMod( ch ), DIPCueFileId( ch ) );
    if( hndl != NULL )
        return( hndl );
    for( path = SrcSpec; path != NULL; path = path->next ) {
        used_star = false;
        d = TxtBuff;
        for( p = path->name; *p != NULLCHAR; ++p ) {
            if( *p == '*' ) {
                used_star = true;
                d += DIPModName( DIPCueMod( ch ), d, TXT_LEN );
            } else {
                *d++ = *p;
            }
        }
        *d = NULLCHAR;
        if( !used_star ) {
#if 0
                /*
                    John can't remember why he put this code in, and it
                    screws up when the user sets a source path of ".".
                    If we find some case where it's required, we'll have to
                    think harder about things.
                */
            if( *ExtPointer( TxtBuff, 0 ) != NULLCHAR ) {
                *SkipPathInfo( TxtBuff, 0 ) = NULLCHAR;
            }
#endif
            d = AppendPathDelim( TxtBuff, 0 );
            if( !IsAbsolutePath( buff ) ) {
                StrCopy( buff, d );
                hndl = FOpenSource( TxtBuff, DIPCueMod( ch ), DIPCueFileId( ch ) );
                if( hndl != NULL ) {
                    return( hndl );
                }
            }
            /*
                We have a small problem here. We want to strip off the
                path information for the source file name, but we don't
                know if the file was compiled on the local system or the
                remote one. We'll kludge things by doing a local skip
                and then a remote one and seeing who takes off the most stuff.
                Don't even think about the case where the file has been
                compiled on a third, different type of file system.
            */
            p = SkipPathInfo( buff, OP_LOCAL );
            rem_name = SkipPathInfo( buff, OP_REMOTE );
            if( rem_name > p )
                p = rem_name;
            d = StrCopy( p, d );
            *d = NULLCHAR;
        }
        hndl = FOpenSource( TxtBuff, DIPCueMod( ch ), DIPCueFileId( ch ) );
        if( hndl != NULL ) {
            return( hndl );
        }
    }
    return( NULL );
}