Index: lib/DebugInfo/DWARFContext.cpp =================================================================== --- lib/DebugInfo/DWARFContext.cpp +++ lib/DebugInfo/DWARFContext.cpp @@ -394,15 +394,15 @@ bool operator()(const std::unique_ptr &LHS, const std::unique_ptr &RHS) const { - return LHS->getOffset() < RHS->getOffset(); + return LHS->getNextUnitOffset() < RHS->getNextUnitOffset(); } bool operator()(const std::unique_ptr &LHS, uint32_t RHS) const { - return LHS->getOffset() < RHS; + return LHS->getNextUnitOffset() < RHS; } bool operator()(uint32_t LHS, const std::unique_ptr &RHS) const { - return LHS < RHS->getOffset(); + return LHS < RHS->getNextUnitOffset(); } }; } @@ -411,7 +411,7 @@ parseCompileUnits(); std::unique_ptr *CU = - std::lower_bound(CUs.begin(), CUs.end(), Offset, OffsetComparator()); + std::upper_bound(CUs.begin(), CUs.end(), Offset, OffsetComparator()); if (CU != CUs.end()) { return CU->get(); }