- if (!error(BinaryOrErr.getError())) {
- OwningBinary<Binary> &B = BinaryOrErr.get();
- Obj = getObjectFileFromBinary(B.getBinary(), ArchName);
- if (!Obj) {
- ObjectPair Res = std::make_pair(nullptr, nullptr);
- ObjectPairForPathArch[std::make_pair(Path, ArchName)] = Res;
- return Res;
- }
- addOwningBinary(std::move(B));
- if (auto MachObj = dyn_cast<const MachOObjectFile>(Obj))
- DbgObj = lookUpDsymFile(Path, MachObj, ArchName);
- // Try to locate the debug binary using .gnu_debuglink section.
- if (!DbgObj) {
- std::string DebuglinkName;
- uint32_t CRCHash;
- std::string DebugBinaryPath;
- if (getGNUDebuglinkContents(Obj, DebuglinkName, CRCHash) &&
- findDebugBinary(Path, DebuglinkName, CRCHash, DebugBinaryPath)) {
- BinaryOrErr = createBinary(DebugBinaryPath);
- if (!error(BinaryOrErr.getError())) {
- OwningBinary<Binary> B = std::move(BinaryOrErr.get());
- DbgObj = getObjectFileFromBinary(B.getBinary(), ArchName);
- addOwningBinary(std::move(B));
+ if (auto EC = BinaryOrErr.getError()) {
+ ObjectPairForPathArch.insert(
+ std::make_pair(std::make_pair(Path, ArchName), EC));
+ return EC;
+ }
+ OwningBinary<Binary> &B = BinaryOrErr.get();
+
+ auto ObjOrErr = getObjectFileFromBinary(B.getBinary(), ArchName);
+ if (auto EC = ObjOrErr.getError()) {
+ ObjectPairForPathArch.insert(
+ std::make_pair(std::make_pair(Path, ArchName), EC));
+ return EC;
+ }
+ addOwningBinary(std::move(B));
+
+ ObjectFile *Obj = ObjOrErr.get();
+ assert(Obj != nullptr);
+ ObjectFile *DbgObj = nullptr;
+
+ if (auto MachObj = dyn_cast<const MachOObjectFile>(Obj))
+ DbgObj = lookUpDsymFile(Path, MachObj, ArchName);
+ // Try to locate the debug binary using .gnu_debuglink section.
+ if (!DbgObj) {
+ std::string DebuglinkName;
+ uint32_t CRCHash;
+ std::string DebugBinaryPath;
+ if (getGNUDebuglinkContents(Obj, DebuglinkName, CRCHash) &&
+ findDebugBinary(Path, DebuglinkName, CRCHash, DebugBinaryPath)) {
+ ErrorOr<OwningBinary<Binary>> DebugBinaryOrErr =
+ createBinary(DebugBinaryPath);
+ if (DebugBinaryOrErr) {
+ OwningBinary<Binary> &DB = DebugBinaryOrErr.get();
+ auto DbgObjOrErr = getObjectFileFromBinary(DB.getBinary(), ArchName);
+ if (DbgObjOrErr) {
+ DbgObj = DbgObjOrErr.get();
+ assert(DbgObj != nullptr);
+ addOwningBinary(std::move(DB));