Exemplo n.º 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 );
}
Exemplo n.º 2
0
/*
 * GetLineNum
 */
bool GetLineNum( address *addr, char *fname, DWORD bufsize, DWORD *line )
{
    cue_handle  *cueh;

    cueh = walloca( DIPHandleSize( HK_CUE ) );
    if( DIPAddrCue( NO_MOD, *addr, cueh ) == SR_NONE ) {
        return( false );
    }
    DIPCueFile( cueh, fname, bufsize );
    *line = DIPCueLine( cueh );
    return( true );
}
Exemplo n.º 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 );
}
Exemplo n.º 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 );
}