示例#1
0
static search_result FindACue( cue_handle *cueh )
{
    cue_find    data;

    data.found_a_file = false;
    data.best_line = 0;
    data.best_cueh = cueh;
    data.name = CurrGet.li.source.start;
    data.len = CurrGet.li.source.len;

    if( CurrGet.multi_module ) {
        if( data.len == 0 ) {
            Error( ERR_NONE, LIT_ENG( ERR_WANT_MODULE ) );
        }
        if( DIPWalkModList( CurrGet.li.mod, FindModCue, &data ) == WR_FAIL ) {
            return( SR_FAIL );
        }
    } else {
        if( CurrGet.li.mod == NO_MOD )
            CurrGet.li.mod = CodeAddrMod;
        if( FindModCue( CurrGet.li.mod, &data ) == WR_FAIL ) {
            return( SR_FAIL );
        }
    }
    if( !data.found_a_file ) {
        Error( ERR_NONE, LIT_ENG( ERR_NO_SRC_FILE ), data.name, data.len );
    }
    if( data.best_line == 0 )
        return( SR_NONE );
    if( data.best_line == CurrGet.li.name.len )
        return( SR_EXACT );
    return( SR_CLOSEST );
}
示例#2
0
static void BasicType( unsigned basic_type )
{
    internal_mod        mod_srch;
    imp_type_handle     *ith;
    dig_type_info       ti;
    DIPHDL( type, th );

    DIPWalkModList( NO_MOD, FindInternalMod, &mod_srch );
    DIPTypeInit( th, mod_srch.mh );
    ti.kind = TI_KIND_EXTRACT( basic_type );
    ti.size = TI_SIZE_EXTRACT( basic_type );
    ti.modifier = TI_MOD_EXTRACT( basic_type );
    ti.deref = false;
    FillInDefaults( &ti );
    ith = TH2ITH( th );
    ith->ti = ti;
    ith->ri = NULL;
    PushType( th );
}
示例#3
0
STATIC void loadImageInfo( image_info * curr_image )
/**************************************************/
{
    int             name_len;
    dig_fhandle     obj_dfh;
    dig_fhandle     sym_dfh;
    struct stat     file_status;

    sym_dfh = DIG_NIL_HANDLE;
    obj_dfh = DIG_NIL_HANDLE;
    curr_image->dip_handle = NO_MOD;
    if( curr_image->sym_deleted ) {
    } else if( curr_image->sym_name != NULL ) {
        sym_dfh = DIGCli( Open )( curr_image->sym_name, DIG_READ );
        if( sym_dfh != DIG_NIL_HANDLE ) {
            curr_image->dip_handle = WPDipLoadInfo( sym_dfh, curr_image->sym_name, curr_image,
                                       sizeof( image_info ), DIP_PRIOR_MIN, DIP_PRIOR_MAX );
        }
    } else {
        name_len = strlen( curr_image->name ) + 1;
        memcpy( FNameBuff, curr_image->name, name_len );
        ReplaceExt( FNameBuff, ".sym" );
        name_len = strlen( FNameBuff ) + 1;
        curr_image->sym_name = ProfAlloc( name_len );
        memcpy( curr_image->sym_name, FNameBuff, name_len );
        sym_dfh = DIGCli( Open )( curr_image->sym_name, DIG_READ );
        if( sym_dfh != DIG_NIL_HANDLE ) {
            curr_image->dip_handle = WPDipLoadInfo( sym_dfh, curr_image->sym_name, curr_image,
                                      sizeof( image_info ), DIP_PRIOR_MIN, DIP_PRIOR_MAX );
        }
        if( curr_image->dip_handle == NO_MOD ) {
            ProfFree( curr_image->sym_name );
            curr_image->sym_name = NULL;
        }
    }
    obj_dfh = DIGCli( Open )( curr_image->name, DIG_READ );
    if( obj_dfh == DIG_NIL_HANDLE ) {
        curr_image->exe_not_found = true;
        if( curr_image->main_load ) {
            ErrorMsg( LIT( Exe_Not_Found ), curr_image->name );
        }
    } else if( curr_image->time_stamp == 0 ) {
        /*
           If sample timestamp is 0, the sampler couldn't figure out
           the right value. Assume it's OK.
        */
    } else {
        if( fstat( DFH2PH( obj_dfh ), &file_status ) == 0 ) {
            /* QNX creation dates and time stamps tend to be 1 */
            /* unit different, so do not test for equality */
            if( file_status.st_mtime - curr_image->time_stamp > 1 ) {
                curr_image->exe_changed = true;
                if( curr_image->main_load ) {
                    ErrorMsg( LIT( Exe_Has_Changed ), curr_image->name );
                }
            }
        }
    }
    if( curr_image->dip_handle == NO_MOD && !curr_image->sym_deleted && obj_dfh != DIG_NIL_HANDLE ) {
        curr_image->dip_handle = WPDipLoadInfo( obj_dfh, curr_image->name, curr_image,
                                   sizeof( image_info ), DIP_PRIOR_MIN, DIP_PRIOR_MAX );
    }
    if( curr_image->dip_handle == NO_MOD ) {
        if( sym_dfh != DIG_NIL_HANDLE ) {
            DIGCli( Close )( sym_dfh );
        }
        if( obj_dfh != DIG_NIL_HANDLE ) {
            DIGCli( Close )( obj_dfh );
        }
    }
    initModuleInfo( curr_image );
    if( curr_image->dip_handle != NO_MOD ) {
        DIPWalkModList( curr_image->dip_handle, &loadModuleInfo, curr_image );
    }
}