XCP_Master/source/parser/dwarfparser.cpp
/**
 * @brief   reverse lookup, starting from struct name, set setStructElementsMapKey
 */
@brief   reverse lookup, starting from struct name, set setStructElementsMapKey
@brief reverse lookup starting from struct name set setStructElementsMapKey
void DwarfParser::lookupStructElementsInDwarfTree(DwarfTreeObj &dwarf, uint64_t dwarfKey,  int depth) {
    if(isStructDepthLevelZero(dwarf) || depth > 0) {
        string parentDataType = dwarf.getDataType().first;
        string srcFileParent = dwarf.getSourcePath();
        if(parentDataType.size() > 0) {
            map<uint64_t, shared_ptr<DwarfTreeObj>>::reverse_iterator itRevDwarfTreeElement(dwarfTree.find(dwarfKey));
            vector<uint64_t> dwarfStructKeys;
            for (auto &it = itRevDwarfTreeElement; it != dwarfTree.rend(); ++it) {
                shared_ptr<DwarfTreeObj> dwarfChild = it->second;
                if((isChildOfParentStruct(parentDataType, dwarfChild->getStructName())) && isStructChildValid(*dwarfChild)) {
                    uint64_t key = it->first;
                    dwarfStructKeys.push_back(key);
                    if(dwarfChild->getAbsType() == AbstractType::Struct) {
                        if(depth <= STRUCT_MEMBER_SEARCH_DEPTH_MAX) {
                            lookupStructElementsInDwarfTree(*dwarfChild, key, ++depth);
                        }
                    }
                }
                if(isOutOfScope(srcFileParent, dwarfChild->getSourcePath())) {
                    break;
                }
            }
            addStructElementsToStruct(dwarf, dwarfStructKeys);
        }
    }
}
void DwarfParser :: lookupStructElementsInDwarfTree ( DwarfTreeObj & dwarf , uint64_t dwarfKey , int depth ) { if ( isStructDepthLevelZero ( dwarf ) || depth > 0 ) { string parentDataType = dwarf . getDataType ( ) . first ; string srcFileParent = dwarf . getSourcePath ( ) ; if ( parentDataType . size ( ) > 0 ) { map < uint64_t , shared_ptr < DwarfTreeObj > > :: reverse_iterator itRevDwarfTreeElement ( dwarfTree . find ( dwarfKey ) ) ; vector < uint64_t > dwarfStructKeys ; for ( auto & it = itRevDwarfTreeElement ; it != dwarfTree . rend ( ) ; ++ it ) { shared_ptr < DwarfTreeObj > dwarfChild = it -> second ; if ( ( isChildOfParentStruct ( parentDataType , dwarfChild -> getStructName ( ) ) ) && isStructChildValid ( * dwarfChild ) ) { uint64_t key = it -> first ; dwarfStructKeys . push_back ( key ) ; if ( dwarfChild -> getAbsType ( ) == AbstractType :: Struct ) { if ( depth <= STRUCT_MEMBER_SEARCH_DEPTH_MAX ) { lookupStructElementsInDwarfTree ( * dwarfChild , key , ++ depth ) ; } } } if ( isOutOfScope ( srcFileParent , dwarfChild -> getSourcePath ( ) ) ) { break ; } } addStructElementsToStruct ( dwarf , dwarfStructKeys ) ; } } }
@brief   reverse lookup, starting from struct name, set setStructElementsMapKey
@brief reverse lookup starting from struct name set setStructElementsMapKey