PeerToFinderPeerLocationFindResultPtr PeerToFinderPeerLocationFindResult::create(ElementPtr root) { PeerToFinderPeerLocationFindResultPtr ret(new message::PeerToFinderPeerLocationFindResult); ret->mID = IMessageHelper::getAttributeID(root); ret->mTime = IMessageHelper::getAttributeEpoch(root); ElementPtr locs = root->findFirstChildElement("locations"); if (locs) { LocationList ll; ElementPtr loc = locs->findFirstChildElement("location"); while (loc) { Location l = MessageHelper::createLocation(loc->findFirstChildElement("details")); l.mID = IMessageHelper::getAttributeID(loc); ll.push_back(l); loc = loc->getNextSiblingElement(); } if (ll.size() > 0) ret->mLocations = ll; } return ret; }
LocationList location_list( simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr) { LocationList locations; std::ptrdiff_t offset = 0; while (1) { Dwarf_Addr base, start, end; Dwarf_Op *ops; std::size_t len; offset = dwarf_getlocations( &attr, offset, &base, &start, &end, &ops, &len); if (offset == 0) break; else if (offset == -1) xbt_die("Error while loading location list"); std::uint64_t base_address = (std::uint64_t) info.base_address(); LocationListEntry::range_type range; if (start == 0) // If start == 0, this is not a location list: range = { 0, UINT64_MAX }; else range = { base_address + start, base_address + end }; locations.push_back({ DwarfExpression(ops, ops+len), range }); } return locations; }