[PATCH] Fix DWARFContext::getCompileUnitForOffset().

Frederic Riss friss at apple.com
Mon Sep 15 13:26:53 PDT 2014


================
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());
----------------
samsonov wrote:
> 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.
Thanks! And sorry, I should have checked that the old review reply got sent out.
David are you also OK with this? I gathered that maybe you wanted to look more into the implications of this.

http://reviews.llvm.org/D5262






More information about the llvm-commits mailing list