Beispiel #1
0
SymSet SubtypeUnqualifier::bindings() const {
  SymSet r;
  for (SubtypeEliminators::const_iterator e = this->eliminators.begin(); e != this->eliminators.end(); ++e) {
    SymSet x = (*e)->bindings();
    r.insert(x.begin(), x.end());
  }
  return r;
}
Beispiel #2
0
SymSet UnqualifierSet::bindings() const {
  SymSet r;
  for (Unqualifiers::const_iterator uq = this->uqs.begin(); uq != this->uqs.end(); ++uq) {
    SymSet qr = uq->second->bindings();
    r.insert(qr.begin(), qr.end());
  }
  return r;
}
Beispiel #3
0
/*! If there are any SymSets that overlap between the two SymAliasSets
    then merge those SymSets in the new SymAliasSets data structure.
*/
OA_ptr<SymAliasSets> 
SymAliasSets::meet(SymAliasSets& other) 
{
    if (debug) {
        std::cout << "SymAliasSets::meet" << std::endl;
    }

    // create empty return data structure
    OA_ptr<SymAliasSets> retval;
    retval = new SymAliasSets;

    // loop through other's SymSets and insert them into retval
    std::map<int,OA_ptr<SymSet> >::iterator mapIter;
    for (mapIter = other.mIdToSymSetMap.begin();
         mapIter != other.mIdToSymSetMap.end(); mapIter++ )
    {
        OA_ptr<SymSet> theSet = mapIter->second;
        retval->insertSet(theSet);
    }
    

    // loop through our SymSets
    for (mapIter = mIdToSymSetMap.begin();
         mapIter != mIdToSymSetMap.end(); mapIter++ )
    {
        OA_ptr<SymSet> theSet = mapIter->second;
        bool theSetWasMerged = false;

        // see if intersects any of the SymSets in other
        std::map<int,OA_ptr<SymSet> >::iterator mapIterOther;
        for (mapIterOther = retval->mIdToSymSetMap.begin();
             mapIterOther != retval->mIdToSymSetMap.end(); mapIterOther++ )
        {
            OA_ptr<SymSet> otherSet = mapIterOther->second;

            SymSet temp = *theSet;
            temp.setIntersect(*otherSet);

            // if they intersect then merge them
            if (! temp.empty() ) {
                theSetWasMerged = true;
                OA_ptr<SymSet> unionSet;
                unionSet = theSet;
                unionSet->setUnion(*otherSet);
                retval->replaceSet(mapIterOther->first, unionSet);
            }
        }

        // if theSet wasn't merged then put it in SymAliasSets
        if (theSetWasMerged==false) {
            retval->insertSet(theSet);
        }

    }
        
    return retval;
 }
Beispiel #4
0
RefPtr<DebugSymbol>
lookup_child(DebugSymbol& obj, const char* name, SymSet& symset)
{
    if (!symset.insert(make_pair(obj.name(), obj.addr())).second)
    {
        return NULL;
    }
    InfiniteRecursivityGuard guard(symset, &obj);

    if (!obj.value())
    {
        obj.read(NULL);
    }

    DebugSymbolList objects;
    ClassType* klass = interface_cast<ClassType*>(obj.type());

    const size_t count = obj.enum_children(NULL);

    for (size_t n = 0; n != count; ++n)
    {
        RefPtr<DebugSymbol> child = obj.nth_child(n);

        if (!child->name())
        {
            continue;
        }
        if (child->name()->is_equal(name))
        {
            return child;
        }

        // build a list of anonymous members and base classes
        // to recurse into
        if (klass)
        {
            if (child->name()->is_equal2(unnamed_type()))
            {
                assert (interface_cast<ClassType*>(child->type()));
                objects.push_back(child);
            }
            else if (child->type()
                  && klass->lookup_base(child->type()->name(), NULL, true))
            {
                objects.push_back(child);
            }
        }
        else if (interface_cast<ClassType*>(child->type()))
        {
            objects.push_back(child);
        }
    }
    // now dive into base classes
    for (DebugSymbolList::const_iterator i = objects.begin();
         i != objects.end();
         ++i)
    {
        if (RefPtr<DebugSymbol> child = lookup_child(**i, name, symset))
        {
            return child;
        }
    }
    return NULL;
}