[llvm] r350591 - [dsymutil] Fix assertion triggered by empty address range.

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 7 17:08:09 PST 2019


Author: jdevlieghere
Date: Mon Jan  7 17:08:09 2019
New Revision: 350591

URL: http://llvm.org/viewvc/llvm-project?rev=350591&view=rev
Log:
[dsymutil] Fix assertion triggered by empty address range.

An assertion was hit when running dsymutil on a gcc generated binary
that contained an empty address range. Address ranges are stored in an
interval map of half open intervals. Since the interval is empty and
therefore meaningless, we simply don't add it to the map.

Modified:
    llvm/trunk/tools/dsymutil/CompileUnit.cpp

Modified: llvm/trunk/tools/dsymutil/CompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/CompileUnit.cpp?rev=350591&r1=350590&r2=350591&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/CompileUnit.cpp (original)
+++ llvm/trunk/tools/dsymutil/CompileUnit.cpp Mon Jan  7 17:08:09 2019
@@ -92,7 +92,11 @@ void CompileUnit::addLabelLowPc(uint64_t
 
 void CompileUnit::addFunctionRange(uint64_t FuncLowPc, uint64_t FuncHighPc,
                                    int64_t PcOffset) {
-  Ranges.insert(FuncLowPc, FuncHighPc, PcOffset);
+  //  Don't add empty ranges to the interval map.  They are a problem because
+  //  the interval map expects half open intervals. This is safe because they
+  //  are empty anyway.
+  if (FuncHighPc != FuncLowPc)
+    Ranges.insert(FuncLowPc, FuncHighPc, PcOffset);
   this->LowPc = std::min(LowPc, FuncLowPc + PcOffset);
   this->HighPc = std::max(HighPc, FuncHighPc + PcOffset);
 }




More information about the llvm-commits mailing list