Пример #1
0
mod_handle WPDipLoadInfo( dig_fhandle fid, const char *f_name, void *image,
                   unsigned image_size, unsigned dip_start, unsigned dip_end )
/****************************************************************************/
{
    unsigned    prio;
    mod_handle  dip_module;

    dip_module = NO_MOD;
    prio = dip_start;
    for( ;; ) {
        prio = DIPPriority( prio );
        if( prio == 0 || prio > dip_end )
            break;
        DIPStatus = DS_OK;
        dip_module = DIPLoadInfo( fid, image_size, prio );
        if( dip_module != NO_MOD ) {
            *(void **)DIPImageExtra( dip_module ) = image;
            DIPMapInfo( dip_module, image );
            break;
        }
        if( DIPStatus & DS_ERR ) {
            ErrorMsg( LIT( Dip_Info_Failed ), f_name, errMsgText( DIPStatus ) );
        }
    }
    return( dip_module );
}
Пример #2
0
bool ReLoadImgSymInfo( image_entry *image )
{
    if( ProcImgSymInfo( image ) ) {
        DIPMapInfo( image->dip_handle, image );
        DbgUpdate( UP_SYMBOLS_ADDED );
        return( true );
    }
    return( false );
}
Пример #3
0
bool ReLoadSymInfo( image_entry *image )
{
    if( ProcSymInfo( image ) ) {
        DIPMapInfo( image->dip_handle, image );
        DbgUpdate( UP_SYMBOLS_ADDED );
        return( TRUE );
    }
    return( FALSE );
}
Пример #4
0
/**
 * Dumps the debug information in a file.
 *
 * @returns 0 on success, exit code on failure.
 * @param   file    The filename.
 * @param   dips    The dips to load and use.
 */
static int DumpFile( const char *file, char **dips )
{
    int             rc = 1;
    dig_fhandle     fh;

    /*
     * Open the file
     */
    fh = DIGCliOpen( file, DIG_READ );
    if( fh == DIG_NIL_HANDLE ) {
        return( ErrorMsg( "Failed to open '%s'\n", file ) );
    }

    /*
     * Init DIP, create a process and load the file into the process.
     */
    if( InitDIP( dips ) ) {
        process_info    *proc = DIPCreateProcess();

        if( proc != NULL ) {
            int         prty;
            mod_handle  mh = 0;

            for( prty = DIPPriority( 0 ); prty != 0; prty = DIPPriority( prty ) ) {
                DIGCliSeek( fh, 0, DIG_ORG );
                mh = DIPLoadInfo( fh, 0, prty );
                if( mh != NO_MOD ) {
                    break;
                }
            }
            if( mh != NO_MOD ) {
                DIPMapInfo( mh, NULL );
                InfoMsg( "DIP opened '%s' at prty=%d, mh=%lx\n", file, prty, (long)mh );

                /*
                 * Enumerate the debug info.
                 */
                rc = DumpIt( file, mh, proc );

                /*
                 * Cleanup.
                 */
                DIPUnloadInfo( mh );
            } else {
                ErrorMsg( "DIP failed to open '%s'.\n", file);
            }
            DIPDestroyProcess( proc );
        }
        TermDIP();
    }
    DIGCliClose( fh );
    return( rc );
}
Пример #5
0
/*
 * LoadDbgInfo
 */
BOOL LoadDbgInfo( void ) {

    BOOL                err;
    unsigned            priority;

    DEBUGOUT( "Enter LoadDbgInfo" );
    err = TRUE;
    curProcess = DIPCreateProcess();
    curFileHdl = DIGCliOpen( DTModuleEntry.szExePath , DIG_READ );
    if( curFileHdl != -1 ) {
        DEBUGOUT( "File open OK" );
        priority = 0;
        for( ;; ) {
            priority = DIPPriority( priority );
            if( priority == 0 ) break;
            curModHdl = DIPLoadInfo( curFileHdl, 0, priority );
            if( curModHdl != NO_MOD ) break;
        }
        if( curModHdl != NO_MOD ) {
                DEBUGOUT( "debug info load OK" );
                DIPMapInfo( curModHdl, NULL );
                err = FALSE;
        } else {
            DEBUGOUT( "curModHdl == NO_MOD" );
        }
    }
    if( err ) {
        DEBUGOUT( "LoadDbgInfo Failed" );
        if( (int)curFileHdl != -1 ) {
            DIGCliClose( curFileHdl );
        }
        DIPDestroyProcess( curProcess );
        curProcess = NULL;
        curModHdl = NO_MOD;
        curFileHdl = -1;
        return( FALSE );
    }
    return( TRUE );
}