Exemplo n.º 1
0
Module::Module( const char *name, WCValSList<String> & enabled,
                WCValSList<String> & disabled )
//------------------------------------------------------------
{
    WCPtrOrderedVector<ComponentFile> components;
    FileInfo                          finf( name );
    int                               i;
    MsgRetType                        ret;

    _dataFile = new ElfFile( name, false );

    DwarfFileMerger merger( name, enabled, disabled );

    if( !merger.upToDate() ) {
        if( !finf.exists() ) {
            merger.doMerge();
        } else {
            if( enabled.entries() != 0 ) {
                ret = WMessageDialog::messagef( topWindow,
                        MsgQuestion, MsgYesNo, "Source Browser",
                        "Database %s is not consistent with module files.\n"
                        "Merge the database now?", name );

                if( ret == MsgRetYes ) {
                    merger.doMerge();
                }
            }
        }
    }

    _dataFile->initSections();

    _dataFile->getEnabledComponents( &components );
    for( i = 0; i < components.entries(); i += 1 ) {
        _enabledFiles.add( new WFileName( components[i]->name ) );
    }

    components.clear();
    _dataFile->getDisabledComponents( &components );
    for( i = 0; i < components.entries(); i += 1 ) {
        _disabledFiles.add( new WFileName( components[i]->name ) );
    }

    checkSourceTime();

    _dbgInfo = DRDbgInit( this, _dataFile->getDRSizes(), false );
    DRSetDebug( _dbgInfo );
}
Exemplo n.º 2
0
void MergeRefSection::mergeRefs( WCPtrOrderedVector<MergeFile>& files )
//---------------------------------------------------------------------
{
    uint_8      i;
    uint_32 *   drSizes;
    uint_32     totLen = 0;
    uint_32     offset;
    RefLineCol  lnCol;

    _outFile->startWriteSect( DR_DEBUG_REF );

    _outFile->writeDWord( 1 );      // reserve a dword for length

    for( i = 0; i < files.entries(); i += 1 ) {
        drSizes = files[ i ]->getDRSizes();

        #if INSTRUMENTS
        Log.printf( "    File %s - %ld bytes\n", files[i]->getFileName(), drSizes[ DR_DEBUG_REF ] );
        totLen += drSizes[ DR_DEBUG_REF ];
        #endif

        scanFile( files[ i ], i, lnCol );
    }

    offset = _outFile->tell( DR_DEBUG_REF );
    _outFile->seek( DR_DEBUG_REF, 0 );
    _outFile->writeDWord( offset - sizeof(uint_32) );

    #if INSTRUMENTS
        Log.printf( "    %d files, %ld bytes\n", i, totLen );
    #endif

    _outFile->endWriteSect();
}
Exemplo n.º 3
0
void MergeInfoSection::writePass( MergeFile * outFile,
                                  WCPtrOrderedVector<MergeFile> & inFiles )
//-------------------------------------------------------------------------
{
    uint_32     len;
    uint_32     size;
    char *      block;
    const int   BufSize = 512;

    MergeStringHdl::ragnarok();
    _diesByName->freeDirectory();

    MergeInfoPP postProcess( inFiles.entries() );

    relocPass( postProcess );

    block = new char [ BufSize ];
    memset( block, 0, BufSize );
    len = _compunitHdr->_infoLength + sizeof(uint_32);
    while( len ) {
        size = (BufSize < len) ? BufSize : len;
        outFile->writeBlock( block, size );
        len -= size;
    }
    delete [] block;

    outFile->seekSect( DR_DEBUG_INFO, 0 );
    outFile->writeBlock( _compunitHdr, sizeof(MergeCompunitHdr) );
    postProcess.execute( this, *outFile, inFiles );
}
Exemplo n.º 4
0
void MergeLineSection::mergeLine( WCPtrOrderedVector<MergeFile>& files )
//----------------------------------------------------------------------
{
    uint_8      i;
    uint_32 *   drSizes;
    uint_32     totLen = 0;

    for( i = 0; i < files.entries(); i += 1 ){
        drSizes = files[ i ]->getDRSizes();
        scanFile( files[ i ], i, drSizes[ DR_DEBUG_LINE ] );

        #if INSTRUMENTS
        Log.printf( "    File %s - %ld bytes\n", files[i]->getFileName(), drSizes[ DR_DEBUG_LINE ] );
        totLen += drSizes[ DR_DEBUG_LINE ];
        #endif
    }

    #if INSTRUMENTS
        Log.printf( "    %d files, %ld bytes\n", i, totLen );
    #endif

    _outFile->startWriteSect( DR_DEBUG_LINE );
    writePrologue();
    _outFile->endWriteSect();
}
Exemplo n.º 5
0
void DTViewClass::addDescriptions()
//---------------------------------
// add the non-symbol lines
{
    int             i;
    ClassMember *   mem;
    dr_access       prevAccess = (dr_access) 0;
    dr_handle       prevParent = _symbol->getHandle();
    char *          tmpName;
    WCPtrOrderedVector<ClassMember> desc;

    for( i = 0; i < _members->entries(); i += 1 ) {
        mem  = (*_members)[ i ];
        if( mem->_parent != prevParent ) {
            prevAccess = (dr_access) 0;
            prevParent = mem->_parent;
            if( mem->_parent ) {
                tmpName = DRGetName( mem->_parent );
            } else {
                tmpName = NULL;
            }
            desc.append( new ClassMember( mem->_parent, (dr_access) 0,
                                tmpName ) );
            WBRFree( tmpName );
        }
        if( mem->_access != prevAccess ) {
            prevAccess = mem->_access;
            desc.append( new ClassMember( mem->_parent, mem->_access,
                                AccessStr[ mem->_access ] ) );
        }
    }

    for( i = 0; i < desc.entries(); i += 1 ) {
        _members->insert( desc[ i ] );
    }

    desc.clear();       // don't own elements, so don't destroy
}