/// Load the current object file symbols into CurrentObjectAddresses.
void MachODebugMapParser::loadCurrentObjectFileSymbols(
    const object::MachOObjectFile &Obj) {
  CurrentObjectAddresses.clear();

  for (auto Sym : Obj.symbols()) {
    StringRef Name;
    uint64_t Addr = UnknownAddressOrSize;
    SymbolRef::Type Type;
    StringRef SecName;

    // Undefined symbols won't have an address, but we still want
    // them, because they might be referenced in the debug information.
    Sym.getAddress(Addr);

    object::section_iterator Section = Obj.section_end();
    if (!Sym.getSection(Section) && Section != Obj.section_end())
      Section->getName(SecName);

    if (Sym.getName(Name) || Name.empty() ||
        Sym.getType(Type) || Type == SymbolRef::ST_Other)
      continue;

    CurrentObjectAddresses.insert(std::make_pair(Name, std::make_pair(Addr, SecName)));
    uint32_t Flags;

    Flags = Sym.getFlags();
    uint64_t Value;
    // FIXME: We put every symbol in the debug map, because of the
    // behavior expected from lookupObjectAddress.
      Value = getMainBinarySymbolAddress(Name);

    // Symbols with no known address on either side are of absolutely
    // no use.
    if (Addr != UnknownAddressOrSize || Value != UnknownAddressOrSize)
      CurrentDebugMapObject->addSymbol(Name, Addr, Value, 0, SecName, true);
  }
}