[dsymutil] Do not mistakenly reuse the current object file when the next one isn...
authorFrederic Riss <friss@apple.com>
Mon, 31 Aug 2015 05:16:35 +0000 (05:16 +0000)
committerFrederic Riss <friss@apple.com>
Mon, 31 Aug 2015 05:16:35 +0000 (05:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246412 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/dsymutil/X86/empty_range.s
tools/dsymutil/DwarfLinker.cpp

index 5c8ae6a18265a34cea20106b4dfbb6427c7f49a4..dfe734f1b2bb436eaf1ff0b71ef419f7504427a3 100644 (file)
@@ -55,3 +55,7 @@ Ldebug_range:
 # CHECK-NEXT:      DW_AT_low_pc{{.*}}(0x0000000000010000)
 # CHECK-NEXT:      DW_AT_ranges{{.*}}(0x00000000)
 
+# There was a bug that would use the currently active object file when a
+# debug map object isn't found. Check that we only linked one file.
+# CHECK-NOT: DW_TAG_compile_unit
+
index f3e48f5033e615549fcf41aa149a96fd4143ab76..ed06dba8ab3147e12c5ab23b756ae83bb24818b4 100644 (file)
@@ -2942,8 +2942,10 @@ DwarfLinker::loadObject(BinaryHolder &BinaryHolder, DebugMapObject &Obj,
                         const DebugMap &Map) {
   auto ErrOrObjs =
       BinaryHolder.GetObjectFiles(Obj.getObjectFilename(), Obj.getTimestamp());
-  if (std::error_code EC = ErrOrObjs.getError())
+  if (std::error_code EC = ErrOrObjs.getError()) {
     reportWarning(Twine(Obj.getObjectFilename()) + ": " + EC.message());
+    return EC;
+  }
   auto ErrOrObj = BinaryHolder.Get(Map.getTriple());
   if (std::error_code EC = ErrOrObj.getError())
     reportWarning(Twine(Obj.getObjectFilename()) + ": " + EC.message());