[Lldb-commits] [lldb] r131550 - /lldb/trunk/source/Target/SectionLoadList.cpp

Greg Clayton gclayton at apple.com
Wed May 18 11:22:47 PDT 2011


Author: gclayton
Date: Wed May 18 13:22:47 2011
New Revision: 131550

URL: http://llvm.org/viewvc/llvm-project?rev=131550&view=rev
Log:
One more fix to:

bool SectionLoadList::ResolveLoadAddress (addr_t load_addr, Address &so_addr) const;

Where if the address is in the last map entry, we need to look it up correctly.
My previous fix was incorrect where it looked in the first if there were
no addresses in the map that were > load_addr. Now we correctly look in the
last entry if our std::map::lower_bound search returns the end of the 
collection.


Modified:
    lldb/trunk/source/Target/SectionLoadList.cpp

Modified: lldb/trunk/source/Target/SectionLoadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadList.cpp?rev=131550&r1=131549&r2=131550&view=diff
==============================================================================
--- lldb/trunk/source/Target/SectionLoadList.cpp (original)
+++ lldb/trunk/source/Target/SectionLoadList.cpp Wed May 18 13:22:47 2011
@@ -194,15 +194,17 @@
         }
         else
         {
-            pos = m_addr_to_sect.begin();
-            if (load_addr >= pos->first)
+            // There are no entries that have an address that is >= load_addr,
+            // so we need to check the last entry on our collection.
+            addr_to_sect_collection::const_reverse_iterator rpos = m_addr_to_sect.rbegin();
+            if (load_addr >= rpos->first)
             {
-                addr_t offset = load_addr - pos->first;
-                if (offset < pos->second->GetByteSize())
+                addr_t offset = load_addr - rpos->first;
+                if (offset < rpos->second->GetByteSize())
                 {
                     // We have found the top level section, now we need to find the
                     // deepest child section.
-                    return pos->second->ResolveContainedAddress (offset, so_addr);
+                    return rpos->second->ResolveContainedAddress (offset, so_addr);
                 }
             }
         }





More information about the lldb-commits mailing list