当前位置: 首页>>代码示例>>C++>>正文


C++ Symbol::SymbolName方法代码示例

本文整理汇总了C++中Symbol::SymbolName方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbol::SymbolName方法的具体用法?C++ Symbol::SymbolName怎么用?C++ Symbol::SymbolName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symbol的用法示例。


在下文中一共展示了Symbol::SymbolName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitElfContents

/**
This function initializes the Elf members
@internalComponent
@released
*/
void ElfProducer::InitElfContents() {

	iElfHeader		= new Elf32_Ehdr;
	iSections		= new Elf32_Shdr[MAX_SECTIONS+1];

	iElfDynSym		= new Elf32_Sym[iNSymbols];
	iVersionTbl		= new Elf32_Half[iNSymbols];
	iVersionDef		= new Elf32_Verdef[2];
	iDSODaux		= new Elf32_Verdaux[2];

	iProgHeader		 = new Elf32_Phdr[2];
	iCodeSectionData = new PLUINT32[iNSymbols];	

	iHashTbl = new Elf32_HashTable;
	
	//premeditated
	iHashTbl->nBuckets = (iNSymbols /3) + (iNSymbols % 0x3);
	
	iHashTbl->nChains = iNSymbols;

	iDSOBuckets = new Elf32_Sword[iHashTbl->nBuckets];
	iDSOChains = new Elf32_Sword[iHashTbl->nChains];

	Elf32_Sword	aNullPtr = 0;

	memset(iDSOBuckets, aNullPtr, sizeof(Elf32_Sword)*iHashTbl->nBuckets);
	memset(iDSOChains,  aNullPtr, sizeof(Elf32_Sword)*iHashTbl->nChains);
	memset(iCodeSectionData,  0, sizeof(PLUINT32)*iNSymbols);

	CreateElfHeader();

	SymbolList::iterator aItr = iSymbolsList->begin();
	SymbolList::iterator aEnd = iSymbolsList->end();
	Symbol		*aSym;
	PLUINT32	aIdx = 1;

	memset( &iElfDynSym[0], 0, sizeof(Elf32_Sym));
	iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(), 0);

	while(aItr != aEnd) {
		String		aSymName("");
		aSym = *aItr;
		aSymName = aSym->SymbolName();
		//set symbol info..
		iElfDynSym[aIdx].st_name = iDSOSymNameStrTbl.size();

		iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(), aSymName.begin(), aSymName.end() );
		iDSOSymNameStrTbl.insert(iDSOSymNameStrTbl.end(), 0);

		SetSymolFields( aSym, &iElfDynSym[aIdx], aIdx);

		//set version table info...
		iVersionTbl[aIdx] = DEFAULT_VERSION;
		AddToHashTable(aSym->SymbolName(), aIdx);
		aItr++;aIdx++;
	}

	CreateVersionTable();
	
	//Fill section headers...
	CreateSections();

	//Copy dyn entries..
	CreateDynamicEntries();

	//create code section data - this has the ordinal numbers...
	CreateProgHeader();
}
开发者ID:fedor4ever,项目名称:linux_build,代码行数:73,代码来源:pl_elfproducer.cpp

示例2: GenerateAsmFile

/**
Function to generate ASM File.
@param afileName - ASM File name
@return 0 on success, otherwise throw error
@internalComponent
@released
*/
int FileDump::GenerateAsmFile(const char* afileName)//DumpAsm
{
    DefFile *iDefFile = new DefFile();
    SymbolList *aSymList;
    aSymList = iDefFile->ReadDefFile(iParameterListInterface->DefInput());

    FILE *fptr;

    if((fptr=fopen(afileName,"w"))==NULL)
    {
        throw FileError(FILEOPENERROR,(char*)afileName);
    }
    else
    {
        SymbolList::iterator aItr = aSymList->begin();
        SymbolList::iterator last = aSymList->end();
        Symbol *aSym;

        while( aItr != last)
        {
            aSym = *aItr;

            if(aSym->Absent())
            {
                aItr++;
                continue;
            }

            fputs("\tIMPORT ",fptr);
            fputs(aSym->SymbolName(),fptr);
            //Set the visibility of the symbols as default."DYNAMIC" option is
            //added to remove STV_HIDDEN visibility warnings generated by every
            //export during kernel build
            fputs(" [DYNAMIC]", fptr);
            fputs("\n",fptr);
            aItr++;
        }

        // Create a directive section that instructs the linker to make all listed
        // symbols visible.

        fputs("\n AREA |.directive|, READONLY, NOALLOC\n\n",fptr);

        fputs("\tDCB \"#<SYMEDIT>#\\n\"\n", fptr);

        aItr = aSymList->begin();
        while (aItr != last)
        {
            aSym = *aItr;

            if ( aSym->Absent() )
            {
                aItr++;
                continue;
            }

            // Example:
            //  DCB "EXPORT __ARM_ll_mlass\n"
            fputs("\tDCB \"EXPORT ",fptr);
            fputs(aSym->SymbolName(),fptr);
            fputs("\\n\"\n", fptr);

            aItr++;
        }

        fputs("\n END\n",fptr);
        fclose(fptr);
    }
    return 0;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:77,代码来源:filedump.cpp


注:本文中的Symbol::SymbolName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。