void MergeRelocate::addReloc( MergeOffset & off, MergeDIE * replacer ) //-------------------------------------------------------------------- { // _replacedDies[ off.fileIdx ]->insert( off.offset, replacer ); #if ( INSTRUMENTS == INSTRUMENTS_FULL_LOGGING ) MergeDIE * replaced = getReloc( off ); Log.printf( " reloc from %s %s to ", // ((const MergeNameKey&)(*replaced)).getString(), // ((const MergeOffset&)(*replaced)).getString() ); ( replaced != NULL ) ? replaced->name().getString() : "NULL", ( replaced != NULL ) ? replaced->offset().getString() : "NULL" ); // Log.printf( "%s %s\n", ((const MergeNameKey&)(*replacer)).getString(), // ((const MergeOffset&)(*replacer)).getString() ); Log.printf( "%s %s\n", ( replacer != NULL ) ? replacer->name().getString() : "NULL", ( replacer != NULL ) ? replacer->offset().getString() : "NULL" ); #endif _replacedDies[ off.fileIdx ]->insert( off.offset, replacer ); }
void MergeInfoSection::readDIE( MergeFile * file, MergeOffset startOff, MergeDIE * prt, MergeOffset& moff, uint_32 abbCode ) //------------------------------------------------------------------- // read a die and all its children, adding to _dies. return false when // the abbrev code is zero (recursive) { MergeDIE * die; // one we read MergeAbbrev * abbrev; MergeOffset child; // offset of first child MergeOffset sibling; bool ext = TRUE; // external or static? bool defn = TRUE; // is a definition? const char * name = NULL; int i; DIELen_T length; int lenDelta = 0; // delta from changing file idx if( abbCode == 0 ) { length = (DIELen_T) (moff.offset - startOff.offset); MergeNameKey nmKey( abbCode, ext, NULL, 0 ); die = new MergeDIE( prt, startOff, nmKey, child, sibling, defn, length ); die = die->collision( _diesByName ); #if INSTRUMENTS if( abbrev == NULL ) { Log.printf( "zoiks! %s\n", startOff.getString() ); } #endif return; //<------------------- early return } abbrev = _abbrevs.getAbbrev( abbCode ); #if INSTRUMENTS if( abbrev == NULL ) { Log.printf( "ABBREV == NULL! offset is %s, %s\n", startOff.getString(), moff.getString() ); } #endif InfoAssert( abbrev != NULL ); // NYI throw for( i = 0; i < abbrev->entries(); i += 1 ) { MergeAttrib & att( (*abbrev)[ i ] ); switch( att.attrib() ) { case DW_AT_name: name = file->readString( DR_DEBUG_INFO, moff.offset ); if( abbrev->tag() == DW_TAG_compile_unit ) { name = MagicCompunitName; } break; case DW_AT_sibling: sibling.fileIdx = moff.fileIdx; sibling.offset = file->readDWord( DR_DEBUG_INFO, moff.offset ); break; case DW_AT_external: ext = file->readByte( DR_DEBUG_INFO, moff.offset ); break; case DW_AT_declaration: defn = !file->readByte( DR_DEBUG_INFO, moff.offset ); break; case DW_AT_decl_file: lenDelta = getFileLenDelta( file, moff, att.form() ); break; default: file->skipForm( DR_DEBUG_INFO, moff.offset, att.form(), getAddrSize() ); } } if( abbrev->hasChildren() ) { child = moff; } length = (DIELen_T)(moff.offset - startOff.offset + lenDelta); MergeNameKey nmKey( abbrev->tag(), ext, name, 0 ); die = new MergeDIE( prt, startOff, nmKey, child, sibling, defn, length ); die = die->collision( _diesByName ); getReloc().addReloc( startOff, die ); if( abbrev->hasChildren() ) { while( 1 ) { startOff = moff; abbCode = file->readULEB128( DR_DEBUG_INFO, moff.offset ); if( abbCode == 0 ) break; readDIE( file, startOff, die, moff, abbCode ); } } if( !die->siblingSet() ) { die->setSibling( moff ); } }