[PATCH] Fix DWARFContext::getCompileUnitForOffset().

Alexey Samsonov vonosmas at gmail.com
Mon Sep 15 13:08:09 PDT 2014


LGTM

================
Comment at: lib/DebugInfo/DWARFUnit.h:66
@@ -65,3 +65,3 @@
   UnitType *getUnitForOffset(uint32_t Offset) const {
-    auto *CU = std::lower_bound(this->begin(), this->end(), Offset,
+    auto *CU = std::upper_bound(this->begin(), this->end(), Offset,
                                 UnitOffsetComparator());
----------------
friss wrote:
> samsonov wrote:
> > You still need to check that Offset you're looking for is inside the CU.
> I might be wrong, but as I answered last time you told me that, I think this is not true. The admissible offsets go from 0 to lastUnit->getNextUnitOffset() exclusive. There is no hole in the section.
Sorry, I've received both answers at the same time (probably, your first comment was saved as draft but not submitted).

You are right - there are no holes. Please add a comment about it and feel free to submit this.

http://reviews.llvm.org/D5262






More information about the llvm-commits mailing list